Commit graph

4061 commits

Author SHA1 Message Date
10f6ffde62 Fix map drawing commands to report bad unit arguments
Before, they failed without explanation when they interpreted the
argument as unit number, but the player didn't own that unit.
2011-04-14 20:21:22 +02:00
d3004510c8 Change unit_map() not to use RET_OK and RET_FAIL as return values
Returning 0 and -1 is simpler.
2011-04-14 20:21:22 +02:00
a00f9e200e Clean up bmap commands' flags argument
parse_map_flags() silently truncates map flags after the first 't' or
'r'.  This makes it accept arguments "true" and "revert".  However, it
also breaks the perfectly sensible argument "ts", which should show
ships just like "st", but doesn't.

info bmap & friends document arguments "true" and "revert", and also
suggest flags 't' and 'r'.  What a mess.

Make argument "revert" a special case.  Deprecate flag 'r', and clean
up truncation there.

Don't truncate after flag 't'.  If any bad flags follow, ignore
everything after 't', but deprecate that usage.
2011-04-14 20:21:22 +02:00
457f797972 Factor parse_map_flags() out of do_map() 2011-04-14 20:21:22 +02:00
5da60a5abb Fold draw_map() parameter bmap into map_flags
No functional change.
2011-04-14 20:21:22 +02:00
a4c5d05fe1 Tweak info on movement commands' map drawing sub-commands 2011-04-14 20:21:22 +02:00
35127accb5 Fail map drawing command when player doesn't confirm bmap revert
Doesn't affect mapping at movement prompts (navigate, march, move,
test and transport), because the failure is ignored there.
2011-04-14 20:21:22 +02:00
33ac27777a Don't show a map on bmap revert
Before, it showed a map, but only when the player confirmed the
revert.
2011-04-14 20:21:22 +02:00
6b498f3908 Clean up map info pages a bit
Drop .SY for map commands other than the one documented by the info
page.

Use the page's command to discuss arguments "revert" and "true", not
"bmap".

Clarify flags argument.
2011-04-14 20:21:22 +02:00
5230ea8de4 Drop useless checks for player->aborted in draw_map()
player->aborted gets set when we get an interrupt or EOF cookie from
the player, when update or shutdown abort commands, and when we abort
an attack (not relevant here).

The checks are useless: player interrupt and EOF are checked
elsewhere, and update/shutdown can run only when we yield the
processor, which we never do (output doesn't yield because C_MOD is
set).
2011-04-14 20:21:22 +02:00
2f86e79e80 Drop potentially misleading build and radar error messages
buil() complains about the argument when snxtsct() fails.  Misleading
when the argument is fine, but snxtsct() fails due to bad conditional
argument.

Same for radar() with snxtitem().
2011-04-14 20:21:22 +02:00
4dfb84086a Remove disabled command cede
It misuses snxtsct() and snxtitem() to find out whether the first
argument looks like sectors or like ships, which doesn't work with a
bad conditional argument.

Not worth fixing now; it's been disabled since 4.0.1, and broken at
least since commit 2fc1e74a (v4.3.0) broke its sector/ship
disambiguation via third argument.
2011-04-14 20:21:22 +02:00
16daa4007c Fix do_map()'s misuse of snxtsct() for testing argument syntax
It assumes snxtsct() fails only when the argument can't be parsed.  It
can also fail when the condition argument has errors.  `map # ?xxx'
first complains about xxx, then maps around ship#0.  Broken since
Chainsaw 2 introduced smap, pmap and lmap.

Use sarg_type() to recognize sectors vs. unit argument.  `map # ?xxx'
now fails as it should.

Subtle side effect: do_map() no longer prompts for argument "",
because snxtsct() is now guarded by sarg_type().  Impact on callers:

* display_region_map() is not affected, because it never passes "".

* map() passes on "" arguments.  Change it to prompt in that case.
  Consistent with how other commands behave.  No functional change.

* do_unit_move() passes on "" arguments.  Keep it that way.  This
  changes navigate and march sub-commands 'M' and 'B' not to prompt
  for "" arguments, which is consistent with sub-command 'm' of move,
  test and transport.
2011-04-14 20:21:22 +02:00
baee0744ff Make map drawing commands fail on bad flags
Also affects mapping at movement prompts of navigate, march, move,
test, transport.
2011-04-14 20:21:22 +02:00
d78df0b48b Move function declarations for maps.c from prototypes.h to map.h 2011-04-14 20:21:22 +02:00
8dc69a9a84 Move map flags from map.h to maps.c, and reorder
Not useful elsewhere.  Since I'm touching them anyway, put them in the
usual ship, plane, land, nuke order.
2011-04-14 20:21:21 +02:00
0f0b5605e9 Remove misleading comment on MAP_PLANE & friends
ef_unit_list doesn't exist.  Order doesn't matter, priority is defined
by draw_map()'s ef_unit_map[].

This reverts commit 9e75e5e009.
2011-04-14 20:21:21 +02:00
78b3af20fe Drop "xdump ver" deprecated in 4.3.12 2011-04-14 20:21:21 +02:00
1ffea04a6d info xdump still has long gone pseudo-table ver, remove
Missed in commit da8a1dae, v4.3.12
2011-04-14 20:21:21 +02:00
af5e25aa16 Move xdmeta() back to commands/xdump.c, internal linkage
Partially revert commit 4c746b5e.
2011-04-14 20:21:21 +02:00
6db74cd282 Simplify satmap() with snxtitem_use_condarg(), snxtsct_use_condarg() 2011-04-14 20:21:21 +02:00
7de511fb66 Factor snxtsct_use_condarg() out of snxtsct() 2011-04-14 20:21:21 +02:00
84072cff5d Factor snxtitem_use_condarg() out of snxtitem() 2011-04-14 20:21:21 +02:00
74a69cf74c Fix satellite to fail on bad conditional
snxtsct() and snxtitem() fail when the condition argument is bad.
satmap() didn't check for failure.  Due to the way snxtsct() and
snxtitem() work, bad condition arguments were reported and otherwise
ignored.
2011-04-14 20:21:21 +02:00
d0a6dffa02 Collect nstr_item, nstr_sect function declarations in nsc.h
Moved from prototypes.h.
2011-04-14 20:21:21 +02:00
40b6032a5d Move xysize_range(), xydist_range() to xy.c and xy.h
Moved from snxtsct.c and prototypes.h next to the other struct range
functions.
2011-04-14 20:21:21 +02:00
e7d7cfdc10 Fix journal.c boilerplate comment 2011-04-14 20:21:21 +02:00
4785662587 New journal event "output"
Redundant information, but incredibly useful when you want to figure
out what happened without a (still nonexistent) journal replay tool.
The redundancy could help making a journal replay tool more robust.

To enable, set econfig key keep_journal to at least 2.  Output events
are *not* flushed to disk immediately.
2011-04-14 20:21:21 +02:00
f04d1ae032 Fix journal not to truncate long lines
Could happen only for input events.
2011-04-14 20:21:21 +02:00
27212dc46b Escape '\\' in journal, but not '\t' 2011-04-14 20:15:19 +02:00
a7be765ed4 Journal login phase input, too 2011-04-14 19:58:49 +02:00
72d051310c New journal event "command"
Redundant information.  Allows making sense of input without context.
The redundancy could help making a journal replay tool more robust.
2011-04-14 19:46:05 +02:00
9be4f57ad5 Clean up superfluous include of queue.h in land.h, ship.h 2011-04-14 19:46:05 +02:00
157ae8ec21 Clean up superfluous include of nsc.h in prototypes.h 2011-04-14 19:46:05 +02:00
a2386edc01 Clean up superfluous include of news.h in empobj.h
Missed in commit 0ba61f17, v4.3.24.
2011-04-14 19:46:05 +02:00
44db545344 Disable BRIDGETOWERS by default
A deity can easily break BRIDGETOWERS by reducing etu_per_update
without compensating customization of buil_tower_bh,
rollover_avail_max or bridge span maxpop.

Document the issue in output of pconfig (which is installed as
$prefix/etc/empire/econfig).

To increase the chance deities actually read the documentation,
disable BRIDGETOWERS.
2011-04-12 21:51:32 +02:00
11ab95411e Reduce bridge tower materials from 400 to 300 hcms.
Bridge spans have been unable to produce enough avail for a tower with
default game configuration since we reduced their maximum population
in commit 6bbd7ffd, v4.3.6.  This commit reduces required avail from
160 to 120, fixing the stock game: 100 civilians and 100 uws can make
that much in a 60 ETU update.
2011-04-12 21:51:32 +02:00
a12a315cd9 Fix stop orders to expire even when the country is broke
Broken in commit 8da88626, v4.3.8.
2011-04-12 21:51:32 +02:00
d6cf175b0b Fix march and navigate not to interpret coordinates as path
Destination arguments can be a path or sector coordinates.
do_unit_move() passes the argument buffer to unit_path() to convert
coordinates to a path.  If unit_path() fails, do_unit_move() still
interprets the argument as path.

This is correct when unit_path() fails because the argument is not
coordinates.  But it can also fail when it is coordinates, namely when
the destination isn't reachable, when the path to it is too long, or
when the ships or land units aren't together.  Then do_unit_move()
interprets coordinates as path, and rejects them with "Legal
directions are:".

Except when a land unit's destination read from a march prompt isn't
reachable, because then unit_path() empties the argument buffer that
do_unit_move() uses.

Change unit_path() to succeed when the argument is not coordinates.
Make do_unit_move() discard the argument when unit_path() fails,
i.e. when it is bad coordinates.  unit_path() emptying the argument no
longer has an effect, drop it.
2011-04-12 21:51:32 +02:00
74b08563af Clean up path finding in perform_mission_bomb()
Support missions up to 1023 sectors away from the airfield, up from
99.

Don't bother to call mapdist() for distance to target, just use the
path length.
2011-04-12 21:51:32 +02:00
8d23975299 Clean up path finding in nav_ship()
Destinations are no longer treated as unreachable when the best path
is longer than 99 characters.  Instead, consider up to 1023 characters
of the best path.
2011-04-12 21:51:32 +02:00
404a76f79e Clean up path finding in getpath()
Don't claim the destination sector is unreachable when the best path
is longer than 99 characters or the complete path is longer than 1023
characters.  Instead, report that the path is too long when the total
path is longer than 1023 characters.
2011-04-12 21:51:32 +02:00
182d62deed Remove p_mode, use MOB_FLY and MOB_SAIL instead 2011-04-12 21:51:32 +02:00
8f008bf849 Clean up path finding in unit_sub()
Don't claim the destination sector is unreachable when the best path
is longer than 1023 characters for land units or 99 characters for
ships.  Instead, report that the path is too long.  Up the limit for
ships to 1023 characters.
2011-04-12 21:51:32 +02:00
dac2c95dd5 Clean up path finding in move_ground()
Don't claim the destination sector is unreachable when the best path
is longer than 1023 characters.  Instead, report that the path is too
long.
2011-04-12 21:51:32 +02:00
b73a3f52e5 Clean up path finding in path()
Don't claim the destination sector is unreachable when the best path
is longer than 1023 characters.  Instead, report that the path is too
long.
2011-04-12 21:51:32 +02:00
a34517a3f5 Clean up path finding in best()
Handle paths longer than 1023 characters sensibly: show them with
"..." appended.
2011-04-12 21:51:32 +02:00
e450c31ddb Inline BestShipPath(), BestAirPath() glue
Following commits will simplify the resulting code.
2011-04-12 21:51:32 +02:00
92e64d7638 Inline BestLandPath(), BestDistPath() glue
Following commits will simplify the resulting code.
2011-04-12 21:51:32 +02:00
957a6a74df Use path_find() directly in sorde()
Don't compute the distance from the path, use the path cost.  The
actual path is no longer needed, and we can use path_find() instead of
BestShipPath().

Destinations are no longer treated as unreachable when the best path
is longer than 1023 characters.
2011-04-12 21:51:32 +02:00