15 years agoFix journalling of output ids hvy-metal-2 hvy-metal-2.13
Markus Armbruster [Sat, 2 Aug 2008 13:04:16 +0000 (09:04 -0400)]
Fix journalling of output ids

15 years agoFix struct loststr / struct empobj mismatch corrupting lostitems hvy-metal-2.12
Markus Armbruster [Fri, 1 Aug 2008 12:50:24 +0000 (08:50 -0400)]
Fix struct loststr / struct empobj mismatch corrupting lostitems

The initial parts of struct loststr and struct empobj must match.
Commit 49780e2c screwed that up for members lost_uid/uid, which also
broke the equivalence of lost_owner/own.  Since lost_uid is not used,
the former had no effect.  But the latter broke xdvisible().  Could
make xdump lost leak information.

Commit a680c811 reorderd struct loststr members to make lost_timestamp
equivalent to new struct empobj member timestamp, but failed due to
the bug in commit 49780e2c.  Commit f33b96b1 then set the timestamp
through empobj, which screwed up timestamps in lostitems, i.e. it
broke incremental xdump lost.

All of the above is in v4.3.12.

Commit 536ef0b0 (v4.3.15) added lost_seqno / seqno.  No effect,
because only seqno is used.
(cherry picked from commit eb252201b69a591523e8a68b41c01f4a80e7b731)

15 years agoJournal output lines instead of chunks hvy-metal-2.11
Markus Armbruster [Wed, 30 Jul 2008 12:26:34 +0000 (08:26 -0400)]
Journal output lines instead of chunks

Output often arrives in chunks other than lines.  Hard to read in the
journal.  Delay journalling until we got a full line or our buffer is
exhausted.  This is less precise, but it'll do for now.

15 years agoNew journal event output hvy-metal-2.10
Markus Armbruster [Wed, 30 Jul 2008 00:38:48 +0000 (20:38 -0400)]
New journal event output

To enable, set econfig key keep_journal to at least 2.  Output events
are *not* flushed to disk immediately.

Put it in Hvy Metal II now to gather real data for future testing of a
journal replay tool.

15 years agoNew journal event command
Markus Armbruster [Tue, 29 Jul 2008 11:48:28 +0000 (07:48 -0400)]
New journal event command

Redundant information, but makes the journal easier to read.  The
redundancy might help making a journal replay tool robust.

Put it in Hvy Metal II now to gather some real data.

15 years agoUse country number as journal thread ID when possible
Markus Armbruster [Tue, 29 Jul 2008 11:32:36 +0000 (07:32 -0400)]
Use country number as journal thread ID when possible

Before, we used the value of empth_thread().  That can be mapped to
countries by tracking login and logout.  Easy for machines (except
when the journal is rotated while players are logged in), but tedious
for humans.

Quick version for Hvy Metal II.  Needs further work for the stock

15 years agoFix interdiction to obey op-area for missiles hvy-metal-2.9
Markus Armbruster [Fri, 25 Jul 2008 12:40:01 +0000 (08:40 -0400)]
Fix interdiction to obey op-area for missiles

Never worked correctly.  Reported by Gregory E. Garland.
(cherry picked from commit 3eb58312b32ebb5e056679eb68e11749b61b72cc)

15 years agoFix treatment of EOF from player hvy-metal-2.8
Markus Armbruster [Tue, 15 Jul 2008 02:37:02 +0000 (22:37 -0400)]
Fix treatment of EOF from player

Commit 79407e68 (v4.3.11) changed recvclient() to keep failing after
receiving EOF from player.  This was bad, because some places getting
input check player->aborted instead of recvclient() failure, and
player->aborted wasn't set on EOF.  Bugs caused by this:

* comm_bomb(), ship_bomb(), plane_bomb(), land_bomb() went into an
  infinite loop that eventually ate all memory.

* deli(), desi(), dist(), fly(), morale(), zdon(), att_prompt(),
  ask_move_in() interpreted EOF as empty input instead of no more

* cmd_sail_ship() dereferenced a null pointer.

Fix by setting player->aborted on EOF, too.
(cherry picked from commit b3a7a8ee11595aac2bd27f76b3adf9e4c48bb0eb)

15 years agoSimplify breaking of command loop
Markus Armbruster [Tue, 15 Jul 2008 02:30:28 +0000 (22:30 -0400)]
Simplify breaking of command loop

Change status() to check player->eof instead of io_error() and
io_eof().  Ignore value of command().
(cherry picked from commit 9c5854c8c93979c1744c97c90df672070e080a99)

15 years agoChange recvclient() to treat io_error() like io_eof()
Markus Armbruster [Tue, 15 Jul 2008 02:24:42 +0000 (22:24 -0400)]
Change recvclient() to treat io_error() like io_eof()

This is for consistency with status() and player_login().
(cherry picked from commit b7153d095ccab8b397a3eaa3326a1806a6f616fa)

15 years agoOops when player thread keeps reading input unsuccessfully
Markus Armbruster [Sun, 13 Jul 2008 02:41:52 +0000 (22:41 -0400)]
Oops when player thread keeps reading input unsuccessfully

Reading input fails after EOF and while the current command is
aborted.  Commands should detect that and fail.  If a command neglects
to do that in a loop, the loop can become infinite.  This is
especially bad after EOF, because then the client might not read
output anymore.  Output gets buffered until memory runs out.

Mitigate such bugs by counting how many calls have failed in a row,
oopsing on the 256th, and sleeping one minute from the 256th on.
(cherry picked from commit 49c24d7b78d728f84ab4932572914aab71ddbc1e)

15 years agoFix seqno mismatch in fly()
Markus Armbruster [Sat, 12 Jul 2008 14:56:30 +0000 (10:56 -0400)]
Fix seqno mismatch in fly()

fly() reads the carrier, then passes it to pln_dropoff(), which writes
it back.  fly() also calls pln_oneway_to_carrier_ok(), which updates
the carrier when its plane summary information is incorrect.

The old code called it between reading the carrier and passing it to
pln_dropoff().  This made pln_dropoff() wipe out the plane summary
update, and triggered a seqno mismatch oops.  Broken by introduction
of pln_oneway_to_carrier_ok() in commit 1127762c, v4.2.17.

Fix by reading the carrier right before passing it to pln_dropoff().
(cherry picked from commit 42d9475d894f6779dab17655cd5082b66b9acac9)

15 years agoDon't fix up dead planes stuck in the air
Markus Armbruster [Thu, 10 Jul 2008 23:35:51 +0000 (19:35 -0400)]
Don't fix up dead planes stuck in the air

Missile interdiction leaves behind used up missiles with the
PLN_LAUNCHED flag set.  This can lead to a bogus warning from
pln_zap_transient_flags() on server restart.

Change pln_zap_transient_flags() to ignore dead planes.
(cherry picked from commit 7a06a58bec0435a66a682269397193d8d17461de)

15 years agoFix flying commands not to let planes do double duty as escorts hvy-metal-2.7
Markus Armbruster [Sat, 28 Jun 2008 15:24:43 +0000 (11:24 -0400)]
Fix flying commands not to let planes do double duty as escorts

Commit 7ca4f412 (v4.3.12) marked planes flying a sortie with
PLN_LAUNCHED, and made pln_arm() reject planes with that flag set.
This was designed to reject escorts that were already flying as
bombers.  It didn't work, because the test for PLN_LAUNCHED used a
stale copy of the plane created by pln_sel().  Fix by getting a fresh

The bug always existed, but the botched fix in commit 7ca4f412 made it
worse.  Before, ac_encounter() dropped escorts that were also bombers,
so the bug merely wasted plane fuel.  After, such planes were
effectively duplicated, and damage to one of them, usually the bomber,
was wiped out.  Abusable.
(cherry picked from commit 801780043fd2629b0859013d12caada2e8060688)

15 years agoFix seqno mismatch and use-after-free in shp_sweep()
Markus Armbruster [Sat, 28 Jun 2008 13:15:49 +0000 (09:15 -0400)]
Fix seqno mismatch and use-after-free in shp_sweep()

The code wrote the swept sector after calling shp_check_one_mines().
This failed to use up the mine that hit the minesweeper, and triggered
a seqno mismatch oops.

The code wrote the minesweeper after calling shp_check_one_mines().
This used freed memory when the minesweeper got sunk there.

Broken in 4.0.17.  Fix by moving both calls before
(cherry picked from commit b0644e822cd10d93c1168f7b356068fabc02b2bf)

15 years agoDon't unlimber when guns unsuccessfully try to fire hvy-metal-2.6
Markus Armbruster [Fri, 27 Jun 2008 10:53:43 +0000 (06:53 -0400)]
Don't unlimber when guns unsuccessfully try to fire

This happened when fire command failed becayse the gun lacked shells,
and when other ways to fire failed because the gun was inefficient,
embarked, lacked mil, guns or shells.

Broken in commit b8bdc32b, hvy-metal-2.4.

15 years agoDon't let non-light units board ships that can't carry them hvy-metal-2.5
Markus Armbruster [Tue, 17 Jun 2008 18:16:27 +0000 (20:16 +0200)]
Don't let non-light units board ships that can't carry them

ask_olist() let non-light land units board ships that can carry only
light units.  If the board succeeds, the non-light unit move onto the
ship and then are stuck there.
(cherry picked from commit 6d38a0493032b3b13adbbcbd07b65663e7368be3)

15 years agoUpdate info BTU on Empire clock and work percentage
Markus Armbruster [Sun, 15 Jun 2008 06:45:15 +0000 (08:45 +0200)]
Update info BTU on Empire clock and work percentage

Work percentage should have been documented in commit 233fce87,

Empire clock should have been documented in commit d3e0597f, v4.3.10.
(cherry picked from commit 4a670806566151254681abbf85e41ee5330566cb)

15 years agoUpdate info Citizens on census showing old owner
Markus Armbruster [Sun, 15 Jun 2008 05:38:18 +0000 (07:38 +0200)]
Update info Citizens on census showing old owner

This was forgotten in commit 6b434ee3, v4.3.0.
(cherry picked from commit 860369ec7e968417cb7aad2af96f070dfb96addf)

15 years agoFix ship interdiction targeting ships not at sea hvy-metal-2.4
Markus Armbruster [Sun, 8 Jun 2008 09:35:04 +0000 (11:35 +0200)]
Fix ship interdiction targeting ships not at sea

perform_mission() needs to know whether it is targeting ships or
something else, because the rules differ: submarines interdict only
ships, land units get their damage reduced when interdicting ships,
and different news are generated.

The old code assumed it was targeting ships when the target sector was
sea.  Wrong when interdicting ships in harbors, bridges and such.
This has always been broken.  Except when checking a submarine's
target: there it tested argument s, which is gross, but at least it
works.  That code was added in v4.0.8.

Replace the broken test by the gross hack everywhere.  This fixes news
and damage from land units when ships get interdicted in non-sea
(cherry picked from commit 3e251b474fb90089c15ea8b5ece4c4f74962d0c0)

15 years agoFix ground combat to report defending land units
Markus Armbruster [Sat, 31 May 2008 08:35:47 +0000 (10:35 +0200)]
Fix ground combat to report defending land units

Commit 092a52f2 (v4.3.4) removed the code to estimate defense, because
the use of the estimate had been disabled since v4.0.0.  This
accidentally removed the reporting of defending units, because
get_dlist() reported them when called for an estimate, and not when
called for real.

Fix by removing the unused estimate capability from get_dlist().  It
now reports defending units always.
(cherry picked from commit 64f44e99044a8b28b8631a27fc882a959f737f84)

15 years agoFix unlimbering, it had no effect
Markus Armbruster [Tue, 10 Jun 2008 05:29:04 +0000 (07:29 +0200)]
Fix unlimbering, it had no effect

Broken by mismerging the rebase of Hvy Metal I in commit 5d0f5e69,
except for fire command when the target was out of range.

15 years agoClarify info Railroad on track stopping at national borders
Markus Armbruster [Mon, 9 Jun 2008 18:07:28 +0000 (20:07 +0200)]
Clarify info Railroad on track stopping at national borders

15 years agoAvoid seqno mismatch oops in recursive land unit supply hvy-metal-2.3
Markus Armbruster [Wed, 28 May 2008 20:30:36 +0000 (22:30 +0200)]
Avoid seqno mismatch oops in recursive land unit supply

Before s_commod() attempts to recursively supply a supply unit it
wants to use as supply source, it zaps the unit's load.  When
actually_doit is false, it later restores the old load by overwriting
the change with a saved copy of the unit.  That triggers a seqno
mismatch oops.

Avoid that by copying the new sequence number to the saved copy.
(cherry picked from commit aacd0fb754ef060af92bb08907c5cda196bf34e3)

15 years agoDon't run supply machinery to get zero units
Markus Armbruster [Wed, 28 May 2008 05:35:22 +0000 (07:35 +0200)]
Don't run supply machinery to get zero units

Change supply_commod() and try_supply_commod() not to call s_commod()
when zero units are wanted.

This isn't just for efficiency, it's also for limiting exposure to
supply bugs a bit.
(cherry picked from commit 7f17369491f9d6a01f35d1017d9da49b308f80b4)

15 years agoFix type of get_seqno() from int to unsigned
Markus Armbruster [Fri, 16 May 2008 05:33:20 +0000 (07:33 +0200)]
Fix type of get_seqno() from int to unsigned

While there, document the seqno functions.

15 years agoFix crash bug in satellite maps
Markus Armbruster [Tue, 13 May 2008 06:36:06 +0000 (08:36 +0200)]
Fix crash bug in satellite maps

The value of diffx() had the wrong sign when the arguments differed by
WORLD_X / 2.  Same for diffy() and WORLD_Y / 2.  satmap() used them to
find the vector from map center to ship or land unit to put on the
map, and got incorrect values for ships and land units directly
opposite to the center in x or y.  The bug made satmap() read a
pointer out bounds of its malloced radbuf[], and then write through
that with unpredictable consequences.

Broken in 4.2.12.  The original bug was in Empire 1.1: it
miscalculated where to put ships on the map (no crash).  An incomplete
fix for radmap() and satmap() appeared in Chainsaw 2 (still no crash).
radmap() got fixed correctly in Chainsaw 3, but satmap() was
forgotten.  That one got "fixed" in 4.2.7, and again in 4.2.12, but
both "fixes" were flawed and could crash.

Fix by backing out the flawed fixes and adopting the fix from radmap()
(cherry picked from commit 0cc474bd6dd095235330f4e15141c9d5e5adc4b4)

15 years agoFix XNORM() and YNORM() hvy-metal-2.2a
Markus Armbruster [Mon, 12 May 2008 16:45:11 +0000 (18:45 +0200)]
Fix XNORM() and YNORM()

Broken in commit 5f764285 (v4.3.12) for negative multiples of WORLD_X
and WORLD_Y, respectively.

This could theoretically lead to buffer overruns and other
unpleasantness.  None have been reproduced, though.
(cherry picked from commit 7680acc39fd63684c6854f27e99a2a5e18712473)

15 years agoDisable incorrect use of resupply_all() in load and lload
Markus Armbruster [Mon, 12 May 2008 15:22:39 +0000 (17:22 +0200)]
Disable incorrect use of resupply_all() in load and lload

load_land_ship() and load_land_land() automatically resupply the land
units they load.  This can draw supplies from the sector where the
land units are.  When load() and lload() later update the sector, they
wipe out the update made for drawing supplies, and we get a seqno
mismatch oops.  Highly abusable.

15 years agoFix edit l, s, u, p not to wipe out concurrent updates hvy-metal-2.1a
Markus Armbruster [Sat, 10 May 2008 06:40:48 +0000 (08:40 +0200)]
Fix edit l, s, u, p not to wipe out concurrent updates

Make edit() bail out if the edited object changed while edit() slept
for input.
(cherry picked from commit a1f4dc95920e579432dfbd0e7664558f8c3ca1fc)

15 years agoFix xdump nat for relations
Markus Armbruster [Sat, 10 May 2008 06:36:45 +0000 (08:36 +0200)]
Fix xdump nat for relations

Commit ee863c5d (v4.3.12) got opt_HIDDEN backwards in nstr_exec_val().
(cherry picked from commit 3dbb4dbb9364100d1e3862994202f2835c78ba5a)

15 years agoFix origin command not to prompt twice for its argument
Markus Armbruster [Wed, 7 May 2008 20:05:22 +0000 (22:05 +0200)]
Fix origin command not to prompt twice for its argument

Broken in commit b69173ee, v4.3.0.
(cherry picked from commit 27c3466aa5669b442eca850495107aee8110c228)

15 years agoCover biofuel plant in info Quick-ref
Markus Armbruster [Sat, 10 May 2008 10:49:02 +0000 (12:49 +0200)]
Cover biofuel plant in info Quick-ref

15 years agoFix markup in info Hvy-Metal
Markus Armbruster [Sat, 10 May 2008 10:48:24 +0000 (12:48 +0200)]
Fix markup in info Hvy-Metal

15 years agoDisable another incorrect use of supply_commod()
Markus Armbruster [Sat, 10 May 2008 07:27:52 +0000 (09:27 +0200)]
Disable another incorrect use of supply_commod()

navi() reads the ships into a list.  When the ships get interdicted,
and lack flak shells, ac_shipflak() tries to get one and updates the
ship.  When the ship in the list is later written back, e.g. to apply
interdiction damage, the flak shell is wiped out, and we get a seqno
mismatch oops.

Disable automatic flak shell supply in ac_ship_flak() for now.  This
is related to commit f7d61817, which disabled automatic supply of
shells in ac_doflak() and shp_missile_defense().

15 years agoFix edit command seqno oopses hvy-metal-2.0a
Markus Armbruster [Mon, 5 May 2008 19:26:12 +0000 (21:26 +0200)]
Fix edit command seqno oopses

Broken by commit dc9d847b.

15 years agoAvoid compiler warning
Markus Armbruster [Mon, 5 May 2008 19:54:02 +0000 (21:54 +0200)]
Avoid compiler warning

15 years agoDebug code to help catch the phantom nuke bug
Markus Armbruster [Sat, 26 Apr 2008 07:53:47 +0000 (09:53 +0200)]
Debug code to help catch the phantom nuke bug

Thu Apr 24 12:20:52 2008 Oops: bug in ../src/lib/subs/plnsub.c:1146

#3  0x080e64f4 in oops (msg=0x0, file=0x80ff1ca "../src/lib/subs/plnsub.c",
    line=1146) at ../src/lib/gen/log.c:141
#4  0x080bce6c in pln_damage (pp=0x8415b60, x=82, y=20, type=115 's',
    nukedamp=0x84158bc, noisy=1) at ../src/lib/subs/plnsub.c:1146
#5  0x080684f2 in launch_missile (pp=0x8415b60, sublaunch=0)
    at ../src/lib/commands/laun.c:281
#6  0x08067c79 in laun () at ../src/lib/commands/laun.c:111

15 years agoUpdate info Hvy-Metal for Hvy Metal II
Markus Armbruster [Thu, 24 Apr 2008 19:13:06 +0000 (21:13 +0200)]
Update info Hvy-Metal for Hvy Metal II

15 years agoPermit ships to assault the sector they're in
Markus Armbruster [Thu, 24 Apr 2008 18:38:57 +0000 (20:38 +0200)]
Permit ships to assault the sector they're in

Ships still have to be in a sea sector to assault an adjacent sector.

15 years agoLet ships navigate bridge spans regardless of owner
Markus Armbruster [Thu, 24 Apr 2008 18:25:48 +0000 (20:25 +0200)]
Let ships navigate bridge spans regardless of owner

15 years agoDisable some incorrect uses of supply_commod()
Markus Armbruster [Thu, 24 Apr 2008 18:18:23 +0000 (20:18 +0200)]
Disable some incorrect uses of supply_commod()

Because supply_commod() updates supply sources it used, the caller
must not cache objects that could be supply sources across a supply
call.  This is very easy to get wrong.

ac_doflak() supplies flak shells if the sector hasn't enough for its
guns.  It caches the sector that receives them.  If the sector has
some shells, but not enough, it supplies them to itself, causing it to
be updated from within supply_commod().  ac_doflak() then adds the
supplied shells to its cached sector, then writes that back.  This
doubles shells already there, and triggers a a seqno mismatch oops.

shp_missile_defense() has similar problems, only for ships.

Disable ac_doflak() and shp_missile_defense() for now, to at least
reduce the oopsing to manageable levels.

Most likely other calls of supply_commod() are also wrong.  Many of
them can't be just disabled, because supply is too relevant to
gameplay there.

15 years agoOops on sequence number mismatch
Markus Armbruster [Mon, 21 Apr 2008 20:03:36 +0000 (22:03 +0200)]
Oops on sequence number mismatch

Old code only logged this, for fear of false positives.

15 years agoTrains can no longer be loaded on land units, update info Railroad
Markus Armbruster [Mon, 21 Apr 2008 20:00:06 +0000 (22:00 +0200)]
Trains can no longer be loaded on land units, update info Railroad

15 years agoFix info Railroad on spy and satellite reports
Markus Armbruster [Tue, 15 Apr 2008 06:05:46 +0000 (08:05 +0200)]
Fix info Railroad on spy and satellite reports

Fix explanation of "rl eff" value.  Mention satellite report.

15 years agoDon't store RAILWAYS track in sectors
Markus Armbruster [Tue, 15 Apr 2008 05:57:03 +0000 (07:57 +0200)]
Don't store RAILWAYS track in sectors

Storing track in sectors is problematic, because we need to update
adjacent sectors when updating a sector in a way that changes its
capability to extend railway into its neighbors.  This invalidates
cached adjacent sectors, and calling code may not be prepared for
that.  Specifically, bridge building caches the bridge head, and
writes it back later, wiping out the track update.

Replace struct sctstr member sct_track by new sct_rail_track().  Make
selector track virtual.  Remove the code to keep sct_track up-to-date:
set_railway(), update_railway().

Unfortunately, this causes cyclic dependencies between link libraries:
the virtual selector needs to be referenced from src/lib/global/nsc.c,
and it needs to reference stuff from src/lib/common/file.c.  Hack
around it in Make.mk for now.

15 years agoUpdate info Hvy-Metal for Hvy Metal II
Markus Armbruster [Sat, 5 Apr 2008 14:11:11 +0000 (16:11 +0200)]
Update info Hvy-Metal for Hvy Metal II

15 years agoMake fairland record the island number in the deity territory
Markus Armbruster [Sat, 5 Apr 2008 14:09:24 +0000 (16:09 +0200)]
Make fairland record the island number in the deity territory

Can be useful for deities when further customizing their game setup.

15 years agoDon't produce food without work
Markus Armbruster [Tue, 1 Apr 2008 18:17:52 +0000 (20:17 +0200)]
Don't produce food without work

We don't want to starve tiny populations, because that would require
players to move trivial amounts of food after explore and such.
growfood() used to simply grow at least 1f when a sector was about to
starve.  That food is almost never eaten by a tiny population, so we
effectively got some production without work.  Fix by taking away that
free food after people ate, in do_feed().

15 years agoAdd sequence numbers to game state (experimental)
Markus Armbruster [Fri, 21 Mar 2008 13:22:07 +0000 (14:22 +0100)]
Add sequence numbers to game state (experimental)

This catches output dependency violations, e.g. two threads doing a
read-modify-write without synchronization.

New struct emptypedstr member seqno.  Make sure all members of unit
empobj_storage share it.  Set it in ef_blank() and ef_set_uid(), step
it in ef_write().  fairland and files don't use ef_set_uid(); need to
set it manually in files.c's main() and file_sct_init().

Factor do_read() out of fillcache() to make it available for
new get_seqno().

15 years agoNew concept sector terrain
Markus Armbruster [Wed, 13 Feb 2008 19:54:08 +0000 (20:54 +0100)]
New concept sector terrain

A sector type's terrain (struct dchrstr member d_terrain) is the
sector type of its underlying terrain.  Sector types occuring in
d_terrain are terrain types, and must have their own type in
d_terrain.  Players can change sector types only to those with the
same terrain.

The builtin configuration defines terrain types sea, mountain,
wasteland, wilderness and plains.  It gives bridge span and tower
terrain sea, and everything else terrain wilderness.  Hence, the stock
game remains unchanged.

Deities can use terrain to create sector types that can be developed
only in limited ways.

15 years agoRemove hard-coded differences between highways and bridge heads
Markus Armbruster [Tue, 12 Feb 2008 06:10:33 +0000 (07:10 +0100)]
Remove hard-coded differences between highways and bridge heads

Let highways build and support bridges.  Allow bridge heads anywhere,
not just on the coast.

15 years agoDocument Hvy Metal refinery p.e.
Markus Armbruster [Sat, 19 Jan 2008 14:25:04 +0000 (15:25 +0100)]
Document Hvy Metal refinery p.e.

15 years agoRebase of Hvy Metal I final version
Markus Armbruster [Sat, 19 Jan 2008 14:19:13 +0000 (15:19 +0100)]
Rebase of Hvy Metal I final version

Straightforward forward port.  Drop the code to reset track on
startup.  It's not necessary, and it breaks linking of empdump.

15 years agoUpdate change log again for 4.3.14
Markus Armbruster [Mon, 5 May 2008 04:45:02 +0000 (06:45 +0200)]
Update change log again for 4.3.14

15 years agoFix fire not to disclose retreat and wipe out target shell use
Markus Armbruster [Sun, 4 May 2008 19:58:29 +0000 (21:58 +0200)]
Fix fire not to disclose retreat and wipe out target shell use

multifire() clobbered any changes to the target ship or sector made by
defend().  This let the target fire back for free.

multifire() retreated the target ship before reporting its location to
the player.  This disclosed its new location.

Fix by damaging and retreating the target after calling defend().

15 years agoChange fire to always fire guns when the target is beyond range
Markus Armbruster [Sun, 4 May 2008 17:35:14 +0000 (19:35 +0200)]
Change fire to always fire guns when the target is beyond range

multifire() drops depth charges if the target is a submarine, else it
fires guns.  It fails if the target is out of range.  But players
could still find out whether the target is a sub then, because depth
charge shell use differs from gun fire shell use.  This loophole
existed before 4.0.6, and was reopened by commit a3ad623b (v4.3.12).

Change multifire() to always use guns if the target is out of range.

While there, treat failure from shp_dchrg() and shp_fire() the same,
so that the player can't distinguish the two cases.  Failure there
should not happen.

15 years agoMake depth charges work with just one shell
Markus Armbruster [Sun, 4 May 2008 17:02:15 +0000 (19:02 +0200)]
Make depth charges work with just one shell

Commit a3ad623b (v4.3.12) made depth charging fail when there's just
one shell.  This let players find all submarine uids.  It basically
reopened the loophole closed in commit aa26c53e (v4.2.20).

Fix by making shp_dchrg() with just one shell succeed and return
damage like fire from one gun.

15 years agoFix fire command to detect when the firing object changes
Markus Armbruster [Sun, 4 May 2008 14:44:26 +0000 (16:44 +0200)]
Fix fire command to detect when the firing object changes

multifire() failed to take into account that the firing firing sector,
ship or land unit can change while it is getting the target argument.
It thus clobbered any updates made to the firing object while it was
sleeping for the target argument.  Abusable.  Broken when Chainsaw
introduced MULTIFIRE.

15 years agoFix parsing of anchor-relative time in update schedule
Markus Armbruster [Sun, 4 May 2008 07:51:08 +0000 (09:51 +0200)]
Fix parsing of anchor-relative time in update schedule

Commit 16b811d4 (v4.3.13) broke parse_time().

15 years agoUpdate change log again for 4.3.14.
Markus Armbruster [Tue, 29 Apr 2008 20:08:03 +0000 (22:08 +0200)]
Update change log again for 4.3.14.

15 years agoJournal input of special cookies "ctld" and "aborted"
Markus Armbruster [Tue, 29 Apr 2008 19:42:17 +0000 (21:42 +0200)]
Journal input of special cookies "ctld" and "aborted"

The latter is necessary to interpret the journal correctly.  The
former isn't, as it should always lead to a logout straight away, but
treating it just the same is simple and doesn't hurt.

15 years agoRewrite recvclient() for clarity
Markus Armbruster [Tue, 29 Apr 2008 19:28:28 +0000 (21:28 +0200)]
Rewrite recvclient() for clarity

Behavior differs for the following scenario: if, while the thread
sleeps in io_input() called from recvclient(), at least one line of
input arrives and the thread gets awakened by the update aborting
commands, then the old code throws away the first line of input, but
the new code doesn't.

15 years agoFix launch not to report the same ship sunk twice
Markus Armbruster [Tue, 29 Apr 2008 19:10:33 +0000 (21:10 +0200)]
Fix launch not to report the same ship sunk twice

This happened when a marine missile with a conventional warhead sunk
its target.

15 years agoOops on nuclear-tipped anti-sat missiles
Markus Armbruster [Tue, 29 Apr 2008 19:01:54 +0000 (21:01 +0200)]
Oops on nuclear-tipped anti-sat missiles

Anti-sat code is not prepared to deal with nuclear damage.  The arm
command refuses to arm anti-sats, but better check.

15 years agoFix bugs in tracking of planes flying a sortie
Markus Armbruster [Tue, 29 Apr 2008 18:53:35 +0000 (20:53 +0200)]
Fix bugs in tracking of planes flying a sortie

Commit 7ca4f412 fixed tracking of planes flying a sortie by marking
them with flag PLN_LAUNCHED.  It failed to write SAMs and planes
flying missions back to the plane file, in sam_intercept() and
mission_pln_arm().  The only known problem with that is fairly
harmless: when the mission damages planes on the ground, the planes
flying it get damaged as if they were still sitting in their bases,
but the damage gets wiped out when they land.

The same issue applies to missiles.  So they need to be tracked as
well.  Do that in msl_hit().

While there, remove a few redundant PLN_LAUNCHED sanity checks.

15 years agoWrite planes fixed on game start to disk properly
Markus Armbruster [Tue, 29 Apr 2008 18:38:10 +0000 (20:38 +0200)]
Write planes fixed on game start to disk properly

When fixing planes stuck in the air, we fixed them only in memory, so
when a fixed plane wasn't written to disk for other reasons before the
next game start, it had to be fixed again.

Change pln_zap_transient_flags() to write them out.

15 years agoDon't let hardened missiles be loaded on ships or land units
Markus Armbruster [Mon, 28 Apr 2008 20:30:19 +0000 (22:30 +0200)]
Don't let hardened missiles be loaded on ships or land units

Fix load_plane_ship() and load_plane_land() to reject hardened planes.

15 years agoDon't let missiles loaded on land units be hardened
Markus Armbruster [Mon, 28 Apr 2008 20:27:54 +0000 (22:27 +0200)]
Don't let missiles loaded on land units be hardened

hard() already rejected missiles loaded on ships, but missed land

15 years agoDocument what happens when the update aborts commands
Markus Armbruster [Mon, 28 Apr 2008 20:24:36 +0000 (22:24 +0200)]
Document what happens when the update aborts commands

15 years agoRevert "(prmptrd, uprmptrd): Should not be called while player->aborted. Check."
Markus Armbruster [Mon, 28 Apr 2008 20:22:18 +0000 (22:22 +0200)]
Revert "(prmptrd, uprmptrd): Should not be called while player->aborted.  Check."

This reverts commit fee8ac9d8f519649ad72129cae9ffb3bbd5d7ffb.

These *are* called while player->aborted.  Could be avoided, but: the
reason for not wanting to prompt then is to have each prompt consume a
line of input.  That's actually not feasible, because when we wait for
an argument (after prompting for it) when the update aborts commands,
we can't consume the argument we prompted for.

15 years agoFix lnd_fire() ammo sanity check
Markus Armbruster [Sat, 26 Apr 2008 08:15:05 +0000 (10:15 +0200)]
Fix lnd_fire() ammo sanity check

Checking l_ammo before lnd_dam() oopses when something attempts to
fire from a land unit type that can't fire (l_dam == 0) and uses no
ammo.  Such usage is perfectly fine.  Move the check to the correct

15 years agoUpdate change log for 4.3.14
Markus Armbruster [Fri, 25 Apr 2008 20:28:40 +0000 (22:28 +0200)]
Update change log for 4.3.14

15 years agoA script for post_crash_dump_hook
Markus Armbruster [Fri, 25 Apr 2008 20:13:08 +0000 (22:13 +0200)]
A script for post_crash_dump_hook

15 years agoNew post_crash_dump_hook
Markus Armbruster [Fri, 25 Apr 2008 20:12:22 +0000 (22:12 +0200)]
New post_crash_dump_hook

Run it from crash_dump().  Useful to move core files out of the way,
alert deities by e-mail, and so forth.

15 years agoDetect and log errors in crash_dump()
Markus Armbruster [Fri, 25 Apr 2008 20:09:52 +0000 (22:09 +0200)]
Detect and log errors in crash_dump()

15 years agoMove oops actions from log.c up to application
Markus Armbruster [Fri, 25 Apr 2008 18:20:07 +0000 (20:20 +0200)]
Move oops actions from log.c up to application

Change oops() to call the new oops_handler function pointer instead of
offering a fixed set of actions.  Change server's main() to install a
handler for the action requested by -E.

15 years agoGive try_supply_commod() internal linkage
Markus Armbruster [Tue, 22 Apr 2008 19:56:35 +0000 (21:56 +0200)]
Give try_supply_commod() internal linkage

15 years agoNew server option -E to choose what to do on oops
Markus Armbruster [Mon, 21 Apr 2008 19:35:46 +0000 (21:35 +0200)]
New server option -E to choose what to do on oops

Three options: abort, crash-dump, nothing.  crash-dump works by
aborting a fork.  It isn't implemented for Windows.

The oops action is no longer tied to daemon mode, but -d still implies
-E abort for convenience.

15 years agoFlush every journal entry even when not in debug mode
Markus Armbruster [Mon, 21 Apr 2008 18:42:50 +0000 (20:42 +0200)]
Flush every journal entry even when not in debug mode

Somewhat wasteful, but useful in case of a crash.

15 years agoDon't let trains load trains
Markus Armbruster [Fri, 18 Apr 2008 19:26:15 +0000 (21:26 +0200)]
Don't let trains load trains

Doesn't affect the stock game, because its only train is heavy.

15 years agoAllow deity to display power report for all types of countries
Ron Koenderink [Sat, 19 Apr 2008 03:32:46 +0000 (21:32 -0600)]
Allow deity to display power report for all types of countries

Relax country status check of power c for deities.  Can be useful to
display NPCs.

15 years agoFix designate's check for disallowed sector types
Markus Armbruster [Wed, 16 Apr 2008 05:45:07 +0000 (07:45 +0200)]
Fix designate's check for disallowed sector types

Bug lets mortals designate all sector types, including sanctuaries.
desi() complains, but then executes anyway.  Broken in commit
8227d8c8, v4.3.12.

15 years agoBump version to 4.3.14
Markus Armbruster [Wed, 16 Apr 2008 05:38:39 +0000 (07:38 +0200)]
Bump version to 4.3.14

15 years agoFinal polish for 4.3.13 v4.3.13
Markus Armbruster [Tue, 15 Apr 2008 19:04:03 +0000 (21:04 +0200)]
Final polish for 4.3.13

15 years agoFix documented syntax of edit command.
Markus Armbruster [Tue, 15 Apr 2008 18:57:28 +0000 (20:57 +0200)]
Fix documented syntax of edit command.

While there: editing nukes isn't implemented, don't advertise it.

15 years agoDocument that nukes can be traded
Markus Armbruster [Tue, 15 Apr 2008 18:34:42 +0000 (20:34 +0200)]
Document that nukes can be traded

15 years agoFix and polish comments emitted by pconfig
Markus Armbruster [Tue, 15 Apr 2008 18:29:29 +0000 (20:29 +0200)]
Fix and polish comments emitted by pconfig

15 years ago4.3.13 late changes
Markus Armbruster [Fri, 11 Apr 2008 20:12:41 +0000 (22:12 +0200)]
4.3.13 late changes

15 years agoWrap long lines in version's list of customized tables
Markus Armbruster [Thu, 10 Apr 2008 20:01:25 +0000 (22:01 +0200)]
Wrap long lines in version's list of customized tables

Factor the wrapping print out of show_opts() into prwrap().  Use it
in show_custom().

15 years agoWork around strptime() lossage
Markus Armbruster [Mon, 7 Apr 2008 18:20:13 +0000 (20:20 +0200)]
Work around strptime() lossage

Some losing implementations of strptime() such as FreeBSD's happily
succeed when they fully consumed the first argument, regardless of
whether they matched the full second argument or not.  This causes
lines without directives to be interpreted as "next Sunday".

Work around the lossage in parse_time().

15 years agoFix emp_server manual page synopsis for Windows
Ron Koenderink [Sun, 6 Apr 2008 20:58:13 +0000 (14:58 -0600)]
Fix emp_server manual page synopsis for Windows

The -R option appears in the wrong place.

15 years agoBump client version to 4.3.13
Markus Armbruster [Sun, 6 Apr 2008 20:07:02 +0000 (22:07 +0200)]
Bump client version to 4.3.13

This was forgotten in commit ef00d650 and commit 09c21f83.  The 4.2.12
client misidentified itself as 4.2.11.

15 years agoUpdate change log for 4.3.13
Markus Armbruster [Sun, 6 Apr 2008 20:00:25 +0000 (22:00 +0200)]
Update change log for 4.3.13

15 years agoBelatedly update c_form of xdump command
Markus Armbruster [Sun, 6 Apr 2008 19:52:33 +0000 (21:52 +0200)]
Belatedly update c_form of xdump command

Update for commit da8a1dae, v4.3.12.

15 years agoPut MAXNOC in xdump version
Markus Armbruster [Sun, 6 Apr 2008 13:03:37 +0000 (15:03 +0200)]
Put MAXNOC in xdump version

Create virtual selector nsc_ver_maxnoc() for it.

15 years agoDoc fix: don't claim empdump doesn't exist yet
Markus Armbruster [Sun, 6 Apr 2008 12:48:12 +0000 (14:48 +0200)]
Doc fix: don't claim empdump doesn't exist yet

15 years agoFix initialization of realms in newcap
Markus Armbruster [Sun, 6 Apr 2008 07:49:47 +0000 (09:49 +0200)]
Fix initialization of realms in newcap

Broken in commit e1a68c72, v4.3.12.

15 years agoFix add of for status arguments active, god, delete
Markus Armbruster [Sun, 6 Apr 2008 07:16:09 +0000 (09:16 +0200)]
Fix add of for status arguments active, god, delete

Broken in commit e1a68c72, v4.3.12.

15 years agoBump version to 4.3.13
Markus Armbruster [Sun, 6 Apr 2008 05:33:14 +0000 (07:33 +0200)]
Bump version to 4.3.13