Commit graph

3899 commits

Author SHA1 Message Date
0d8ee6ee6c Fix oops recovery in lnd_set_tech()
Broken in commit 0219bf08.
2010-07-18 09:28:50 +02:00
8c12432327 PR() and PRdate() are no longer used, remove them 2010-07-18 09:28:50 +02:00
dcd192f324 Use mpr() instead of PR() where possible
The difference between the two is that PR() buffers partial lines, and
mpr() suppresses output to country#0.  Doesn't matter when printing
complete lines to a country other than #0, e.g. the owner of a unit.
2010-07-18 09:28:49 +02:00
73260a8a6d Factor ac_dog_report() out of ac_dog() 2010-07-18 09:26:57 +02:00
97d6c5262f Streamline flak damage report to plane owner
Don't tell him that it's his plane, he knows that.

Put a " -- " between "takes N%" and "aborted" / "shot down" for
ordinary flak as well, not just for flak vs. pinpoint bombing.
2010-07-18 08:36:19 +02:00
aa5bb9790c Factor common plane damage code into ac_damage_plane()
Out of ac_planedamage() and pinflak_planedamage().
2010-07-18 08:36:19 +02:00
1a4fc50d57 Make flak vs. pinpoint bombing consistent with ordinary flak
Reduce abort chance from 100-eff to 80-eff.  Ordinary flak's abort
chance was reduced from 100-eff (if eff<80) to 80-eff in commit
0252d4a7, v4.3.6.

Report plane efficiency when it aborts, not 100 - efficiency.

Charge mobility proportional to damage, down to -32.
2010-07-18 08:34:45 +02:00
7defa55394 Suppress "no damage" after "takes 0" when reporting flak 2010-07-18 08:34:45 +02:00
5bb4846267 Clean up ac_planedamage() a bit
Reshuffle code for clarity, and delete a bogus comment.
2010-07-18 08:34:45 +02:00
22834d6793 Rename ac_planedamage() argument show to flak
Parameter name "show" is misleading since the previous commit:
non-zero no longer shows anything, only suppresses output.
2010-07-18 08:34:45 +02:00
16b16e34b3 Move printing from ac_planedamage() into callers
It prints only if show is non-zero, so only ac_fireflak() is affected.
2010-07-18 08:34:45 +02:00
4007fc0f99 Streamline ac_planedamage()'s last argument
ac_planedamage() writes up to 14 characters.  Trim excessive buffers
in callers.  Guard against overrun in callee.
2010-07-18 08:34:45 +02:00
38ae0252b8 Simplify ac_planedamage() to write straight to mesg[] 2010-07-18 08:34:45 +02:00
d96202fc90 Remove dead code from ac_planedamage()
Since Empire 3 made option NEWPAF mandatory, checkabort is always
non-zero, and show implies checkabort != 1 and other == 0.  Drop
unreachable code, and remove unused parameters checkabort and other.
2010-07-18 08:34:45 +02:00
5161953996 Clean up call of writemap() in ac_encounter()
Pass the more obviously correct plane_owner instead of player->cnum.
They're the same, actually.

When deities could still fly foreign planes (before commit 2023b47c),
they weren't.  ac_encounter() updated the plane owner's in-memory
bmap, but wrote the current player's bmap to disk.
2010-07-18 08:34:25 +02:00
c2cd58d561 Fix recon and satellite to write spy plane bmap updates to disk
satdisp_sect() updated the in-memory bmap, but failed to write the
updates to disk.  Its callers already update bmap from other sources,
so move this update there, and connect it to the existing write back.
2010-07-18 08:31:53 +02:00
8eca636c7d Factor look_at_sect() out of do_look() and ac_encounter() 2010-07-18 08:31:53 +02:00
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