show_sect_stats() used to show packing bonuses for military,
uncompensated workers, civilians, bars and lcms. The bonus for lcms
was labelled "other", which was okay only as long as all other
commodities receive the same packing bonuses.
Show packing bonus type instead. The actual bonus for each commodity
and packing type is already shown by show item. But change its header
for the NPKG column from "rg" to "no", because packing type NPKG is
shown by show se s as "normal".
show_sect_build() showed only sectors with unusual build
characteristics. Which begged the question what the usual build
characteristics are. Add a line to show them.
The old code used getstarg() to get an argument with a different
prompt than snxtitem() uses, then passed the value to snxtitem()
unchecked. If the player aborts, getstarg() returns a null pointer,
and snxtitem() prompts again. Affected:
* load/lload plane/land third argument; load_plane_ship(),
load_land_ship(), load_plane_land(), load_land_land()
* bomb, drop, fly, paradrop, recon and sweep second argument;
get_planes()
* tend and ltend second and fourth argument; ltend(), tend(),
tend_land()
* mission second argument; mission()
Fix by making snxtitem() taking a prompt argument, null pointer
requests the old prompt.
Use that to simplify multifire() and torp(). Change the other callers
to pass NULL.
The old code didn't return RET_SYN when aborting at the prompts for
the third and fourth argument.
While there, return RET_SYN instead of RET_OK when the tender can't
hold the commodity to be tended.
This affects commands bomb, drop, fly, paradrop, recon and sweep.
The failure to abort was harmless, because all callers get additional
arguments, and abort then.
Broken since commit 35db407d, v.4.3.12. v4.3.14 and v4.3.15 were
distributed with a stale sources.mk in the tarball. The latter does
not build out of the box because of that.
There were two checks meant to enforce positive numbers, both dating
back to the earliest known versions of the code, and both wrong.
The first one applied only to thresholds given with the command, not
ones prompted for, and it incorrectly rejected numbers starting with +
or prefixed by whitespace. Remove it.
The second one failed to reject negative numbers when prefixed by
whitespace. Fix.
Fortunately, the update doesn't conjure up stuff to satisfy negative
thresholds.
The old code didn't return RET_SYN when aborting at the following
prompts:
* designate second argument
* morale second argument
* route second argument
* set third argument
* tend fourth argument
* zdone last argument
Fail the command when the designation isn't allowed for mortals, or
when the player can't afford it.
Treat '=' and '@' like the other designations not allowed for mortals,
not like invalid designations. Change failure for invalid designation
from RET_FAIL to RET_SYN.
bdes() failed to do that when the player aborted at the prompt for the
new designation.
desi() failed to do it when it failed the command because the new
designation was bad.
Before failing the command, the old code attempted to change the
current sector's distribution center to the last one used, which might
have been uninitialized coordinates. If lucky, the coordinates were
invalid, and the attempt oopsed and did nothing.
The old code didn't honor command abortion at the following prompts:
* arm third argument
* deliver fourth argument (also simplify)
* fire third argument
* fly and recon prompt for carrier to land on: pln_onewaymission()
treated abort like empty input, which made planes attempt landing in
the sector.
* lmine second argument
* order d fourth argument
* power c nat(s) argument
* range second argument
* sail second argument
* shutdown both arguments (first one was broken in commit 84cfd670,
v4.3.10, second one never worked).
* tend third argument
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
input.
* cmd_sail_ship() dereferenced a null pointer.
Fix by setting player->aborted on EOF, too.
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.
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().
Commit db1ac2ed (v4.3.6) introduced a separate territory for deities,
and made the territory command use it by default for deities. Deities
can still access the old default territory as territory number 0.
Selectors terr, terr0 (alias for terr), terr1, terr2, terr3 remained
unchanged, and a new selector dterr was created to let deities access
the deity territory.
Make selector terr virtual, so that it can do "the right thing", just
like the territory command: select territory 0 for mortals, and the
deity territory for deities.
Unfortunately, this requires us to switch xdump to use terr0 instead
of terr, because otherwise the deity xdump would contain the deity
territory twice, and territory 0 not at all.
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.
Change retreat condition prompt to point to help. Before, it listed
conditions rather cryptically, without mentioning how to get help.
Don't provide help when encountering a bad retreat condition
character.
Fail the command when encountering a bad retreat condition character.
Before, they were dropped.
Don't fail the command when the player asks for help at the condition
code prompt.
Retreat condition help failed to explain 'c'.