Commit graph

3908 commits

Author SHA1 Message Date
a4cd4aa7f7 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.
2010-06-21 21:03:21 +02:00
bc72ff768f 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.
2010-06-21 21:03:21 +02:00
bedf3ae415 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.
2010-06-21 21:03:21 +02:00
4773519c3c 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.
2010-06-21 21:01:30 +02:00
b1a36aebf7 Tidy up whitespace in macro replacement lists 2010-06-20 18:39:31 +02:00
25d29c8f8f Convert tab after #define to space 2010-06-20 18:38:54 +02:00
243a15052f Convert spaces to tabs 2010-06-20 18:36:44 +02:00
7465574195 Break long lines more tastefully 2010-06-20 18:36:44 +02:00
373651359e Coding style fixes, mostly indentation and whitespace 2010-06-20 18:36:38 +02:00
8a0d117d45 Bump version to 4.3.27 2010-06-03 16:43:38 +02:00
c4024ee815 Update change log for 4.3.26 2010-05-24 18:38:35 +02:00
7d1c358e23 Drop ancient #ifdef DEBUG cruft
A few are left in src/lib/as/.
2010-05-24 18:23:32 +02:00
531bac70a4 Remove superfluous casts to natid 2010-05-24 18:23:32 +02:00
4b123843a7 Narrow natpass() parameter cn's type to natid 2010-05-24 18:23:32 +02:00
17a559b3a5 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.
2010-05-24 18:23:32 +02:00
4613c6d8f2 Update info version example to current output 2010-05-24 18:23:32 +02:00
f6cab16b65 Don't capitalize words in the middle of sentences
Affects output of commands add, anti, build, edit, order, reset, set,
setresource, setsector, show, version.
2010-05-24 18:23:32 +02:00
93d033cff4 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.
2010-05-13 20:12:19 +02:00
10f5000aa1 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.
2010-05-13 20:08:21 +02:00
162158fd4a 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.
2010-05-09 09:08:04 +02:00
265bd0c56b 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.
2010-05-09 09:08:04 +02:00
b97d0c625e Simplify detonate() for nukes falling on water 2010-05-09 09:08:04 +02:00
ea4662061d 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.
2010-05-09 09:08:04 +02:00
d7671e297a 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.
2010-05-09 09:08:03 +02:00
6de86720b2 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.
2010-05-09 09:08:03 +02:00
464094a693 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"
2010-05-09 09:08:01 +02:00
Tom Dickson-Hunt
f4fe7da1fb New client option -s to specify server host and port
Overrides EMPIREHOST and EMPIREPORT.
2010-05-09 09:07:01 +02:00
7506039f1b 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.
2010-04-07 23:35:25 +02:00
72b31dae13 Fix retreat, lretreat condition 'c'
Broken in commit bb5dfd80, v4.3.16.
2010-04-04 09:24:33 +02:00
5f08a3c04a Give deltax(), deltay() internal linkage
External linkage unnecessary since commit 3ca88271.
2010-04-04 09:23:48 +02:00
5e08b7fa55 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.
2010-04-04 07:31:06 +02:00
38befcb446 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.
2010-04-02 20:35:57 +02:00
e99ba304a5 Fix info Innards on workforce
Has always been wrong.
2010-04-02 19:39:37 +02:00
162435e690 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.
2010-04-02 19:08:27 +02:00
3cceb59bb1 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.
2010-04-02 18:22:52 +02:00
6c639f1481 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.
2010-03-29 17:39:07 +02:00
6e9dd173dd Document empire options -h and -v in manual page
Was forgotten in commit 46c0410e, v4.3.11.  Reported by Tom
Dickson-Hunt.
2010-03-27 13:16:18 +01:00
625022e1df Contract empire options in manual page synopsis 2010-03-27 13:04:27 +01:00
a3f2829358 Sort empdump options in manual page synopsis 2010-03-27 13:02:22 +01:00
aad6855094 Bump version to 4.3.26 2010-03-27 12:49:08 +01:00
0e2d533e39 Update change log again for 4.3.25 2010-03-21 09:28:23 +01:00
054eba7a1d 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.
2010-03-21 09:26:37 +01:00
83c4d37ade Update change log again for 4.3.25 2010-03-20 18:54:10 +01:00
ce51816d00 Comment fix 2010-03-20 18:46:02 +01:00
1d4fea32b8 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.
2010-03-20 18:44:45 +01:00
28cc236e12 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.
2010-03-20 14:57:05 +01:00
45106ab91f 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.
2010-03-20 14:24:25 +01:00
fea24d10da Update change log for 4.3.25 2010-03-16 21:42:10 +01:00
876f3424b0 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.
2010-03-16 21:28:08 +01:00
3a9d27186c Don't print Blam-blam when missile explodes on launch 2010-03-16 21:28:07 +01:00