Commit graph

3148 commits

Author SHA1 Message Date
3a9545fe99 Remove redundant and misleading stuff from info bomb 2008-08-02 17:17:08 -04:00
b7c7fa00e1 Fix capital maintenance to charge at 60% efficiency
produce_sect() started to charge at 61%.  Has always been that way.
2008-08-02 15:46:35 -04:00
def5ef11ff Make launch command require only 40% plane efficiency
This is to make it consistent with automatic missile launch.
2008-08-02 15:03:44 -04:00
132b20434d 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().
2008-08-02 14:44:54 -04:00
24aaec7e34 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.
2008-08-02 12:04:06 -04:00
1d9aac2cf9 Add gcc attribute format where it's missing 2008-08-02 12:00:33 -04:00
eb252201b6 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.
2008-08-01 08:50:24 -04:00
e58be3179a Remove product information from show sect c
New show product made this redundant.
2008-07-28 07:52:32 -04:00
acf7f6c1ce Always print header in show_sect_stats() and show_sect_capab()
Simpler, and empty tables are highly unlikely anyway.
2008-07-28 07:52:32 -04:00
71bbd642df 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.
2008-07-28 07:51:49 -04:00
ae8c4620b0 Show sector navigability in show se s
This is the human-readable buddy of xdump sect-chr column nav, which
dumps ichr[].d_nav.
2008-07-27 21:04:44 -04:00
4be4a37a96 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".
2008-07-27 21:04:44 -04:00
7d37e41527 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.
2008-07-27 21:04:26 -04:00
a80489de39 Update coding guidelines: oops, get/put, reading player input 2008-07-27 12:02:34 -04:00
8e9cbf4ab1 Document when emp_client signals EOF and interrupt 2008-07-27 12:00:51 -04:00
3cc8de8aef 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.
2008-07-26 21:36:37 -04:00
9f4ce71a54 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.
2008-07-26 21:13:09 -04:00
648ea5900b 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.
2008-07-26 19:50:09 -04:00
d3f644a37f New get_planes(), factored out of plane flying commands
No functional change.
2008-07-26 15:01:45 -04:00
3eb58312b3 Fix interdiction to obey op-area for missiles
Never worked correctly.  Reported by Gregory E. Garland.
2008-07-25 08:40:01 -04:00
d72f9936db 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.
2008-07-25 08:34:35 -04:00
88339ae77e Fix xdump.pl reference in doc/xdump 2008-07-25 08:16:38 -04:00
7d529769de Simplify best() and torp()
Use snxtsct_rewind() instead of snxtsct(), and snxtitem_rewind()
instead of snxtitem().
2008-07-25 08:16:38 -04:00
90ba9608cb Fix parse() not to filter out tab from quoted arguments
Broken in commit 2cc44bb1, v4.2.21.
2008-07-25 08:16:38 -04:00
022b73d8a1 Simplify preport()
Return value of ctime() always starts with a capital letter, so
upcasing it is pointless.
2008-07-25 08:16:38 -04:00
bd34378900 Clean up how snxtitem() parses country names
Old code didn't check for natarg() failure, but relied on
sarg_type("-1") returning NS_UNDEF.
2008-07-25 08:16:38 -04:00
fc00db8f5d Make shutdown command fail when there's no shutdown to cancel
Before, it printed "Shutdown sequence begun", which was bogus.
2008-07-25 08:16:38 -04:00
797f9b121e 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.
2008-07-25 08:16:38 -04:00
7e80101fac 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.
2008-07-25 08:16:38 -04:00
c7426e1b45 Swap zdone's deity arguments
This puts the additional deity argument last.

Deity syntax wasn't documented before.
2008-07-25 08:16:38 -04:00
8fa45735db Make zdone accept country names
Use natarg() so that country names work.  Simplify control flow.
2008-07-25 08:16:38 -04:00
9031b03b56 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.
2008-07-25 08:16:29 -04:00
3c25ebd927 Simplify att_prompt() 2008-07-21 08:13:40 -04:00
0b0612ea04 Simplify getpath() 2008-07-21 08:13:40 -04:00
052d514bfe Simplify getele()
No need to check player->aborted(), checking value of uprmptrd()
suffices.
2008-07-21 08:13:40 -04:00
05364c0f68 Avoid cryptic message when survey's first argument is empty
Catch empty argument instead of letting nstr_comp_val() choke on it.
2008-07-21 08:13:40 -04:00
4646dfbf80 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.
2008-07-21 08:13:40 -04:00
da59e02706 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.
2008-07-21 08:13:40 -04:00
03937d6c58 Fix cede not prompt twice for its first argument 2008-07-21 08:13:40 -04:00
be41e70fa8 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
2008-07-21 08:13:40 -04:00
a7cf69af50 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.
2008-07-21 08:13:40 -04:00
d000bf9296 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.
2008-07-21 08:13:31 -04:00
90a4864c17 Fix bdes not to gripe about empty desig input 2008-07-21 08:13:20 -04:00
e031a8a052 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.
2008-07-21 07:52:35 -04:00
7bbd3fcd89 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.
2008-07-21 07:50:13 -04:00
2fa522588a Simplify pin_bomb() aborting at "Bomb what" prompt 2008-07-21 07:25:16 -04:00
9eda5f87b8 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
2008-07-21 07:19:18 -04:00
b3a7a8ee11 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.
2008-07-15 06:35:56 -04:00
9c5854c8c9 Simplify breaking of command loop
Change status() to check player->eof instead of io_error() and
io_eof().  Ignore value of command().
2008-07-15 06:25:29 -04:00
b7153d095c Change recvclient() to treat io_error() like io_eof()
This is for consistency with status() and player_login().
2008-07-15 06:25:18 -04:00