snxtsct_area() computed width and height, overwriting the values
passed in, even though all but two callers passed correct values. The
exceptions were snxtsct() in case NS_ALL, and snxtsct_all(). Change
them to pass correct values, and drop the recomputation from
snxtsct_area(). Simplifies the interface between snxtsct_area() and
its callers.
The correct method to compute indexes into a map buffer for a struct
range is deltx(), delty().
path() used deltax(), deltay() instead, which yield correct results
only for indexes up to half the world size. Pathes spanning larger
areas were screwed up.
sona(), radmap2(), satmap() also used deltax(), deltay(), but only
with arguments where those yield correct results.
draw_map() used xnorm(), ynorm() instead, which is correct, but less
clear and less efficient.
The following tests were added:
bridge building
spy
radar (ship, sector)
look
convert
In additon, prepartion for testing research and
hapiness production was added and improvements
for general economy for player 1 were added.
Set the ef_timestamp to 100 for the nightly build.
Set the DUMP LOST timestamp to 101 for the nightly build.
This will the suppress the timestamp differences
that occur when testing lost command and will facilitate
testing for dump and xdump commands.
The following tests were added:
ship list
ship navigation
assault
tech production
sector lost
commodity monitoring
tech monitoring
education monitoring
Failing a command with code RET_SYN prints help and doesn't charge
BTUs. Failing with code RET_FAIL doesn't print help and charges BTUs.
A couple of command failures were changed or added recently to fail
with RET_SYN, because they're due to invalid player input. Some of
them, however, can happen after the command already did something, so
BTUs must be charged, or else players can deliberately fail the
command to save BTUs:
* Commit 9eda5f87 adds RET_SYN failures when getting player input
fails for:
- arm third argument
- deliver fourth argument
- fire third argument
- lmine second argument
- order d fourth argument
- range second argument
- sail second argument
- tend third argument
* Commit be41e70f likewise for:
- designate second argument
- morale second argument
- set third argument
- tend fourth argument
* Commit d000bf92 likewise (with a bogus commit message) for bdes
second argument.
* Commit 9f4ce71a likewise for ltend third and fourth argument.
* Commit 9031b03b changes failure code from RET_FAIL when getting
player input fails for threshold third argument. It adds RET_SYN
failure when the argument is bad. Some bad arguments already failed
that way before.
* Commit a7cf69af changes it from RET_FAIL when designate second
argument is bad.
Change them all to fail with RET_FAIL.
Many other places have the same bug, but those are left for another
day.
Item production is limited to 999 units, level production is
unlimited.
Commit 0e721173 (v4.2.15) changed prod() from no limit to 999 units,
which fixed it for items, and broke it for levels. Undo the change
for levels.
The cheesy test for repeated messages broke down when working on more
than one sector. Reword the message so that repetition is fine, and
drop the test.
improve() attempted not to spend the last dollar, but screwed up when
improving more than one sector. This could bankrupt the player.
Replace the flawed code by the same simple method that is used
elsewhere: break the loop when there's not enough money left for the
current sector.
Complicated by the fact that conv() ran the conversion code twice,
first for adding up the cost for chkmoney(), then for actually
converting. chkmoney() asks the player to confirm when he's about to
spend more than half his cash. Get rid of that, not worth the
complexity. This merges do_conv() back into conv().
Complicated by the fact that demo() ran the demobilization code twice,
first for adding up the cost for chkmoney(), then for actually
demobilizing. chkmoney() asks the player to confirm when he's about
to spend more than half his cash. Get rid of that, not worth the
complexity. This merges do_demo() back into demo().
It also removes the command's virtually undocumented fourth argument.
Update player_coms[] accordingly. While there, make it require money;
it won't do anything useful without money anyway.
RET_SYS was used for commands failing due to internal or environmental
errors, but not really systematically. The difference to RET_FAIL is
how dispatch() treats them: RET_SYS got logged, and cost no BTUs.
More specific logging is possible at the point of failure than in
dispatch(). Make sure that's done for all failures that used to
return RET_SYS.
The change in BTU charging affects commands consider, offer, repay,
trade failing due to internal errors. It also affects deity commands
reload and turn (irrelevant because deities get unlimited BTUs), and
commands apropos, info and motd (irrelevant because they cost no
BTUs).
Behave like plane_bomb() and land_bomb(): deal with leading whitespace
and signs in the input, print a message when asked to bomb a ship that
is not there.
land_bomb() failed to reduce flak proportional to efficiency. Missed
in commit c7f68f2e, v4.3.6.
Also change it to round randomly instead of down, to match
ac_landflak().
Change planesatxy() not to list embarked planes, plane_bomb() not to
bomb them, and land_bomb() not to bomb embarked land units.
Curiously, embarked land units were not listed as targets before, but
could be bombed all the same.
4.0.17 made missiles that miss their target do collateral damage to
the target sector. The code didn't work: it did collateral damage
even when the launch failed or the missile got intercepted. 4.0.18
disabled it again for the launch command (see also commit fa7e3aa9).
Disable it for automatically launched missiles, too, in
msl_launch_mindam().
The initial parts of struct loststr and struct empobj must match.
Commit 49780e2c screwed that up for members lost_uid/uid, which also
broke the equivalence of lost_owner/own. Since lost_uid is not used,
the former had no effect. But the latter broke xdvisible(). Could
make xdump lost leak information.
Commit a680c811 reorderd struct loststr members to make lost_timestamp
equivalent to new struct empobj member timestamp, but failed due to
the bug in commit 49780e2c. Commit f33b96b1 then set the timestamp
through empobj, which screwed up timestamps in lostitems, i.e. it
broke incremental xdump lost.
All of the above is in v4.3.12.
Commit 536ef0b0 (v4.3.15) added lost_seqno / seqno. No effect,
because only seqno is used.
This is the human-readable buddy of xdump product, which dumps pchr[].
It duplicates much of the information in show sect c, but in more
accessible form. It's in show_product().
Remove product information from info Quick-ref. show reflects the
actual game, is more complete, and should be just as readable.