]> git.pond.sub.org Git - empserver/log
empserver
15 years agoFix pathrange() for paths spanning whole world (with border)
Markus Armbruster [Wed, 20 Aug 2008 01:44:56 +0000 (21:44 -0400)]
Fix pathrange() for paths spanning whole world (with border)

pathrange() screwed up when the result should have been as wide or as
high as the whole world.  This made the path command show a broken
map.

15 years agoRemove cheesy work-around for broken MAPWIDTH()
Markus Armbruster [Wed, 20 Aug 2008 01:30:49 +0000 (21:30 -0400)]
Remove cheesy work-around for broken MAPWIDTH()

MAPWIDTH(3) used to be one too small, which made rout() clobber the
map row's terminating zero when the map spans the whole world in x.
Since Chainsaw 2, rout() copied rows into an additional buffer to add
a terminating zero.  Remove that junk.

15 years agoFix MAPWIDTH() for arguments other than 1
Markus Armbruster [Wed, 20 Aug 2008 01:24:51 +0000 (21:24 -0400)]
Fix MAPWIDTH() for arguments other than 1

MAPWIDTH(x) was (x+2)/2 - 1 too small.  Affected were path and route,
which use MAPWIDTH(3) to size their map buffer: they clobber map rows'
terminating zero when the map spans the whole world in x.  rout() has
a cheesy work-around for that since Chainsaw 2.  path() doesn't, and
duly breaks.

15 years agoFix default map size in interactive move, test and transport
Markus Armbruster [Tue, 19 Aug 2008 01:36:40 +0000 (21:36 -0400)]
Fix default map size in interactive move, test and transport

Sub-command 'm' calls display_region_map() to display a map.  The map
is centered on the current sector by default.  It extended one sector
farther to the right and down than to the left and up.  Odd, and
inconsistent with the map size used by unit_map() for navigate and
march sub-command 'M'.  Fix that.

15 years agoUse snxtitem_xy() instead of snxtitem_dist(..., 0)
Markus Armbruster [Tue, 19 Aug 2008 00:53:32 +0000 (20:53 -0400)]
Use snxtitem_xy() instead of snxtitem_dist(..., 0)

Affected: launch_as() and takeover().

15 years agoSimplify draw_map()
Markus Armbruster [Tue, 19 Aug 2008 00:47:58 +0000 (20:47 -0400)]
Simplify draw_map()

No functional change.

15 years agoFold sarg_getrange() into sarg_area()
Markus Armbruster [Sun, 17 Aug 2008 23:51:43 +0000 (19:51 -0400)]
Fold sarg_getrange() into sarg_area()

sarg_area() is the only caller, and is not doing anything but calling
it anymore.

15 years agoRework code dealing with struct range fixing many bugs
Markus Armbruster [Sun, 17 Aug 2008 21:44:00 +0000 (17:44 -0400)]
Rework code dealing with struct range fixing many bugs

Change struct range from exclusive to inclusive upper bounds, for
consistency with struct realmstr and the area syntax.  Also fix many
bugs.

real()'s conversion from struct range's exclusive upper bounds to
struct realmstr's inclusive upper bounds could underflow and store -1
in the realms file.  Harmless, because its users didn't mind:
list_realm() and nstr_exec_val() convert back to relative coordinates,
and sarg_getrange() is only used by sarg_area(), which happened to
undo the damage.  The change to inclusive upper bounds gets rid of the
broken conversion.

xyinrange() incorrectly treated the upper bound as inclusive, unless
the bounds were equal.  Impact:

* nxtitem() and nxtitemp() cases NS_AREA and NS_DIST attempted to hack
  around xyinrange()'s lossage(!), but screwed up: sectors on the
  lower bound of of a range spanning the the whole world were skipped.
  This affected all command arguments that support area or distance
  syntax for items.  In sufficiently small worlds, it could also make
  radar miss satellites and ships, sonar miss ships, satellite miss
  ships and land units, nuclear detonations miss ships, planes, land
  units and nukes, automatic supply miss ship and land unit supply
  sources, ships and land units fail to return fire, ships fail to
  fire support.

* draw_map() could draw units sitting just right or just below of the
  mapped area.  No effect, as these parts of the map weren't actually
  shown.

xydist_range() produced an inclusive upper bound when it decided that
the range covers everything in that dimension (which it didn't get
quite right either).  This could make snxtsct_dist() and
snxtitem_dist() initialize the iterator with an incorrect upper bound.
Similar impact as the xyinrange() / nxtitem() lossage.

border() could print the hundreds line unnecessarily.

snxtsct() and snxtsct_all() screwed up for odd WORLD_Y: they failed to
include (WORLD_Y - 1) / 2 in the y-range.  This affected all command
arguments that support "*" syntax for sectors, plus add ... c, power
n, and break.

snxtsct_all() failed to normalize the bounds (presumed harmless).

There were a few correct, but somewhat unclean uses of struct range
with inclusive upper bounds:

* nat_reset() used one internally.

* pathrange() worked with inclusive upper bounds internally, but
  corrected to exclusive upper bounds before passing the range out.

* sarg_getrange() worked with inclusive upper bounds.  Its only caller
  sarg_area() corrected that to exclusive upper bounds.

The change to inclusive upper bounds cleans this up.

unit_map() and xysize_range() had no issues (isn't that amazing?), but
need to be updated for the changed struct range semantics.

15 years agoDoc fix for commit 7ca4f412
Markus Armbruster [Sun, 17 Aug 2008 13:52:03 +0000 (09:52 -0400)]
Doc fix for commit 7ca4f412

15 years agoMake snxtsct_area() expect correct range width and height
Markus Armbruster [Sun, 17 Aug 2008 13:23:22 +0000 (09:23 -0400)]
Make snxtsct_area() expect correct range width and height

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.

15 years agoClean up and simplify snxtitem_dist() and snxtsct_dist()
Markus Armbruster [Sun, 17 Aug 2008 11:51:23 +0000 (07:51 -0400)]
Clean up and simplify snxtitem_dist() and snxtsct_dist()

No functional change.

15 years agoOops on funny xysize_range() arguments
Markus Armbruster [Sun, 17 Aug 2008 02:07:28 +0000 (22:07 -0400)]
Oops on funny xysize_range() arguments

Comments claimed funny arguments could happen.  I don't think so.

15 years agoFix computation of map buffer indexes
Markus Armbruster [Sun, 17 Aug 2008 01:56:28 +0000 (21:56 -0400)]
Fix computation of map buffer indexes

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.

15 years agoFix deltx() for x < r->lx && r->lx < r->hx; likewise delty()
Markus Armbruster [Sat, 16 Aug 2008 18:57:13 +0000 (14:57 -0400)]
Fix deltx() for x < r->lx && r->lx < r->hx; likewise delty()

Bug couldn't bite, because callers pass only coordinates within the
interval.

15 years agoRemove some useless code from nav_map()
Markus Armbruster [Sat, 16 Aug 2008 18:22:22 +0000 (14:22 -0400)]
Remove some useless code from nav_map()

15 years agoBuild ecomony for player 8
Ron Koenderink [Tue, 19 Aug 2008 03:21:46 +0000 (21:21 -0600)]
Build ecomony for player 8

15 years agoExplore player 8's island
Ron Koenderink [Sun, 17 Aug 2008 21:54:21 +0000 (15:54 -0600)]
Explore player 8's island

Explore the player 8's island in preparation for
island development and future war with player 1.

15 years agoAdd additional tests to nightly build
Ron Koenderink [Sun, 17 Aug 2008 21:51:40 +0000 (15:51 -0600)]
Add additional tests to nightly build

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.

15 years agoFix timestamps for data files and lost command
Ron Koenderink [Sun, 17 Aug 2008 21:13:57 +0000 (15:13 -0600)]
Fix timestamps for data files and lost command

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.

15 years agoBump version to 4.3.17
Markus Armbruster [Fri, 15 Aug 2008 11:52:36 +0000 (07:52 -0400)]
Bump version to 4.3.17

15 years agoAdd additional tests to nightly build
Ron Koenderink [Sat, 9 Aug 2008 21:05:40 +0000 (15:05 -0600)]
Add additional tests to nightly build

The following tests were added:
ship list
ship navigation
assault
tech production
sector lost
commodity monitoring
tech monitoring
education monitoring

15 years agoAdd change directory before starting server tests
Ron Koenderink [Sat, 9 Aug 2008 20:59:59 +0000 (14:59 -0600)]
Add change directory before starting server tests

The server tests would fail if the previous
steps were skippped.

15 years agoUpdate change log again for 4.3.16 v4.3.16
Markus Armbruster [Sat, 9 Aug 2008 15:58:01 +0000 (11:58 -0400)]
Update change log again for 4.3.16

15 years agoFail announce, pray, telegram and turn on aborted telegrams
Markus Armbruster [Sat, 9 Aug 2008 15:52:04 +0000 (11:52 -0400)]
Fail announce, pray, telegram and turn on aborted telegrams

Change tele() and turn() to return RET_FAIL when getele() fails.
Before, tele() returned RET_OK then, and turn() returned RET_SYN.

15 years agoFix recently changed command failures to use BTUs
Markus Armbruster [Sat, 9 Aug 2008 15:44:26 +0000 (11:44 -0400)]
Fix recently changed command failures to use BTUs

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.

15 years agoFix production command not to limit level production to 999
Markus Armbruster [Sat, 9 Aug 2008 13:03:03 +0000 (09:03 -0400)]
Fix production command not to limit level production to 999

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.

15 years agoGive some identifiers internal linkage
Markus Armbruster [Mon, 4 Aug 2008 01:00:40 +0000 (21:00 -0400)]
Give some identifiers internal linkage

Give draw_map(), xdeval(), LwpSchedQ[], LwpDeadQ, LwpContextPtr,
LwpMaxpri, LwpStackGrowsDown internal linkage.

15 years agoRemove unused xdprval()
Markus Armbruster [Mon, 4 Aug 2008 00:56:19 +0000 (20:56 -0400)]
Remove unused xdprval()

15 years agoFix work not to claim an engineer worked when it didn't
Markus Armbruster [Sun, 3 Aug 2008 21:32:35 +0000 (17:32 -0400)]
Fix work not to claim an engineer worked when it didn't

15 years agoFix work command to round mobility use randomly, not down
Markus Armbruster [Sun, 3 Aug 2008 21:21:07 +0000 (17:21 -0400)]
Fix work command to round mobility use randomly, not down

15 years agoFix work command not to spend more mobility than requested
Markus Armbruster [Sun, 3 Aug 2008 21:20:05 +0000 (17:20 -0400)]
Fix work command not to spend more mobility than requested

Culprit is careless rounding in work().

15 years agoDon't permit work command to spend more money than available
Markus Armbruster [Sun, 3 Aug 2008 20:54:14 +0000 (16:54 -0400)]
Don't permit work command to spend more money than available

Stop work() when there's not enough money left for the current
engineer.

15 years agoImprove work()'s message when sector doesn't need construction
Markus Armbruster [Sun, 3 Aug 2008 20:36:44 +0000 (16:36 -0400)]
Improve work()'s message when sector doesn't need construction

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.

15 years agoFix improve not to spend more money than available
Markus Armbruster [Sun, 3 Aug 2008 19:09:15 +0000 (15:09 -0400)]
Fix improve not to spend more money than available

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.

15 years agochkmoney() is no longer used, remove it
Markus Armbruster [Sun, 3 Aug 2008 18:40:40 +0000 (14:40 -0400)]
chkmoney() is no longer used, remove it

15 years agoDon't permit convert to spend more money than available
Markus Armbruster [Sun, 3 Aug 2008 18:40:13 +0000 (14:40 -0400)]
Don't permit convert to spend more money than available

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().

15 years agoDon't permit demobilize to spend more money than available
Markus Armbruster [Sun, 3 Aug 2008 18:14:07 +0000 (14:14 -0400)]
Don't permit demobilize to spend more money than available

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.

15 years agoChange nav_ship() not to use RET_OK and RET_SYN as return values
Markus Armbruster [Sun, 3 Aug 2008 16:18:14 +0000 (12:18 -0400)]
Change nav_ship() not to use RET_OK and RET_SYN as return values

These are only appropriate for commands and their helpers.

15 years agoGet rid of RET_SYS, just use RET_FAIL
Markus Armbruster [Sun, 3 Aug 2008 15:34:00 +0000 (11:34 -0400)]
Get rid of RET_SYS, just use RET_FAIL

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).

15 years agoFix error return value of nav_loadship()
Markus Armbruster [Sun, 3 Aug 2008 14:25:48 +0000 (10:25 -0400)]
Fix error return value of nav_loadship()

Used RET_SYS as an error value, which is bogus; caller interprets
non-zero as "all loaded".  Return zero instead.

15 years agoUpdate known contributors comments
Markus Armbruster [Sun, 3 Aug 2008 12:04:08 +0000 (08:04 -0400)]
Update known contributors comments

15 years agoUpdate change log for 4.3.16
Markus Armbruster [Sun, 3 Aug 2008 01:29:48 +0000 (21:29 -0400)]
Update change log for 4.3.16

15 years agoMake ship_bomb() friendlier
Markus Armbruster [Sun, 3 Aug 2008 01:22:11 +0000 (21:22 -0400)]
Make ship_bomb() friendlier

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.

15 years agoSimplify control flow in ship_bomb(), plane_bomb(), land_bomb()
Markus Armbruster [Sun, 3 Aug 2008 01:07:42 +0000 (21:07 -0400)]
Simplify control flow in ship_bomb(), plane_bomb(), land_bomb()

No functional change.

15 years agoRemove key 'd' at bomb ship, plane and land unit target prompts
Markus Armbruster [Sat, 2 Aug 2008 22:26:12 +0000 (18:26 -0400)]
Remove key 'd' at bomb ship, plane and land unit target prompts

Key 'd' has always been there, but never documented.  Key '~' does the
same, and the prompt mentions it since 4.2.2.  Drop 'd'.

15 years agoFix land unit flak when pin-bombed to match flak when overflown
Markus Armbruster [Sat, 2 Aug 2008 22:10:49 +0000 (18:10 -0400)]
Fix land unit flak when pin-bombed to match flak when overflown

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().

15 years agoDon't permit bombing of embarked planes and land units
Markus Armbruster [Sat, 2 Aug 2008 21:28:05 +0000 (17:28 -0400)]
Don't permit bombing of embarked planes and land units

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.

15 years agoRemove redundant and misleading stuff from info bomb
Markus Armbruster [Sat, 2 Aug 2008 21:17:08 +0000 (17:17 -0400)]
Remove redundant and misleading stuff from info bomb

15 years agoFix capital maintenance to charge at 60% efficiency
Markus Armbruster [Sat, 2 Aug 2008 19:46:35 +0000 (15:46 -0400)]
Fix capital maintenance to charge at 60% efficiency

produce_sect() started to charge at 61%.  Has always been that way.

15 years agoMake launch command require only 40% plane efficiency
Markus Armbruster [Sat, 2 Aug 2008 19:03:44 +0000 (15:03 -0400)]
Make launch command require only 40% plane efficiency

This is to make it consistent with automatic missile launch.

15 years agoDisable collateral damage for automatically launched missiles
Markus Armbruster [Sat, 2 Aug 2008 18:42:06 +0000 (14:42 -0400)]
Disable collateral damage for automatically launched missiles

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().

15 years agoFix a long vs. int format string bug in xdprsym()
Markus Armbruster [Sat, 2 Aug 2008 16:04:06 +0000 (12:04 -0400)]
Fix a long vs. int format string bug in xdprsym()

Could print junk on machines where long is wider than int, but only in
oops recovery.

15 years agoAdd gcc attribute format where it's missing
Markus Armbruster [Sat, 2 Aug 2008 16:00:33 +0000 (12:00 -0400)]
Add gcc attribute format where it's missing

15 years agoFix struct loststr / struct empobj mismatch corrupting lostitems
Markus Armbruster [Fri, 1 Aug 2008 12:50:24 +0000 (08:50 -0400)]
Fix struct loststr / struct empobj mismatch corrupting lostitems

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.

15 years agoRemove product information from show sect c
Markus Armbruster [Mon, 28 Jul 2008 01:16:57 +0000 (21:16 -0400)]
Remove product information from show sect c

New show product made this redundant.

15 years agoAlways print header in show_sect_stats() and show_sect_capab()
Markus Armbruster [Sun, 27 Jul 2008 23:36:25 +0000 (19:36 -0400)]
Always print header in show_sect_stats() and show_sect_capab()

Simpler, and empty tables are highly unlikely anyway.

15 years agoNew show product
Markus Armbruster [Sun, 27 Jul 2008 22:02:06 +0000 (18:02 -0400)]
New show product

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.

15 years agoShow sector navigability in show se s
Markus Armbruster [Sun, 27 Jul 2008 19:44:37 +0000 (15:44 -0400)]
Show sector navigability in show se s

This is the human-readable buddy of xdump sect-chr column nav, which
dumps ichr[].d_nav.

15 years agoShow packing type instead of selected bonuses in show se s
Markus Armbruster [Sun, 27 Jul 2008 19:33:59 +0000 (15:33 -0400)]
Show packing type instead of selected bonuses in show se s

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".

15 years agoAdd a a line for the usual values to show se b
Markus Armbruster [Sun, 27 Jul 2008 18:49:50 +0000 (14:49 -0400)]
Add a a line for the usual values to show se b

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.

15 years agoUpdate coding guidelines: oops, get/put, reading player input
Markus Armbruster [Sun, 27 Jul 2008 16:02:34 +0000 (12:02 -0400)]
Update coding guidelines: oops, get/put, reading player input

15 years agoDocument when emp_client signals EOF and interrupt
Markus Armbruster [Sun, 27 Jul 2008 16:00:45 +0000 (12:00 -0400)]
Document when emp_client signals EOF and interrupt

15 years agoFix extra prompt after abort due to misuse of snxtitem()
Markus Armbruster [Sun, 27 Jul 2008 01:35:00 +0000 (21:35 -0400)]
Fix extra prompt after abort due to misuse of snxtitem()

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.

15 years agoFail ltend command properly when it gets aborted
Markus Armbruster [Sun, 27 Jul 2008 01:13:09 +0000 (21:13 -0400)]
Fail ltend command properly when it gets aborted

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.

15 years agoFix get_planes() to abort at the escort prompt
Markus Armbruster [Sat, 26 Jul 2008 19:12:47 +0000 (15:12 -0400)]
Fix get_planes() to abort at the escort prompt

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.

15 years agoNew get_planes(), factored out of plane flying commands
Markus Armbruster [Sat, 26 Jul 2008 18:58:44 +0000 (14:58 -0400)]
New get_planes(), factored out of plane flying commands

No functional change.

15 years agoFix interdiction to obey op-area for missiles
Markus Armbruster [Fri, 25 Jul 2008 12:40:01 +0000 (08:40 -0400)]
Fix interdiction to obey op-area for missiles

Never worked correctly.  Reported by Gregory E. Garland.

15 years agoFix remaking of sources.mk with git
Markus Armbruster [Fri, 25 Jul 2008 12:34:35 +0000 (08:34 -0400)]
Fix remaking of sources.mk with git

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.

15 years agoFix xdump.pl reference in doc/xdump
Gerd Flaig [Sun, 20 Jul 2008 21:41:10 +0000 (23:41 +0200)]
Fix xdump.pl reference in doc/xdump

15 years agoSimplify best() and torp()
Markus Armbruster [Sun, 20 Jul 2008 20:45:38 +0000 (16:45 -0400)]
Simplify best() and torp()

Use snxtsct_rewind() instead of snxtsct(), and snxtitem_rewind()
instead of snxtitem().

15 years agoFix parse() not to filter out tab from quoted arguments
Markus Armbruster [Sun, 20 Jul 2008 15:01:18 +0000 (11:01 -0400)]
Fix parse() not to filter out tab from quoted arguments

Broken in commit 2cc44bb1, v4.2.21.

15 years agoSimplify preport()
Markus Armbruster [Sun, 20 Jul 2008 14:51:28 +0000 (10:51 -0400)]
Simplify preport()

Return value of ctime() always starts with a capital letter, so
upcasing it is pointless.

15 years agoClean up how snxtitem() parses country names
Markus Armbruster [Sun, 20 Jul 2008 14:49:50 +0000 (10:49 -0400)]
Clean up how snxtitem() parses country names

Old code didn't check for natarg() failure, but relied on
sarg_type("-1") returning NS_UNDEF.

15 years agoMake shutdown command fail when there's no shutdown to cancel
Markus Armbruster [Sun, 20 Jul 2008 14:28:57 +0000 (10:28 -0400)]
Make shutdown command fail when there's no shutdown to cancel

Before, it printed "Shutdown sequence begun", which was bogus.

15 years agoImplement wakeup of shutdown thread in shutdown_initiate()
Markus Armbruster [Sun, 20 Jul 2008 14:22:46 +0000 (10:22 -0400)]
Implement wakeup of shutdown thread in shutdown_initiate()

Before, the shutdown command's action could be delayed by up to a
minute when the shutdown thread was already running.

15 years agoFix shutdown_initiate() not to start multiple shutdown threads
Markus Armbruster [Sun, 20 Jul 2008 14:20:40 +0000 (10:20 -0400)]
Fix shutdown_initiate() not to start multiple shutdown threads

This happened when you cancelled shutdown and initiated another one
before the old shutdown thread noticed the cancellation.

15 years agoSwap zdone's deity arguments
Markus Armbruster [Sun, 20 Jul 2008 13:02:33 +0000 (09:02 -0400)]
Swap zdone's deity arguments

This puts the additional deity argument last.

Deity syntax wasn't documented before.

15 years agoMake zdone accept country names
Markus Armbruster [Sun, 20 Jul 2008 12:41:12 +0000 (08:41 -0400)]
Make zdone accept country names

Use natarg() so that country names work.  Simplify control flow.

15 years agoFix validation of threshold's threshold argument
Markus Armbruster [Sun, 20 Jul 2008 02:35:23 +0000 (22:35 -0400)]
Fix validation of threshold's threshold argument

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.

15 years agoSimplify att_prompt()
Markus Armbruster [Sat, 19 Jul 2008 21:26:54 +0000 (17:26 -0400)]
Simplify att_prompt()

15 years agoSimplify getpath()
Markus Armbruster [Sat, 19 Jul 2008 19:54:29 +0000 (15:54 -0400)]
Simplify getpath()

15 years agoSimplify getele()
Markus Armbruster [Sat, 19 Jul 2008 19:50:15 +0000 (15:50 -0400)]
Simplify getele()

No need to check player->aborted(), checking value of uprmptrd()
suffices.

15 years agoAvoid cryptic message when survey's first argument is empty
Markus Armbruster [Sat, 19 Jul 2008 15:47:06 +0000 (11:47 -0400)]
Avoid cryptic message when survey's first argument is empty

Catch empty argument instead of letting nstr_comp_val() choke on it.

15 years agoFix origin and zdone for invalid country argument
Markus Armbruster [Fri, 18 Jul 2008 22:34:17 +0000 (18:34 -0400)]
Fix origin and zdone for invalid country argument

Invalid country argument was interpreted as (natid)-1, which is
normally 255.  Harmless as long as this is less than MAXNOC (99).
Wrong anyway.

15 years agoValidate explore's third argument earlier
Markus Armbruster [Fri, 18 Jul 2008 22:15:46 +0000 (18:15 -0400)]
Validate explore's third argument earlier

The old code checked a bunch of other things first, which made it hard
to see that the value of onearg() was checked properly.

15 years agoFix cede not prompt twice for its first argument
Markus Armbruster [Fri, 18 Jul 2008 21:38:35 +0000 (17:38 -0400)]
Fix cede not prompt twice for its first argument

15 years agoFail commands properly when they get aborted
Markus Armbruster [Sat, 19 Jul 2008 14:00:23 +0000 (10:00 -0400)]
Fail commands properly when they get aborted

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

15 years agoClean up how desi() handles bad designation arguments
Markus Armbruster [Sun, 20 Jul 2008 21:12:51 +0000 (17:12 -0400)]
Clean up how desi() handles bad designation arguments

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.

15 years agoFix bdes and designate to always write updated bmap to disk
Markus Armbruster [Sat, 19 Jul 2008 14:05:25 +0000 (10:05 -0400)]
Fix bdes and designate to always write updated bmap to disk

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.

15 years agoFix bdes not to gripe about empty desig input
Markus Armbruster [Fri, 18 Jul 2008 21:31:14 +0000 (17:31 -0400)]
Fix bdes not to gripe about empty desig input

15 years agoFix bomb to fail on empty <pin|strat> argument
Markus Armbruster [Tue, 15 Jul 2008 12:15:07 +0000 (08:15 -0400)]
Fix bomb to fail on empty <pin|strat> argument

Before, the planes flew empty, and oopsed (since commit feaa2dd9,
v4.3.12) or complained (before) over the target instead of bombing it.

15 years agoFix distribute aborting at prompt for second argument
Markus Armbruster [Fri, 18 Jul 2008 22:10:44 +0000 (18:10 -0400)]
Fix distribute aborting at prompt for second argument

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.

15 years agoSimplify pin_bomb() aborting at "Bomb what" prompt
Markus Armbruster [Tue, 15 Jul 2008 12:03:41 +0000 (08:03 -0400)]
Simplify pin_bomb() aborting at "Bomb what" prompt

15 years agoFix command abortion after getting player input
Markus Armbruster [Tue, 15 Jul 2008 11:55:42 +0000 (07:55 -0400)]
Fix command abortion after getting player input

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

15 years agoFix treatment of EOF from player
Markus Armbruster [Tue, 15 Jul 2008 02:37:02 +0000 (22:37 -0400)]
Fix treatment of EOF from player

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.

15 years agoSimplify breaking of command loop
Markus Armbruster [Tue, 15 Jul 2008 02:30:28 +0000 (22:30 -0400)]
Simplify breaking of command loop

Change status() to check player->eof instead of io_error() and
io_eof().  Ignore value of command().

15 years agoChange recvclient() to treat io_error() like io_eof()
Markus Armbruster [Tue, 15 Jul 2008 02:24:42 +0000 (22:24 -0400)]
Change recvclient() to treat io_error() like io_eof()

This is for consistency with status() and player_login().

15 years agoOops when player thread keeps reading input unsuccessfully
Markus Armbruster [Sun, 13 Jul 2008 02:41:52 +0000 (22:41 -0400)]
Oops when player thread keeps reading input unsuccessfully

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.

15 years agoChange pln_mine() parameters to match pln_dropoff()
Markus Armbruster [Sat, 12 Jul 2008 18:43:35 +0000 (14:43 -0400)]
Change pln_mine() parameters to match pln_dropoff()

This moves getting the target sector from caller into pln_mine().
Makes sense, because that's where it's put.

15 years agoChange pln_dropoff() parameters to match pln_newlanding()
Markus Armbruster [Sat, 12 Jul 2008 18:35:41 +0000 (14:35 -0400)]
Change pln_dropoff() parameters to match pln_newlanding()

This moves getting the target sector or ship from caller into
pln_dropoff().  Makes sense, because that's where it's put.