]> git.pond.sub.org Git - empserver/log
empserver
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.

15 years agoFix seqno mismatch in fly()
Markus Armbruster [Sat, 12 Jul 2008 14:56:30 +0000 (10:56 -0400)]
Fix seqno mismatch in fly()

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

15 years agoMake selector terr do the right thing for deities
Markus Armbruster [Fri, 11 Jul 2008 11:44:02 +0000 (07:44 -0400)]
Make selector terr do the right thing for deities

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.

15 years agoDon't fix up dead planes stuck in the air
Markus Armbruster [Thu, 10 Jul 2008 23:35:51 +0000 (19:35 -0400)]
Don't fix up dead planes stuck in the air

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.

15 years agoFix bomb not to let you p-bomb dead ships and land units
Markus Armbruster [Sun, 6 Jul 2008 19:19:17 +0000 (15:19 -0400)]
Fix bomb not to let you p-bomb dead ships and land units

ASW planes bombing ships were not affected, because asw_shipsatxy()
excludes dead ships correctly.

15 years agoDocument retreat condition help in info retreat
Markus Armbruster [Sun, 6 Jul 2008 18:34:41 +0000 (14:34 -0400)]
Document retreat condition help in info retreat

While there, layout the table more nicely.

15 years agoClean up and improve retreat condition handling
Markus Armbruster [Sun, 6 Jul 2008 18:19:07 +0000 (14:19 -0400)]
Clean up and improve retreat condition handling

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

15 years agoClean up unified unit loop in retreat()
Markus Armbruster [Sun, 6 Jul 2008 17:19:20 +0000 (13:19 -0400)]
Clean up unified unit loop in retreat()

Factor common code out of the type conditional.  Widens the "as flt?"
column to match the "as army?" column.

15 years agoUnify retreat and lretreat code
Markus Armbruster [Sun, 6 Jul 2008 14:57:51 +0000 (10:57 -0400)]
Unify retreat and lretreat code

New retreat(), call from retr() and lretr().  No functional changes.
Needs cleanup.

15 years agoMake retr() and lretr() simpler and more robust
Markus Armbruster [Sat, 5 Jul 2008 03:47:55 +0000 (23:47 -0400)]
Make retr() and lretr() simpler and more robust

The old code recognized group retreat only when the first argument was
on the command line.  Didn't make a difference, because it was only
used when there were at least two arguments on the command line.

The old code relied on rflags being represented as two's complement.

When given an empty retreat path, the old code deleted the retreat
path and set the retreat flags normally.  The new code deletes both.
Neither is nice; it should perhaps keep the retreat path and only set
the flags.

15 years agoFix mapper to work with current code
Markus Armbruster [Fri, 4 Jul 2008 21:31:33 +0000 (17:31 -0400)]
Fix mapper to work with current code

4.2.0 broke over.awk.

15 years agoFix flying commands not to let planes do double duty as escorts
Markus Armbruster [Sat, 28 Jun 2008 15:24:43 +0000 (11:24 -0400)]
Fix flying commands not to let planes do double duty as escorts

Commit 7ca4f412 (v4.3.12) marked planes flying a sortie with
PLN_LAUNCHED, and made pln_arm() reject planes with that flag set.
This was designed to reject escorts that were already flying as
bombers.  It didn't work, because the test for PLN_LAUNCHED used a
stale copy of the plane created by pln_sel().  Fix by getting a fresh
copy.

The bug always existed, but the botched fix in commit 7ca4f412 made it
worse.  Before, ac_encounter() dropped escorts that were also bombers,
so the bug merely wasted plane fuel.  After, such planes were
effectively duplicated, and damage to one of them, usually the bomber,
was wiped out.  Abusable.

15 years agoFix seqno mismatch and use-after-free in shp_sweep()
Markus Armbruster [Sat, 28 Jun 2008 13:15:49 +0000 (09:15 -0400)]
Fix seqno mismatch and use-after-free in shp_sweep()

The code wrote the swept sector after calling shp_check_one_mines().
This failed to use up the mine that hit the minesweeper, and triggered
a seqno mismatch oops.

The code wrote the minesweeper after calling shp_check_one_mines().
This used freed memory when the minesweeper got sunk there.

Broken in 4.0.17.  Fix by moving both calls before
shp_check_one_mines().

15 years agoDon't let non-light units board ships that can't carry them
Markus Armbruster [Tue, 17 Jun 2008 18:16:27 +0000 (20:16 +0200)]
Don't let non-light units board ships that can't carry them

ask_olist() let non-light land units board ships that can carry only
light units.  If the board succeeds, the non-light unit move onto the
ship and then are stuck there.

15 years agoLimit BTU production to 1000 civilians instead of 999
Markus Armbruster [Sun, 15 Jun 2008 06:48:22 +0000 (08:48 +0200)]
Limit BTU production to 1000 civilians instead of 999

This makes the limit again equal maximum population of a capital
sector, which changed in commit 6bbd7ffd, v4.3.6.

15 years agoUpdate info BTU on Empire clock and work percentage
Markus Armbruster [Sun, 15 Jun 2008 06:45:15 +0000 (08:45 +0200)]
Update info BTU on Empire clock and work percentage

Work percentage should have been documented in commit 233fce87,
v4.3.0.

Empire clock should have been documented in commit d3e0597f, v4.3.10.

15 years agoUpdate info Citizens on census showing old owner
Markus Armbruster [Sun, 15 Jun 2008 05:38:18 +0000 (07:38 +0200)]
Update info Citizens on census showing old owner

This was forgotten in commit 6b434ee3, v4.3.0.

15 years agoMake spy command require sector military
Markus Armbruster [Sun, 15 Jun 2008 05:16:18 +0000 (07:16 +0200)]
Make spy command require sector military

Spies shot were only deduced from sector military; land units were
immune to losses; in fact they needn't have any military to spy.

Fix by requiring and using only sector military.  Closes #758483.

15 years agoLet spy report on unoccupied sectors
Markus Armbruster [Sat, 14 Jun 2008 17:13:30 +0000 (19:13 +0200)]
Let spy report on unoccupied sectors

Make spy() not skip sectors without civilians, military and land
units.  There could be other interesting things to report there:
efficiency, gold bars, planes...

15 years agoRemove columns lnd, pln from spy report to fix spy unit leak
Markus Armbruster [Sat, 14 Jun 2008 16:55:29 +0000 (18:55 +0200)]
Remove columns lnd, pln from spy report to fix spy unit leak

The values in these columns were computed by count_sect_units() and
count_sect_planes(), which included land units and planes in the count
that aren't shown by prunits() and prplanes(), namely own and embarked
units.  Confusing.  Moreover, count_sect_planes() and prunits() rolled
dice separately for spy units.  This could leak the presence of spies
even when prunits() didn't show them.

All fixable, but not worth the trouble; just remove the counts.

15 years agoSimplify prunits() and prplanes()
Markus Armbruster [Sat, 14 Jun 2008 16:28:44 +0000 (18:28 +0200)]
Simplify prunits() and prplanes()

Drop redundant conditional.  No functional change.

15 years agoNew player_relstr(), factored out out of prunits() and prplanes()
Markus Armbruster [Sat, 14 Jun 2008 16:20:48 +0000 (18:20 +0200)]
New player_relstr(), factored out out of prunits() and prplanes()

No functional change.

15 years agoHave the complete spy report code in one place
Markus Armbruster [Sat, 14 Jun 2008 16:07:01 +0000 (18:07 +0200)]
Have the complete spy report code in one place

Move prunits() and prplanes() from spyline()'s caller into spyline().
Rename spyline() to spy_report().  No functional change.