]> git.pond.sub.org Git - empserver/log
empserver
13 years agoClean up misuse of mpr() in pln_damage()
Markus Armbruster [Sun, 6 Jun 2010 21:05:58 +0000 (23:05 +0200)]
Clean up misuse of mpr() in pln_damage()

Don't use multiple calls of mpr() to print a single line, because that
creates a separate bulletin for each part.  The read command normally
merges the bulletins, but if the bulletins are more than five seconds
apart (clock jumped somehow), we get a bulletin header in the middle
of a line.

While there, wrap long "blam" lines.  Can only happen for bomb loads
above 16.  Stock game needs a tech 406 jhb for that.

The mpr() misuse was introduced in Empire 2.

13 years agoClean up misuse of mpr() in shp_missile_defense()
Markus Armbruster [Sun, 6 Jun 2010 20:40:44 +0000 (22:40 +0200)]
Clean up misuse of mpr() in shp_missile_defense()

Don't use multiple calls of mpr() to print a single line, because that
creates a separate bulletin for each part.  The read command normally
merges the bulletins, but if the bulletins are more than five seconds
apart (clock jumped somehow), we get a bulletin header in the middle
of a line.

The mpr() misuse was introduced in Empire 2.

13 years agoClean up misuse of mpr() in msl_launch()
Markus Armbruster [Sun, 6 Jun 2010 20:39:52 +0000 (22:39 +0200)]
Clean up misuse of mpr() in msl_launch()

Don't use multiple calls of mpr() to print a single line, because that
creates a separate bulletin for each part.  The read command normally
merges the bulletins, but if the bulletins are more than five seconds
apart (clock jumped somehow), we get a bulletin header in the middle
of a line.

The mpr() misuse was introduced in Empire 2.

13 years agoMessage for land unit hitting mines lacked a newline
Markus Armbruster [Sun, 6 Jun 2010 20:34:05 +0000 (22:34 +0200)]
Message for land unit hitting mines lacked a newline

Broken in Empire 2.

13 years agoDon't beep when plane, land unit or nuke die on collapsing bridge
Markus Armbruster [Sun, 6 Jun 2010 20:26:02 +0000 (22:26 +0200)]
Don't beep when plane, land unit or nuke die on collapsing bridge

Not nice, because it could beep many times, and could put beeps in
bulletins.  Moreover, it misused mpr() and thus put the beep in its
own bulletin.  The read command normally merges this bulletin with the
adjacent ones, but if the bulletins are more than five seconds apart
(clock jumped somehow), we can get an empty bulletin just for the
beep.

Beeping was added in v4.0.18.

13 years agoImprove bulletin for nuke destroyed by nuclear attack
Markus Armbruster [Sun, 6 Jun 2010 20:18:31 +0000 (22:18 +0200)]
Improve bulletin for nuke destroyed by nuclear attack

Explain what destroyed the nuke, just like for damage to ships, planes
and land units.

13 years agoAll-nuclear bombing run reported "bombing raid did 0 damage"
Markus Armbruster [Sun, 6 Jun 2010 15:42:03 +0000 (17:42 +0200)]
All-nuclear bombing run reported "bombing raid did 0 damage"

Broken in commit 162435e6, v4.3.26.

13 years agoClean up code to report nuclear damage to sectors
Markus Armbruster [Sun, 6 Jun 2010 15:35:36 +0000 (17:35 +0200)]
Clean up code to report nuclear damage to sectors

It was too clever by half.

13 years agoFix empty lines in bulletin reporting nuclear damage to sectors
Markus Armbruster [Sun, 6 Jun 2010 15:23:25 +0000 (17:23 +0200)]
Fix empty lines in bulletin reporting nuclear damage to sectors

Broken in Chainsaw 3.

13 years agoFix misdirected nuclear detonation output
Markus Armbruster [Sun, 6 Jun 2010 13:03:35 +0000 (15:03 +0200)]
Fix misdirected nuclear detonation output

Output went to the owner of the nuke instead of the player.
Fortunately, they're the same in normal usage.  They can differ only
when a deity drops a foreign nuke from a foreign plane.

The fix also cleans up a misuse of mpr() in kaboom(): it used multiple
calls to print a single line, which creates a separate bulletin for
each part.  The read command normally merges the bulletins, but if the
bulletins are more than five seconds apart (clock jumped somehow), we
get a bulletin header in the middle of a line.  Fortunately, that
could happen only when a deity drops a foreign nuke.  Before commit
a269cdd7 (v4.3.23), it could also happen for missions.

Broken in Empire 2.

13 years agoDrop get_land() parameter victim_land
Markus Armbruster [Mon, 24 May 2010 16:07:03 +0000 (18:07 +0200)]
Drop get_land() parameter victim_land

Use combat_mode instead.

13 years agoDrop prxy()'s parameter country
Markus Armbruster [Mon, 24 May 2010 07:05:51 +0000 (09:05 +0200)]
Drop prxy()'s parameter country

Argument is always player->cnum.  Hardly surprising, because that's
to whom it prints.

13 years agoClean up suspicious coordinate system use in unit_list()
Markus Armbruster [Mon, 24 May 2010 06:59:01 +0000 (08:59 +0200)]
Clean up suspicious coordinate system use in unit_list()

It showed unit coordinates in unit's coordinate system instead of the
player's.  Fortunately, they're the same, since even deities can't
navigate foreign ships or march foreign land units.

13 years agoFix misdirected prints when missile explodes on launch
Markus Armbruster [Sun, 16 May 2010 17:34:46 +0000 (19:34 +0200)]
Fix misdirected prints when missile explodes on launch

msl_launch() printed some lines to the player instead of the missile
owner when the missile exploded on launch.  They are different when
the launch is for a mission or an interception.  This disclosed the
the owner's origin.  Broken in Empire 2.

13 years agoClean up suspicious coordinate system use in lnd_mar()
Markus Armbruster [Sun, 16 May 2010 16:43:28 +0000 (18:43 +0200)]
Clean up suspicious coordinate system use in lnd_mar()

When refusing to march foreign land units, it reported the land unit's
location in the land unit's coordinate system instead of the player's.
Fortunately, they're the same, since even deities can't march foreign
land unit.

13 years agoFix autonav to use correct coordinate system
Markus Armbruster [Sun, 16 May 2010 11:52:14 +0000 (13:52 +0200)]
Fix autonav to use correct coordinate system

When autonav reported to a ship owner that it can't load or unload
foreign civilians, it used the sector owner's coordinate system.  This
disclosed the sector owner's origin.  Abusable.

13 years agoFix nuclear detontation to use correct coordinate system
Markus Armbruster [Sun, 16 May 2010 11:38:52 +0000 (13:38 +0200)]
Fix nuclear detontation to use correct coordinate system

When the nuke bounced off a sanctuary, the bulletin to the sanctuary
owner used the attacker's coordinate system.  This disclosed the
attacker's origin.

13 years agoFix sabotage command to use correct coordinate system
Markus Armbruster [Sun, 16 May 2010 09:12:29 +0000 (11:12 +0200)]
Fix sabotage command to use correct coordinate system

It reported the spy's location in the spy's coordinate system
instead of the player's.  Fortunately, they're the same in normal
usage.  They can differ only when a deity uses a foreign spy.

13 years agoFix sail command to use correct coordinate system
Markus Armbruster [Sun, 16 May 2010 09:10:45 +0000 (11:10 +0200)]
Fix sail command to use correct coordinate system

It reported the ship's location in the ship's coordinate system
instead of the player's.  Fortunately, they're the same in normal
usage.  They can differ only when a deity uses a foreign ship.

13 years agoFix lmine to use correct coordinate system
Markus Armbruster [Sun, 16 May 2010 09:07:04 +0000 (11:07 +0200)]
Fix lmine to use correct coordinate system

It reported the engineer's location in the engineer's coordinate
system instead of the player's.  Fortunately, they're the same in
normal usage.  They can differ only when a deity uses a foreign
engineer.

The buggy code is also reachable from and march sub-command 'd', but
can't bite there, because even deities can't march foreign land units.

13 years agoFix nation command to use correct coordinate system
Markus Armbruster [Sun, 16 May 2010 08:40:00 +0000 (10:40 +0200)]
Fix nation command to use correct coordinate system

It reported capital location in the nation's coordinate system instead
of the player's.  Fortunately, they're the same in normal usage.  They
can differ only when a deity requests a nation report for another
country.

13 years agoFix sweep command to use correct coordinate system
Markus Armbruster [Sun, 16 May 2010 18:18:14 +0000 (20:18 +0200)]
Fix sweep command to use correct coordinate system

When reporting sweeps, it reported the location in the plane owner's
coordinate system instead of the player's.  Fortunately, they're the
same in normal usage.  They can differ only when a deity flies foreign
planes.

13 years agoTidy up whitespace in macro replacement lists
Markus Armbruster [Sun, 23 May 2010 15:49:33 +0000 (17:49 +0200)]
Tidy up whitespace in macro replacement lists

13 years agoConvert tab after #define to space
Markus Armbruster [Sat, 22 May 2010 13:57:07 +0000 (15:57 +0200)]
Convert tab after #define to space

13 years agoConvert spaces to tabs
Markus Armbruster [Sat, 22 May 2010 13:40:35 +0000 (15:40 +0200)]
Convert spaces to tabs

13 years agoBreak long lines more tastefully
Markus Armbruster [Tue, 18 May 2010 20:19:34 +0000 (22:19 +0200)]
Break long lines more tastefully

13 years agoCoding style fixes, mostly indentation and whitespace
Markus Armbruster [Tue, 18 May 2010 20:09:01 +0000 (22:09 +0200)]
Coding style fixes, mostly indentation and whitespace

13 years agoBump version to 4.3.27
Markus Armbruster [Thu, 3 Jun 2010 14:43:38 +0000 (16:43 +0200)]
Bump version to 4.3.27

13 years agoUpdate change log for 4.3.26 v4.3.26
Markus Armbruster [Mon, 24 May 2010 16:38:35 +0000 (18:38 +0200)]
Update change log for 4.3.26

13 years agoDrop ancient #ifdef DEBUG cruft
Markus Armbruster [Sun, 23 May 2010 16:30:10 +0000 (18:30 +0200)]
Drop ancient #ifdef DEBUG cruft

A few are left in src/lib/as/.

13 years agoRemove superfluous casts to natid
Markus Armbruster [Sun, 23 May 2010 16:14:57 +0000 (18:14 +0200)]
Remove superfluous casts to natid

13 years agoNarrow natpass() parameter cn's type to natid
Markus Armbruster [Sun, 23 May 2010 16:14:03 +0000 (18:14 +0200)]
Narrow natpass() parameter cn's type to natid

13 years agoUse assert() for a condition that should never happen in fairland
Markus Armbruster [Sun, 23 May 2010 16:04:23 +0000 (18:04 +0200)]
Use assert() for a condition that should never happen in fairland

If it does happen, assertion failure isn't very nice, but it beats
asking the user to report the bug to an inappropriate e-mail address
that most probably ceased to work years ago.

13 years agoUpdate info version example to current output
Markus Armbruster [Sat, 22 May 2010 13:05:42 +0000 (15:05 +0200)]
Update info version example to current output

13 years agoDon't capitalize words in the middle of sentences
Markus Armbruster [Sat, 22 May 2010 12:59:23 +0000 (14:59 +0200)]
Don't capitalize words in the middle of sentences

Affects output of commands add, anti, build, edit, order, reset, set,
setresource, setsector, show, version.

13 years agoDon't let embarked land units fight a che revolt
Markus Armbruster [Thu, 13 May 2010 18:12:19 +0000 (20:12 +0200)]
Don't let embarked land units fight a che revolt

When take_casualties() kills a land unit, it neglects to take it off
its carrier.  This triggers an oops in unit_cargo_init().  Instead of
fixing this, just don't let them fight.  They can't defend against
other attacks, either.

13 years agoFix che revolt to damage only land units that actually fight
Markus Armbruster [Thu, 13 May 2010 17:48:20 +0000 (19:48 +0200)]
Fix che revolt to damage only land units that actually fight

guerrilla() lets only the sector owner's land units fight.  But
take_casualties() spread the casualties among all land units in the
sector.  Thus, defending land units could survive a defeat if foreign
land units were present.  The sector takeover then had che capture
them, or their crews blow them up.  The foreign land units were
damaged silently.

13 years agoFix loading x-light missiles on ships without capability plane
Markus Armbruster [Sun, 2 May 2010 16:27:33 +0000 (18:27 +0200)]
Fix loading x-light missiles on ships without capability plane

These ships could only use their x-light slots for x-light planes, not
their plane slots.  For instance, agc (30 x-light slots, 32 plane
slots) could load only 30 sams, and mb (0 x-light slots, 10 plane
slots) could not load any sams.

Culprit is could_be_on_ship().  Broken in commit 3e370da5, v4.3.17.

13 years agoUpdate bmap when nuclear detonation makes wasteland
Markus Armbruster [Sun, 2 May 2010 17:19:08 +0000 (19:19 +0200)]
Update bmap when nuclear detonation makes wasteland

detonate() tells the player the new sector designation (wasteland or
sea) when damage exceeds 100.  But it neglected to update the bmap.
Fix that.

13 years agoSimplify detonate() for nukes falling on water
Markus Armbruster [Sun, 2 May 2010 17:15:38 +0000 (19:15 +0200)]
Simplify detonate() for nukes falling on water

13 years agoFix info Damage on bars, people and planes
Markus Armbruster [Mon, 26 Apr 2010 18:34:03 +0000 (20:34 +0200)]
Fix info Damage on bars, people and planes

It assumed option SUPER_BARS enabled.  It's disabled by default since
4.0.9.

It assumed people_damage = 0.4.  It's 1.0 since 4.0.0.

It still claimed damaging a sector doesn't damage its planes.  It does
since 4.0.9.

13 years agoFix harmless seqno mismatch in launch
Markus Armbruster [Sun, 18 Apr 2010 17:05:52 +0000 (19:05 +0200)]
Fix harmless seqno mismatch in launch

When an inefficient missile exploded on launch, it could damage
itself.  The damage had no effect, because the missile gets used up
right after.  But it triggers a seqno mismatch oops, in laun().  Fix
by making msl_launch() set PLN_LAUNCHED before the explosion.

This case was missed in commit 7bc63871, v4.3.14.  It didn't oops
until sequence numbers were added in v4.3.15.

13 years agoFix fly and drop to report discarded cargo items correctly
Markus Armbruster [Sun, 18 Apr 2010 16:36:55 +0000 (18:36 +0200)]
Fix fly and drop to report discarded cargo items correctly

When d of n cargo items are discarded for want of space, pln_dropoff()
reported -d items discarded and -d items unloaded.  Already broken in
BSD Empire 1.1.

13 years agoChange how client option -s interprets ':'
Markus Armbruster [Fri, 2 Apr 2010 09:51:15 +0000 (11:51 +0200)]
Change how client option -s interprets ':'

Old version recognizes the first ':', which prevents use of ':' in
host names.  They are used in numerical IPv6 addresses.  New version
recognizes the last ':', which prevents use of ':' in service names.

Old version treats empty host or port specially (use default).
Documentation suggests ':' is required, but the code doesn't do that.
Instead, the argument is interpreted as host, even when it's empty.

New version makes the HOST: part optional.  You can't specify host and
default the port.  Tough.  Keeps documentation and code as simple as
possible.

Compare:

                old version             new version
    argument    host    port            host    port
    ""          ""      default         default ""
    "A"         "A"     default         default "A"
    ":"         default default         ""      ""
    "A:"        "A"     default         "A"     ""
    ":B"        default "B"             ""      "B"
    "A:B"       "A"     "B"             "A"     "B"

13 years agoNew client option -s to specify server host and port
Tom Dickson-Hunt [Fri, 2 Apr 2010 08:47:41 +0000 (10:47 +0200)]
New client option -s to specify server host and port

Overrides EMPIREHOST and EMPIREPORT.

14 years agoFix test for capability engineer in lnd_hit_mine()
Markus Armbruster [Wed, 7 Apr 2010 21:35:25 +0000 (23:35 +0200)]
Fix test for capability engineer in lnd_hit_mine()

Bogus array index, unpredictable result, can crash the server.  Broken
in commit ef7ea893, v4.3.24.

14 years agoFix retreat, lretreat condition 'c'
Markus Armbruster [Sun, 4 Apr 2010 07:24:33 +0000 (09:24 +0200)]
Fix retreat, lretreat condition 'c'

Broken in commit bb5dfd80, v4.3.16.

14 years agoGive deltax(), deltay() internal linkage
Markus Armbruster [Sun, 4 Apr 2010 07:23:48 +0000 (09:23 +0200)]
Give deltax(), deltay() internal linkage

External linkage unnecessary since commit 3ca88271.

14 years agocoastwatch and skywatch could see too far
Markus Armbruster [Sat, 3 Apr 2010 16:34:52 +0000 (18:34 +0200)]
coastwatch and skywatch could see too far

Both coas() and skyw() want to iterate over a circular area with
radius vrange.  They did that by iterating over a rectangle that
encloses the circle, skipping coordinates out of range.  To "save
time", they used a rather odd predicate for "out of range", namely
"vrange * vrange < (j * j + 3 * k * k) / 4)".

The predicate is wrong.  coastwatch and skywatch could see one sector
too far in certain directions for practical radar ranges, and up to
two sectors for not so practical tech 1900+ radar stations.

For instance, with j = 13 and k = 3, vrange = 7, the predicate
evaluates to false (49 < 48), i.e. in range.  However, the true
distance is 8, i.e. out of range.  Likewise, j = 22, k = 8, vrange =
13: 169 < 169, true distance 15.

Fix by iterating over the circle directly, without comparing
distances.

14 years agoMake skywatch report satellite uid
Markus Armbruster [Fri, 2 Apr 2010 18:02:39 +0000 (20:02 +0200)]
Make skywatch report satellite uid

The uid is required for launching a-sats since commit 1ee02875,
v4.3.23.

Change output to resemble coastwatch's.

14 years agoFix info Innards on workforce
Markus Armbruster [Fri, 2 Apr 2010 17:39:04 +0000 (19:39 +0200)]
Fix info Innards on workforce

Has always been wrong.

14 years agoClean up checks for zero value of pln_damage()
Markus Armbruster [Fri, 2 Apr 2010 17:08:27 +0000 (19:08 +0200)]
Clean up checks for zero value of pln_damage()

Before commit a269cdd7, pln_damage() returned zero when the damage was
nuclear, and callers used that to bypass conventional damage code.
Zero value can't happen anymore.

14 years agoFix client's command abort feature
Markus Armbruster [Fri, 2 Apr 2010 16:22:52 +0000 (18:22 +0200)]
Fix client's command abort feature

The server aborts the current command when it receives a special line
of input for a prompt.  To make the client send it, you type the INTR
character (normally ^C).  This sends the client the SIGINT signal.
Unfortunately, it never quite worked.

Because we use a special line of input to signal interrupt, the client
can do that only after a complete line of input.

What if SIGINT arrives in the middle of a line?  We split the line in
two then and there, by inserting a newline.  Nasty, but it's simple,
and happens rarely.

However, we inserted the newline always, even after a complete line.
In that case, we inserted an empty line of input before the interrupt.
If you hit INTR at a server prompt, the server received an empty line
of input for that prompt, and the interrupt only for the *next*
prompt.  Which may well be too late to abort the command you wanted to
abort.

Fix by inserting the newline only when needed.

14 years agoFix sabo not to kill the spy every time
Markus Armbruster [Mon, 29 Mar 2010 15:39:07 +0000 (17:39 +0200)]
Fix sabo not to kill the spy every time

The hack to protect the spy from sabotage damage killed it outright.
Broken in 861a6662, v4.3.17.

14 years agoDocument empire options -h and -v in manual page
Markus Armbruster [Sat, 27 Mar 2010 12:07:27 +0000 (13:07 +0100)]
Document empire options -h and -v in manual page

Was forgotten in commit 46c0410e, v4.3.11.  Reported by Tom
Dickson-Hunt.

14 years agoContract empire options in manual page synopsis
Markus Armbruster [Sat, 27 Mar 2010 12:04:27 +0000 (13:04 +0100)]
Contract empire options in manual page synopsis

14 years agoSort empdump options in manual page synopsis
Markus Armbruster [Sat, 27 Mar 2010 12:02:22 +0000 (13:02 +0100)]
Sort empdump options in manual page synopsis

14 years agoBump version to 4.3.26
Markus Armbruster [Sat, 27 Mar 2010 11:49:08 +0000 (12:49 +0100)]
Bump version to 4.3.26

14 years agoUpdate change log again for 4.3.25 v4.3.25
Markus Armbruster [Sun, 21 Mar 2010 08:28:23 +0000 (09:28 +0100)]
Update change log again for 4.3.25

14 years agoFix test for capability sweep in shp_hit_mine()
Markus Armbruster [Sun, 21 Mar 2010 08:26:37 +0000 (09:26 +0100)]
Fix test for capability sweep in shp_hit_mine()

Bogus array index, unpredictable result, can crash the server.  Broken
in commit ef7ea893, v4.3.24.

14 years agoUpdate change log again for 4.3.25
Markus Armbruster [Sat, 20 Mar 2010 17:54:10 +0000 (18:54 +0100)]
Update change log again for 4.3.25

14 years agoComment fix
Markus Armbruster [Sat, 20 Mar 2010 17:46:02 +0000 (18:46 +0100)]
Comment fix

14 years agoFix interdiction not to wipe out target ship updates
Markus Armbruster [Sat, 20 Mar 2010 16:55:56 +0000 (17:55 +0100)]
Fix interdiction not to wipe out target ship updates

Ships can expend shells to defend against missiles, in
shp_missile_defense().  Any shell use by the target ship got wiped out
when shp_missile_interdiction() wrote back the target ship, triggering
a seqno mismatch oops.

Ships get updated when they launch planes to intercept interdicting
planes, in mission_pln_equip().  Any petrol use by the target ship got
wiped out when shp_mission_interdiction() wrote back the target ship,
triggering a seqno mismatch oops.

Fix by re-reading the target ship in shp_damage_one().  This also
affects shp_fort_interdiction(), where it is not necessary.  A bit
inefficient, but let's keep this fix simple.

14 years agoFix navigate and march not to lay mines free of charge
Markus Armbruster [Sat, 13 Mar 2010 21:47:13 +0000 (22:47 +0100)]
Fix navigate and march not to lay mines free of charge

do_unit_move() reads the ships into a list.  It re-reads them when it
prompts for sub-commands.  shp_nav_one_sector() writes them back when
it moves ships.

Mine-laying (sub-command 'd') updates the minelayer, invalidating the
copy in the list.  Any movement sub-command before the next prompt for
sub-commands wiped out this update, triggering a seno mismatch oops.

Happens only if 'd' is used without arguments, because remaining
sub-commands are discarded when there are arguments.

Broken when mine-laying was added in commits 2438fe7c, v4.3.7.

Same for march, commit 274c8e42, v4.3.7.

Fix by stopping after 'd' regardless of arguments.

14 years agoFix navigate and march not to prompt for number of mines to lay
Markus Armbruster [Sat, 20 Mar 2010 10:24:49 +0000 (11:24 +0100)]
Fix navigate and march not to prompt for number of mines to lay

When sub-command 'd' was used without arguments, do_unit_move() failed
to supply the second argument to mine(), which duly prompted for it.
This contracticted info, and could trigger a generation oops.

do_unit_move() reads the ships into a list.  It re-reads them when it
prompts for sub-commands.  shp_nav_one_sector() writes them back when
it moves ships.

The mine prompt made the list stale.  Movement sub-commands before the
next prompt for sub-commands wrote back stale ships, triggering a
generation oops.  Example: "nav 15 dg".

Broken when mine-laying was added in commits 2438fe7c, v4.3.7.

Same for march, commit 274c8e42, v4.3.7.

14 years agoUpdate change log for 4.3.25
Markus Armbruster [Tue, 16 Mar 2010 20:42:10 +0000 (21:42 +0100)]
Update change log for 4.3.25

14 years agoNuclear-tipped missile exploding on launch could not damage base
Markus Armbruster [Sat, 13 Mar 2010 12:49:36 +0000 (13:49 +0100)]
Nuclear-tipped missile exploding on launch could not damage base

Commit a269cdd7 (v4.3.23) removed the nuclear damage.  But it left the
nuke on the missile, which made pln_damage() oops and return zero
damage.

Fix by destroying the nuke separately.

14 years agoDon't print Blam-blam when missile explodes on launch
Markus Armbruster [Sat, 13 Mar 2010 12:42:49 +0000 (13:42 +0100)]
Don't print Blam-blam when missile explodes on launch

14 years agoFix news for torpedo attack's return torpedo
Markus Armbruster [Fri, 12 Mar 2010 19:39:39 +0000 (20:39 +0100)]
Fix news for torpedo attack's return torpedo

When a torpedo attack triggered a return torpedo, the news reported it
to be fired by the attacker instead of the defender.

14 years agoInterdiction attacked submarines with surface-only weapons
Markus Armbruster [Wed, 10 Mar 2010 07:54:06 +0000 (08:54 +0100)]
Interdiction attacked submarines with surface-only weapons

shp_mission_interdiction() used MI_INTERDICT instead of MI_SINTERDICT.
Broken in commit cd8fe31e, v4.3.24.

14 years agoFix unsafe use of shared buffers in commands drawing maps
Markus Armbruster [Thu, 25 Feb 2010 06:07:28 +0000 (07:07 +0100)]
Fix unsafe use of shared buffers in commands drawing maps

Maps are generally drawn into static scratch buffers.  Each command
has its own buffers.

Static scratch buffers are safe as long as they're never used across
yields.  Player output can yield unless the command has flag C_MOD
set.  Commands lradar, path, radar, route, satellite, sect, survey
hadn't.  If such a command yields while using scratch buffers, another
instance of the command can clobber them.

Abuse seems tricky, but possible: if a malicious player stalls output
just right, a command yields while printing a map from the scratch
buffer.  It resumes only when the malicious player reads some output.
If another player runs the same command before that, it overwrites the
same static scratch buffer with its map.  The malicious player
receives the last such run's map.

4.2.8 fixed the same bug for bmap, lbmap, lmap, map, nmap, pbmap,
pmap, sbmap and smap.

All were broken in 4.2.0.  Except radar maps (lradar and radar) were
already broken in Empire 2 for AIX.

14 years agoGeneration numbers didn't catch all potential yields on output
Markus Armbruster [Sun, 21 Feb 2010 17:44:16 +0000 (18:44 +0100)]
Generation numbers didn't catch all potential yields on output

io_output_if_queue_long() called ef_make_stale() only for long queues.
Missed in commit 2fa5f652, v4.3.24.

14 years agofiles could clobber the game when reading confirmation fails
Markus Armbruster [Sun, 14 Feb 2010 18:29:13 +0000 (19:29 +0100)]
files could clobber the game when reading confirmation fails

fgets() fails on read error or EOF.  When it fails, it doesn't touch
the buffer.  Since files didn't check its return value, it read an
uninitialized character from the buffer.  If that happened to be 'y'
or 'Y', it happily clobbered the game.

14 years agoUpdate link to `Recursive Make Considered Harmful'
Markus Armbruster [Sat, 13 Feb 2010 20:04:01 +0000 (21:04 +0100)]
Update link to `Recursive Make Considered Harmful'

14 years agoLess verbose make output
Markus Armbruster [Sat, 13 Feb 2010 17:48:31 +0000 (18:48 +0100)]
Less verbose make output

Many commands, compiler invocations in particular, are rather long,
and warnings tend to get lost in the noise.  Suppress the command
details.  Run make with a V=1 parameter for full output.

14 years agoChange fairland not to reject small worlds without trying
Markus Armbruster [Sat, 6 Feb 2010 20:36:21 +0000 (21:36 +0100)]
Change fairland not to reject small worlds without trying

Instead, print a warning and try.  It may well work, and when it
doesn't, it fails cleanly.

14 years agoClean up commented out code left behind by commit eea24fb0
Markus Armbruster [Sat, 6 Feb 2010 20:28:39 +0000 (21:28 +0100)]
Clean up commented out code left behind by commit eea24fb0

14 years agoBump version to 4.3.25
Markus Armbruster [Sat, 6 Feb 2010 20:27:17 +0000 (21:27 +0100)]
Bump version to 4.3.25

14 years agoUpdate change log again for 4.3.24 v4.3.24
Markus Armbruster [Tue, 26 Jan 2010 21:30:24 +0000 (22:30 +0100)]
Update change log again for 4.3.24

14 years agoFix generation numbers for order command
Markus Armbruster [Tue, 26 Jan 2010 21:20:16 +0000 (22:20 +0100)]
Fix generation numbers for order command

orde() uses a "clever" trick to get away with just one
check_ship_ok(): it makes a copy of the ship in the beginning, and
checks it at the end.  Generation numbers (commit 2fa5f652) break this
trick.  It could be fixed by manually marking the ship fresh.
Instead, check the ship the stupid, straightforward way, without a
copy.

14 years agoNormalize order's reaction to bad input
Markus Armbruster [Tue, 26 Jan 2010 21:02:34 +0000 (22:02 +0100)]
Normalize order's reaction to bad input

Consistently fail the command on bad or missing argument.  Before, it
merely skipped to the next ship in some cases.

14 years agoGet third argument of "order l" the ordinary way
Markus Armbruster [Tue, 26 Jan 2010 20:48:26 +0000 (21:48 +0100)]
Get third argument of "order l" the ordinary way

Now prompts when the argument is empty.  Before, that was interpreted
as zero.  Not likely to affect players.

14 years agoClean up dead code in orde()
Markus Armbruster [Tue, 26 Jan 2010 20:23:10 +0000 (21:23 +0100)]
Clean up dead code in orde()

Does not change optimized code (gcc -O) apart from __LINE__.

14 years agoFix windows client not always exiting
Ron Koenderink [Mon, 25 Jan 2010 02:45:51 +0000 (20:45 -0600)]
Fix windows client not always exiting

The call to WSAEnumNetworkEvents() was reseting network
events in particular WSAECONNRESET was sometimes being lost
causing the client to not exit.  The WSAEnumNetworkEvents()
was called from fd_is_socket() and has been replace with
getsockopt() to determine if the fd is socket or not.

Broken in commit 4d40a275, v4.3.23

14 years agoUpdate change log for 4.3.24
Markus Armbruster [Mon, 18 Jan 2010 18:35:37 +0000 (19:35 +0100)]
Update change log for 4.3.24

14 years agoClean up dead stores
Markus Armbruster [Sat, 16 Jan 2010 16:40:28 +0000 (17:40 +0100)]
Clean up dead stores

Does not change optimized code (gcc -O).

Spotted by the Clang Static Analyzer.

14 years agoFix navigate/march crash on funny path arguments
Markus Armbruster [Sat, 16 Jan 2010 16:15:22 +0000 (17:15 +0100)]
Fix navigate/march crash on funny path arguments

For an argument consisting of a valid path plus whitespace,
do_unit_move() eventually passed the whitespace suffix to parse(),
then dereferenced player->argp[0].  But that was null.

Broken in commit 0c12d837, v4.3.7.  Trivial for players to trigger.

14 years agoFix player_login() not to print null pointer
Markus Armbruster [Sat, 16 Jan 2010 15:29:41 +0000 (16:29 +0100)]
Fix player_login() not to print null pointer

When the input line contains only whitespace, player->argp[0] is null
after parse().  This condition was not checked, comtch() returned
M_IGNORE, and code handling that printed the null pointer.  Some
systems (GNU, Windows) deal gracefully with printing null strings,
others crash.  Trivial to trigger remotely.

Before the fix, the value of parse() was assigned, but never used, and
that was spotted by the Clang Static Analyzer.

14 years agoClean up useless getnatp() in conv(), nav_map(), tele()
Markus Armbruster [Sat, 16 Jan 2010 09:14:43 +0000 (10:14 +0100)]
Clean up useless getnatp() in conv(), nav_map(), tele()

Spotted by the Clang Static Analyzer.

14 years agoMove -h to the end of the emp_server -h output
Markus Armbruster [Sat, 16 Jan 2010 08:31:08 +0000 (09:31 +0100)]
Move -h to the end of the emp_server -h output

This is consistent with the other programs.

14 years agoMake empire, empsched and files catch extra operands
Markus Armbruster [Sat, 16 Jan 2010 08:29:53 +0000 (09:29 +0100)]
Make empire, empsched and files catch extra operands

This also avoids a dead increment ap++ in src/client/main.c reported
by the Clang Static Analyzer.

14 years agoMake empire and files not print usage on bad option
Markus Armbruster [Sat, 16 Jan 2010 08:22:48 +0000 (09:22 +0100)]
Make empire and files not print usage on bad option

Point to -h instead.  This is consistent with the other programs.

14 years agoFix lwpReschedule()'s assertion "have runnable thread"
Markus Armbruster [Fri, 15 Jan 2010 21:06:51 +0000 (22:06 +0100)]
Fix lwpReschedule()'s assertion "have runnable thread"

If there is no runnable thread, we're deadlocked.  lwpReschedule() has
an assertion to catch this.  But it didn't work, and the code
following it would crash then.  Can't actually happen, because the
EventHandler thread is always runnable.  Spotted by the Clang Static
Analyzer.

14 years agoDeclare cant_listen() noreturn
Markus Armbruster [Fri, 15 Jan 2010 19:20:36 +0000 (20:20 +0100)]
Declare cant_listen() noreturn

Local analysis can now easily find out what's up.  Before, inter-
procedural analysis was required.  The Clang Static Analyzer
complained about a dereference of res that is actually fine.

14 years agoMake CANT_HAPPEN() more obvious for static analysis
Markus Armbruster [Fri, 15 Jan 2010 19:02:11 +0000 (20:02 +0100)]
Make CANT_HAPPEN() more obvious for static analysis

Local analysis can now easily find out what's up.  Before,
whole-program analysis was required.  The Clang Static Analyzer
complained about code that is actually fine.

14 years agoFix getpath() not to crash when path exceeds MAX_PATH_LEN
Markus Armbruster [Thu, 14 Jan 2010 21:39:42 +0000 (22:39 +0100)]
Fix getpath() not to crash when path exceeds MAX_PATH_LEN

Trivial for players to trigger.  Broken in commit 0b0612ea, v4.3.16.
Spotted by the Clang Static Analyzer.

14 years agoFix oops on escort, recon, and launch of satellite
Markus Armbruster [Wed, 13 Jan 2010 20:21:58 +0000 (21:21 +0100)]
Fix oops on escort, recon, and launch of satellite

Broken in commit 528df9ac, v4.3.23.  pln_equip() recovered fine.

14 years agoUpdate copyright notice
Markus Armbruster [Sun, 10 Jan 2010 07:53:25 +0000 (08:53 +0100)]
Update copyright notice

14 years agoFix trailing whitespace
Markus Armbruster [Sun, 10 Jan 2010 07:47:40 +0000 (08:47 +0100)]
Fix trailing whitespace

14 years agoStop ship and land unit movement on interdiction with no damage
Markus Armbruster [Sat, 9 Jan 2010 15:21:40 +0000 (16:21 +0100)]
Stop ship and land unit movement on interdiction with no damage

Movement stops when shp_interdict() or lnd_interdict() report
interdiction.  However, they reported it only when there was
interdiction damage.

Zero interdiction damage commonly happens when interdicting missiles
miss, or all bombers abort.  Stopping regardless of damage makes more
sense there.

Moreover, not stopping is buggy: do_unit_move() needs to take care not
to wipe out updates made by interdiction to the moving ships or land
units.  It does so only when it stops.  Updates made by interdiction
without interdiction damage could get wiped out, triggering a seqno
mismatch oops.

Known ways moving ships and land units can get updated by interdiction
despite there is no interdiction damage:

* Interdicting bombers get intercepted by planes based on a navigating
  carrier, carrier gets charged petrol.  The bug wipes out the petrol
  use.

* Marching land units get interdicted by planes, but all planes miss.
  Sufficiently large collateral damage to the sector can still damage
  the land units.  The bug wipes out the damage to land units.

To make shp_interdict() and lnd_interdict() report interdiction
regardless of damage, change lnd_missile_interdiction(),
lnd_fort_interdiction(), lnd_mission_interdiction(),
shp_missile_interdiction(), shp_fort_interdiction(),
shp_mission_interdiction() to return whether there was interdiction.
Before, they returned whether there was damage.

Change unit_interdict(), perform_mission(), perform_mission_land(),
perform_mission_ship(), perform_mission_msl(), and
perform_mission_bomb() to return -1 for no interdiction, so that
callers can distinguish no interdiction from interdiction with no
damage.