Commit graph

3173 commits

Author SHA1 Message Date
fac3049bc2 Update change log again for 4.3.16 2008-08-09 12:10:06 -04:00
358de131f7 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.
2008-08-09 12:10:06 -04:00
a532c76428 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.
2008-08-09 12:09:50 -04:00
c7d2144154 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.
2008-08-09 09:03:03 -04:00
aee8272d3d Give some identifiers internal linkage
Give draw_map(), xdeval(), LwpSchedQ[], LwpDeadQ, LwpContextPtr,
LwpMaxpri, LwpStackGrowsDown internal linkage.
2008-08-09 08:40:04 -04:00
0a49cd24a3 Remove unused xdprval() 2008-08-09 08:40:04 -04:00
e628c50b21 Fix work not to claim an engineer worked when it didn't 2008-08-09 08:40:04 -04:00
063a7d9988 Fix work command to round mobility use randomly, not down 2008-08-09 08:40:04 -04:00
ab2893fa41 Fix work command not to spend more mobility than requested
Culprit is careless rounding in work().
2008-08-09 08:40:04 -04:00
3615cfc8ac Don't permit work command to spend more money than available
Stop work() when there's not enough money left for the current
engineer.
2008-08-09 08:40:04 -04:00
ede42fb9ce 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.
2008-08-09 08:40:04 -04:00
c20ac26ecc 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.
2008-08-09 08:40:04 -04:00
4b696a5c30 chkmoney() is no longer used, remove it 2008-08-09 08:40:04 -04:00
82c916654c 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().
2008-08-09 08:38:07 -04:00
cc4cf23273 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.
2008-08-09 08:34:00 -04:00
2434d2c8ee Change nav_ship() not to use RET_OK and RET_SYN as return values
These are only appropriate for commands and their helpers.
2008-08-03 12:18:14 -04:00
29aefc356f 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).
2008-08-03 11:34:00 -04:00
e803950463 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.
2008-08-03 10:25:48 -04:00
ed9da7cf06 Update known contributors comments 2008-08-03 08:04:08 -04:00
4ac09a3cd9 Update change log for 4.3.16 2008-08-02 21:29:48 -04:00
5c18d33e21 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.
2008-08-02 21:25:31 -04:00
278c3fe2d8 Simplify control flow in ship_bomb(), plane_bomb(), land_bomb()
No functional change.
2008-08-02 21:25:31 -04:00
fcb9c7f546 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'.
2008-08-02 21:23:07 -04:00
bc805ba81a 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().
2008-08-02 18:12:58 -04:00
6a95e67e4f 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.
2008-08-02 17:28:05 -04:00
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