empserver/src/lib/commands
Markus Armbruster 4366c5ac6e Selector rewrite: values other than long, interpret identifiers
according to context, to make `lstat * ?type#spy&spy>1' work.  Closes
bug#825363, #905809, #905814 and #922968.
(nsc_type, packed_nsc_type, nsc_cat, packed_nsc_cat, nsc_flags): New.
(valstr): New.  Old code encoded values in type long, which was
somewhat hard to read and could only support signed integer values.
(nscstr): Redesign.  Use valstr.  Typed operator.
(castr): Split ca_code into ca_type, ca_flags, ca_off.  Tables
changed.
(nstr_comp, nstr_exec): Redesign and rewrite.  Callers changed.  They
used the old design incorrectly, which let players smash the stack
by supplying more than NCOND conditions.
(encode, nstr_comp_val, decode, nstr_exec_val): Rename, redesign, and
rewrite.  Callers changed.
(nstr_coerce_val): New.
(var_ca, sect_ca, ship_ca, land_ca): Checking both var_ca[] and the
object's ca complicates proper recognition of unique abbreviations.
Copy contents of var_ca[] into the ca of objects, remove var_ca[].

(surv): Reject values with category other than NSC_OFF and types that
can't be coerced to NSC_LONG.  Old code happily passed values with
category NSC_VAL to code_char().  The previous version interpreted
them correctly, but earlier versions interpreted them as NSC_OFF, then
logged `bad type in decode: 0' and evaluated them into zero.

(code_char): Used to test category NSC_VAR to decide whether to
display tens or hundreds.  NSC_VAR no longer exists.  Test type
instead.  Makes more sense anyway.
2004-04-02 19:02:12 +00:00
..
.cvsignore List generated files and directories that CVS doesn't ignore by 2003-10-04 14:54:09 +00:00
acce.c Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
add.c (sctstr): Member sct_che encoded number of che and their target. 2004-03-04 13:49:25 +00:00
anti.c (sctstr): Member sct_che encoded number of che and their target. 2004-03-04 13:49:25 +00:00
arm.c <string.h> is ISO C, no need to #if it. 2004-02-19 10:05:53 +00:00
army.c (bzero, bcopy): Obsolete BSDisms; remove. Remove some calls without 2004-01-08 17:54:28 +00:00
assa.c Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
atta.c Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
bdes.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
best.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
boar.c Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
bomb.c Replace getvec() by direct, read-only item access in some cases where 2004-03-05 10:38:58 +00:00
brea.c Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
budg.c Use gcc function attribute `format' to catch bad format strings. Fix 2004-03-09 12:27:40 +00:00
buil.c (buil): Work directly on item arrays instead of copies made by 2004-03-09 14:52:21 +00:00
buy.c (buy, move, prod, dodistribute, produce): Obey ITEM_MAX. Previous 2004-03-16 18:56:14 +00:00
capi.c Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
carg.c Replace getvec() by direct, read-only item access in some cases where 2004-03-05 10:38:58 +00:00
cede.c Remove unused variables and such. No functional changes. 2004-03-11 22:10:19 +00:00
cens.c Replace getvec() by direct, read-only item access in some cases where 2004-03-05 10:38:58 +00:00
chan.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
coas.c Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
coll.c Sectors need space for items, deliveries and distribution thresholds. 2004-03-03 16:54:22 +00:00
comm.c Replace getvec() by direct, read-only item access in some cases where 2004-03-05 10:38:58 +00:00
cons.c Use gcc function attribute `format' to catch bad format strings. Fix 2004-03-09 12:27:40 +00:00
conv.c Sectors need space for items, deliveries and distribution thresholds. 2004-03-03 16:54:22 +00:00
coun.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
cuto.c Sectors need space for items, deliveries and distribution thresholds. 2004-03-03 16:54:22 +00:00
decl.c Indentation fixes; suspect indent-emp is to blame. 2004-02-28 18:06:11 +00:00
deli.c (deli, do_demo, lnd_sweep, guerrilla): Saturate items at ITEM_MAX. 2004-03-05 06:48:57 +00:00
demo.c Use gcc function attribute `format' to catch bad format strings. Fix 2004-03-09 12:27:40 +00:00
desi.c (sct_typematch): New. Use it instead of typematch() where 2004-02-27 19:53:02 +00:00
disa.c Declare all configuration parameters in optlist.h. Remove some 2004-02-19 16:46:18 +00:00
dist.c Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
drop.c Indentation fixes; suspect indent-emp is to blame. 2004-02-28 18:06:11 +00:00
dump.c Use gcc function attribute `format' to catch bad format strings. Fix 2004-03-09 12:27:40 +00:00
echo.c Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
edit.c Use gcc function attribute `format' to catch bad format strings. Fix 2004-03-09 12:27:40 +00:00
enab.c Declare all configuration parameters in optlist.h. Remove some 2004-02-19 16:46:18 +00:00
enli.c Use gcc function attribute `format' to catch bad format strings. Fix 2004-03-09 12:27:40 +00:00
expl.c (opt_NEWPOWER, Options, gen_power): Remove nooption NEWPOWER. 2004-03-11 10:36:55 +00:00
fina.c Use gcc function attribute `format' to catch bad format strings. Fix 2004-03-09 12:27:40 +00:00
flash.c POSIX has all we need in <time.h>. No need to fool around with 2004-02-19 09:57:25 +00:00
flee.c (bzero, bcopy): Obsolete BSDisms; remove. Remove some calls without 2004-01-08 17:54:28 +00:00
fly.c Indentation fixes; suspect indent-emp is to blame. 2004-02-28 18:06:11 +00:00
foll.c Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
forc.c New server.h for server startup, control and shutdown, i.e. stuff in 2004-02-19 19:02:30 +00:00
fort.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
fuel.c Sectors need space for items, deliveries and distribution thresholds. 2004-03-03 16:54:22 +00:00
give.c (ITEM_MAX): New, value 9999. 2004-03-05 06:34:34 +00:00
grin.c (grin): Stop grinding before grind puts more than ITEM_MAX bar 2004-03-09 19:31:30 +00:00
hard.c Sectors need space for items, deliveries and distribution thresholds. 2004-03-03 16:54:22 +00:00
head.c Indentation fix. 2004-02-06 23:26:25 +00:00
hidd.c (sctstr): Member sct_che encoded number of che and their target. 2004-03-04 13:49:25 +00:00
improve.c (improve, shoo, spy, buildeff): Work directly on item arrays instead 2004-03-09 19:26:02 +00:00
info.c Use gcc function attribute `format' to catch bad format strings. Fix 2004-03-09 12:27:40 +00:00
land.c Replace getvec() by direct, read-only item access in some cases where 2004-03-05 10:38:58 +00:00
laun.c Indentation fixes; suspect indent-emp is to blame. 2004-02-28 18:06:11 +00:00
lboard.c Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
ldump.c Use gcc function attribute `format' to catch bad format strings. Fix 2004-03-09 12:27:40 +00:00
ledg.c Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
leve.c Sectors need space for items, deliveries and distribution thresholds. 2004-03-03 16:54:22 +00:00
load.c (ITEM_MAX): New, value 9999. 2004-03-05 06:34:34 +00:00
look.c Sectors need space for items, deliveries and distribution thresholds. 2004-03-03 16:54:22 +00:00
lost.c Use gcc function attribute `format' to catch bad format strings. Fix 2004-03-09 12:27:40 +00:00
lstat.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
lten.c Sectors need space for items, deliveries and distribution thresholds. 2004-03-03 16:54:22 +00:00
Makefile (diss, player_coms): Command `dissolve' has been disabled at least 2004-03-03 08:20:45 +00:00
map.c (map): Reject flags t' and r' unless it's a bmap command. Both used 2004-02-03 17:24:05 +00:00
marc.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
mark.c (genitem, ship, plane, land): Remove unused member sell & equivalents. 2004-03-01 17:21:40 +00:00
mfir.c (quiet_bigdef): Work directly on item arrays instead of copies made by 2004-03-10 12:52:24 +00:00
mine.c (MINES_MAX): New. 2004-03-04 15:54:46 +00:00
miss.c (nameofitem, produce, check, fire_dchrg, send_reacting_units_home, 2004-03-03 09:39:50 +00:00
mobq.c Declare all configuration variables in optlist.h. Include that 2004-02-17 22:58:04 +00:00
mobu.c (mobupdate): Fix argument of time(). 2004-03-09 12:33:17 +00:00
mora.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
move.c (buy, move, prod, dodistribute, produce): Obey ITEM_MAX. Previous 2004-03-16 18:56:14 +00:00
name.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
nati.c Use gcc function attribute `format' to catch bad format strings. Fix 2004-03-09 12:27:40 +00:00
navi.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
ndump.c Use gcc function attribute `format' to catch bad format strings. Fix 2004-03-09 12:27:40 +00:00
new.c Replace getvec() by direct, read-only item access in some cases where 2004-03-05 12:05:33 +00:00
newe.c Replace getvec() by direct, read-only item access in some cases where 2004-03-05 12:05:33 +00:00
news.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
nuke.c Replace getvec() by direct, read-only item access in some cases where 2004-03-05 10:38:58 +00:00
offe.c (copy, atopi, same): Remove, use strcpy(), atoi(), strcmp(). Callers 2004-01-08 10:20:44 +00:00
offs.c (index, rindex): Obsolete BSDisms; remove. Use standard strchr() and 2004-01-08 18:15:13 +00:00
orde.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
orig.c Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
para.c Indentation fixes; suspect indent-emp is to blame. 2004-02-28 18:06:11 +00:00
path.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
payo.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
pboa.c Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
pdump.c Use gcc function attribute `format' to catch bad format strings. Fix 2004-03-09 12:27:40 +00:00
plan.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
play.c (play_list): Cast time_t to long for printing. 2004-03-12 06:14:52 +00:00
powe.c (gen_power): Force mtime update under Windows. From Ron Koenderink. 2004-03-17 06:40:44 +00:00
prod.c (buy, move, prod, dodistribute, produce): Obey ITEM_MAX. Previous 2004-03-16 18:56:14 +00:00
pstat.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
rada.c Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
rang.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
rea.c (rea): Don't use L_SET, it's ancient BSD history, just use SEEK_SET. 2004-02-29 11:35:38 +00:00
real.c Indentation fixes; suspect indent-emp is to blame. 2004-02-28 18:06:11 +00:00
reco.c Indentation fixes; suspect indent-emp is to blame. 2004-02-28 18:06:11 +00:00
reje.c Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
rela.c Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
repa.c Use gcc function attribute `format' to catch bad format strings. Fix 2004-03-09 12:27:40 +00:00
repo.c (nameofitem, produce, check, fire_dchrg, send_reacting_units_home, 2004-03-03 09:39:50 +00:00
rese.c (ITEM_MAX): New, value 9999. 2004-03-05 06:34:34 +00:00
reso.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
retr.c Clean up switch cases: proper fall through comments, no break after 2004-03-01 14:03:29 +00:00
rout.c Selector rewrite: values other than long, interpret identifiers 2004-04-02 19:02:12 +00:00
sabo.c Replace getvec() by direct, read-only item access in some cases where 2004-03-05 10:38:58 +00:00
sail.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
sate.c Declare all configuration variables in optlist.h. Include that 2004-02-17 22:58:04 +00:00
scra.c (scra): Work directly on item arrays instead of copies made by 2004-03-09 19:32:43 +00:00
scut.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
sdump.c Use gcc function attribute `format' to catch bad format strings. Fix 2004-03-09 12:27:40 +00:00
sect.c Selector rewrite: values other than long, interpret identifiers 2004-04-02 19:02:12 +00:00
sell.c (sell): Simplify. 2004-03-11 22:12:49 +00:00
set.c Sectors need space for items, deliveries and distribution thresholds. 2004-03-03 16:54:22 +00:00
setres.c Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
setsect.c (MINES_MAX): New. 2004-03-04 15:54:46 +00:00
shar.c (sct_typematch): New. Use it instead of typematch() where 2004-02-27 19:53:02 +00:00
shark.c Use gcc function attribute `format' to catch bad format strings. Fix 2004-03-09 12:27:40 +00:00
shi.c Replace getvec() by direct, read-only item access in some cases where 2004-03-05 10:38:58 +00:00
shoo.c (improve, shoo, spy, buildeff): Work directly on item arrays instead 2004-03-09 19:26:02 +00:00
show.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
shut.c New server.h for server startup, control and shutdown, i.e. stuff in 2004-02-19 19:02:30 +00:00
sinf.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
skyw.c Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
sona.c Sectors need space for items, deliveries and distribution thresholds. 2004-03-03 16:54:22 +00:00
spy.c Remove unused variables and such. No functional changes. 2004-03-11 22:10:19 +00:00
sstat.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
star.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
stop.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
stre.c Sectors need space for items, deliveries and distribution thresholds. 2004-03-03 16:54:22 +00:00
strv.c (produce_sect): Unless player->simulation, work directly on item 2004-03-11 22:00:58 +00:00
supp.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
surv.c Selector rewrite: values other than long, interpret identifiers 2004-04-02 19:02:12 +00:00
swap.c Indentation fixes; suspect indent-emp is to blame. 2004-02-28 18:06:11 +00:00
tele.c Delete dead code, fix indentation, spelling, obvious warning 2004-02-27 20:13:28 +00:00
tend.c Selector rewrite: values other than long, interpret identifiers 2004-04-02 19:02:12 +00:00
terr.c Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
thre.c (ITEM_MAX): New, value 9999. 2004-03-05 06:34:34 +00:00
togg.c Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
torp.c Sectors need space for items, deliveries and distribution thresholds. 2004-03-03 16:54:22 +00:00
trad.c Use gcc function attribute `format' to catch bad format strings. Fix 2004-03-09 12:27:40 +00:00
tran.c Sectors need space for items, deliveries and distribution thresholds. 2004-03-03 16:54:22 +00:00
trea.c Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
turn.c Declare all configuration parameters in optlist.h. Remove some 2004-02-19 16:46:18 +00:00
upda.c New server.h for server startup, control and shutdown, i.e. stuff in 2004-02-19 19:02:30 +00:00
upgr.c Delete dead code, fix indentation, spelling, obvious warning 2004-02-27 20:13:28 +00:00
vers.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00
wai.c Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
wing.c Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
wipe.c Sectors need space for items, deliveries and distribution thresholds. 2004-03-03 16:54:22 +00:00
work.c Remove unused variables and such. No functional changes. 2004-03-11 22:10:19 +00:00
zdon.c deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00