Commit graph

3782 commits

Author SHA1 Message Date
2cfb124b6c Restrict ac_encounter() mission_flags to current player
The only user is reco(), so the restriction is fine.  Several
functions called on behalf of mission_flags assumed it already:
plane_sweep(), sathead(), satdisp_sect(), satdisp_units().  Simplify
the rest accordingly: plane_sona() and ac_encounter() itself.
2010-07-18 08:31:53 +02:00
e25413a688 Fix lookout to report sector owner properly to deities
It reported all sectors as owned by the deity.
2010-07-18 08:31:53 +02:00
7499d0bdee Fix bogus message when deity attempts to march foreign land unit
Much of the code assumes that only the land unit's owner can march it.
The assumption is correct, because lnd_mar() leaves foreign land units
behind with a bogus "was disbanded at" message (suppressed for country

It would be nice to let deities march foreign land units, but the
assumption is not trivial to remove.  For now, just avoid the bogus
message.

Historical note: it looks like deities used to be able to march
foreign land units just fine until Empire 2 factored common code out
of navigate, sail and autonav, and updated march to match navigate.
Likewise, it looks like they could board with foreign land units until
Empire 2 factored out common ground combat code.  Commands attack and
assault have always rejected foreign land units, even for deities.
2010-07-18 08:31:20 +02:00
8c502d40c6 Fix bogus message when deity attempts to navigate foreign ship
Much of the code assumes that only the ship's owner can navigate it.
The assumption is correct, because shp_nav() leaves foreign ships
behind with a bogus "was sunk at" message (suppressed for country #0).

It would be nice to let deities navigate foreign ships, but the
assumption is not trivial to remove.  For now, just avoid the bogus
message.

Historical note: it looks like deities used to be able to navigate
foreign ships just fine until Empire 2 factored common code out of
navigate, sail and autonav.
2010-07-11 07:59:43 +02:00
9e6b5a9133 Don't let deities fly foreign planes
Much code assumes that only the plane's owner can fly it.
pln_airbase_ok() oopses since commit 446f1991.  Before, flying planes
from carriers failed with a bogus "not valid for" message, and flying
from sectors had output misdirected to the plane's owner.

It would be nice to let deities fly foreign planes, but the assumption
is not trivial to remove, so just satisfy it for now.

Historical note: it looks like deities used to be able to fly foreign
planes just fine until Chainsaw 3 added missions.  The launch command
has always rejected foreign planes, even for deities.
2010-07-11 07:59:43 +02:00
2f4b5973ce Oops when mpr() is misused for printing partial lines
Such misuse creates a bulletin with a partial line.  The read command
normally merges it with the next one, but if the bulletins are more
than five seconds apart (clock jumped somehow), we get a bulletin
header in the middle of a line.
2010-07-11 07:59:43 +02:00
e002bf207f 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.
2010-07-11 07:59:34 +02:00
47dd33698c 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.
2010-06-27 18:28:07 +02:00
4033a3be7d 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.
2010-06-27 18:28:07 +02:00
4191b22758 Message for land unit hitting mines lacked a newline
Broken in Empire 2.
2010-06-27 18:28:07 +02:00
aa3c5ef350 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.
2010-06-27 18:27:48 +02:00
2d436e7830 Improve bulletin for nuke destroyed by nuclear attack
Explain what destroyed the nuke, just like for damage to ships, planes
and land units.
2010-06-27 09:21:56 +02:00
f3fc477c82 All-nuclear bombing run reported "bombing raid did 0 damage"
Broken in commit 162435e6, v4.3.26.
2010-06-27 09:21:56 +02:00
c2527e9caf Clean up code to report nuclear damage to sectors
It was too clever by half.
2010-06-27 09:21:52 +02:00
211dd10c9c Fix empty lines in bulletin reporting nuclear damage to sectors
Broken in Chainsaw 3.
2010-06-21 21:06:02 +02:00
891ea01b1f 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.
2010-06-21 21:03:21 +02:00
10d316660e Drop get_land() parameter victim_land
Use combat_mode instead.
2010-06-21 21:03:21 +02:00
5920515cd7 Drop prxy()'s parameter country
Argument is always player->cnum.  Hardly surprising, because that's
to whom it prints.
2010-06-21 21:03:21 +02:00
5f3fa793b7 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.
2010-06-21 21:03:21 +02:00
40bc823474 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.
2010-06-21 21:03:21 +02:00
53dc49c85c 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.
2010-06-21 21:03:21 +02:00
9ad8618ba3 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.
2010-06-21 21:03:21 +02:00
890886bfa2 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.
2010-06-21 21:03:21 +02:00
79dccdf5a8 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.
2010-06-21 21:03:21 +02:00
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