empserver/src/lib/commands
Markus Armbruster 3de1e8be28 Avoid false positive generation oops in navigate and march
Commit e3cf1e32 (v4.3.27) created make_stale_if_command_arg() to
permit catching more potential yields on input.  Unfortunately, the
implementation of navigate and march sub-commands 'r', 'l' and 's'
breaks it.

do_unit_move() reads units into a unit list at the beginning and at
each stop.  It writes them back when they move or sweep.  If a unit
changed in the file in between, the changes would get wiped out.
Therefore, do_unit_move() must not yield between stops.

do_unit_move() parses sub-commands into player->argp[], then supplies
defaults for missing arguments, so that code using them (radar(),
do_look(), sona(), mine(), landmine()) won't prompt for missing
arguments.  Unclean and brittle.  See also commit 28cc236e and commit
45106ab9.

Unfortunately, make_stale_if_command_arg() doesn't recognize the
difference between these defaulted arguments and parsed arguments, so
it makes objects stale, even though the defaulted arguments can't be
missing.  If a move or sweep follows, it triggers a false positive
generation oops.

To fix, test "points into argument buffer" (only true for parsed
arguments) instead of "is in player->argp[]".  Requires making the
argument buffer accessible: new struct player member argbuf[].  Use it
for parsing commands, in command(), execute(), do_unit_move().  Don't
use it in emp_config(), player_login(), move_ground(), because these
parse something else.
2011-07-09 15:16:21 +02:00
..
acce.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
add.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
anti.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
arm.c Update known contributors comments 2011-04-14 20:21:23 +02:00
army.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
assa.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
atta.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
bdes.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
best.c Clean up path finding in best() 2011-04-12 21:51:32 +02:00
boar.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
bomb.c Remove p_mode, use MOB_FLY and MOB_SAIL instead 2011-04-12 21:51:32 +02:00
brea.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
budg.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
buil.c Remove option LANDSPIES, customize table land-chr instead 2011-06-25 16:53:02 +02:00
buy.c Fix buy not to wipe out concurrent updates 2011-04-17 17:48:18 +02:00
capi.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
carg.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
cens.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
chan.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
coas.c Update known contributors comments 2011-04-14 20:21:23 +02:00
coll.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
comm.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
cons.c Use SECS_PER_DAY instead of literal 86400 2011-04-17 17:48:18 +02:00
conv.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
coun.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
cuto.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
decl.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
deli.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
demo.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
desi.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
disa.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
dist.c Use path_find() directly where only cost is needed 2011-04-12 21:51:31 +02:00
drop.c Remove p_mode, use MOB_FLY and MOB_SAIL instead 2011-04-12 21:51:32 +02:00
dump.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
echo.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
edit.c Remove edit keys deprecated in 4.3.15, 4.3.17 and 4.3.20 2011-04-14 20:21:23 +02:00
enab.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
enli.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
expl.c Clean up move_ground()'s parsing of DIR_MAP 2011-04-14 20:21:23 +02:00
fina.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
flash.c Update known contributors comments 2011-04-14 20:21:23 +02:00
flee.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
fly.c Remove p_mode, use MOB_FLY and MOB_SAIL instead 2011-04-12 21:51:32 +02:00
foll.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
forc.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
fort.c Update known contributors comments 2011-04-14 20:21:23 +02:00
give.c Fix give not to wipe out concurrect updates 2011-04-14 20:21:23 +02:00
grin.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
hard.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
head.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
improve.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
info.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
land.c Belatedly clean up after commit 3b4de2fe Remove option FUEL 2011-04-23 07:04:42 +02:00
laun.c Update known contributors comments 2011-04-14 20:21:23 +02:00
lboard.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
ldump.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
ledg.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
leve.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
load.c Remove option LANDSPIES, customize table land-chr instead 2011-06-25 16:53:02 +02:00
look.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
lost.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
lstat.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
lten.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
map.c Simplify map(): use getstarg() instead of getstring() 2011-04-14 20:21:23 +02:00
marc.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
mark.c Clean up mark()'s test for its optional argument 2011-04-17 17:52:31 +02:00
mfir.c Update known contributors comments 2011-04-14 20:21:23 +02:00
mine.c Update known contributors comments 2011-04-14 20:21:23 +02:00
miss.c Rename obj_nameof() to unit_nameof() and move to unitsub.c 2011-06-25 16:50:20 +02:00
mobq.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
mora.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
move.c Clean up move_ground()'s parsing of DIR_MAP 2011-04-14 20:21:23 +02:00
name.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
nati.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
navi.c Avoid false positive generation oops in navigate and march 2011-07-09 15:16:21 +02:00
ndump.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
new.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
newe.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
news.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
nuke.c Update known contributors comments 2011-04-14 20:21:23 +02:00
offe.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
orde.c Remove option TRADESHIPS, customize table ship-chr instead 2011-06-25 16:52:08 +02:00
orig.c Update known contributors comments 2011-04-14 20:21:23 +02:00
para.c Remove p_mode, use MOB_FLY and MOB_SAIL instead 2011-04-12 21:51:32 +02:00
path.c Clean up path finding in path() 2011-04-12 21:51:32 +02:00
payo.c Remove option TRADESHIPS, customize table ship-chr instead 2011-06-25 16:52:08 +02:00
pboa.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
pdump.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
peek.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
plan.c Update known contributors comments 2011-04-14 20:21:23 +02:00
play.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
powe.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
prod.c Update known contributors comments 2011-04-14 20:21:23 +02:00
pstat.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
rada.c Rename obj_nameof() to unit_nameof() and move to unitsub.c 2011-06-25 16:50:20 +02:00
rang.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
rea.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
real.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
reco.c Remove p_mode, use MOB_FLY and MOB_SAIL instead 2011-04-12 21:51:32 +02:00
reje.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
rela.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
relo.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
repa.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
repo.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
rese.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
reso.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
retr.c Update known contributors comments 2011-04-14 20:21:23 +02:00
rout.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
sabo.c Update known contributors comments 2011-04-14 20:21:23 +02:00
sail.c Remove p_mode, use MOB_FLY and MOB_SAIL instead 2011-04-12 21:51:32 +02:00
sate.c Fix satellite to fail on bad conditional 2011-04-14 20:21:21 +02:00
scra.c Remove option TRADESHIPS, customize table ship-chr instead 2011-06-25 16:52:08 +02:00
scut.c Remove option TRADESHIPS, customize table ship-chr instead 2011-06-25 16:52:08 +02:00
sdump.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
sect.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
sell.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
set.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
setres.c Fix setsector and setres not to wipe out concurrent updates 2011-04-17 10:47:57 +02:00
setsect.c Fix setsector and setres not to wipe out concurrent updates 2011-04-17 10:47:57 +02:00
shar.c Move function declarations for maps.c from prototypes.h to map.h 2011-04-14 20:21:22 +02:00
shark.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
shi.c Belatedly clean up after commit 3b4de2fe Remove option FUEL 2011-04-23 07:04:42 +02:00
shoo.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
show.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
shut.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
sinf.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
skyw.c Update known contributors comments 2011-04-14 20:21:23 +02:00
sona.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
spy.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
sstat.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
stop.c Update known contributors comments 2011-04-14 20:21:23 +02:00
stre.c Update known contributors comments 2011-04-14 20:21:23 +02:00
strv.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
supp.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
surv.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
swap.c Update known contributors comments 2011-04-14 20:21:23 +02:00
tele.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
tend.c Update known contributors comments 2011-04-14 20:21:23 +02:00
terr.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
thre.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
togg.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
torp.c Update known contributors comments 2011-04-14 20:21:23 +02:00
trad.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
tran.c Clean up move_ground()'s parsing of DIR_MAP 2011-04-14 20:21:23 +02:00
trea.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
turn.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
upda.c Update known contributors comments 2011-04-14 20:21:23 +02:00
upgr.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
vers.c Remove option TRADESHIPS, customize table ship-chr instead 2011-06-25 16:52:08 +02:00
wing.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
wipe.c License upgrade to GPL version 3 or later 2011-04-12 21:20:58 +02:00
work.c Update known contributors comments 2011-04-14 20:21:23 +02:00
xdump.c Verify table uid sanity more tightly 2011-06-25 16:54:29 +02:00
zdon.c Update known contributors comments 2011-04-14 20:21:23 +02:00