Sectors need space for items, deliveries and distribution thresholds.

To save space, the ancients invented `variables': a collection of
key-value pairs, missing means zero value, space for `enough' keys.
This complicates the code, as assigning to a `variable' can fail for
lack of space.  Over time, `enough' increased, and for quite some time
now `variables' have been *wasting* space.  This changeset replaces
them, except in struct mchrstr, struct lchrstr and struct pchrstr,
where they are read-only, and will be replaced later.  It is only a
first step; further cleanup is required.  To simplify and minimize
this necessarily huge changeset, the new item[] arrays have an unused
slot 0, and the old variable types V_CIVIL, ... are still defined, but
must have the same values as the item types I_CIVIL, ...
This commit is contained in:
Markus Armbruster 2004-03-03 16:54:22 +00:00
parent ba86513b01
commit eccc5cb7d7
86 changed files with 853 additions and 1226 deletions

View file

@ -42,27 +42,13 @@
#define PLG_INCUBATE 3
#define PLG_EXPOSED 4
#define VT_ITEM (1<<5)
#define VT_COND (2<<5)
#define VT_DIST (3<<5)
#define VT_DEL (4<<5)
#define VT_SELL (5<<5)
#define VT_SPARE1 (6<<5)
#define VT_SPARE2 (7<<5)
#define VT_ITEM 0
#define VT_TYPE (7<<5)
#define isitem(x) (((x) & VT_TYPE) == VT_ITEM)
#define iscond(x) (((x) & VT_TYPE) == VT_COND)
#define isdist(x) (((x) & VT_TYPE) == VT_DIST)
#define isdel(x) (((x) & VT_TYPE) == VT_DEL)
#define issell(x) (((x) & VT_TYPE) == VT_SELL)
#define unitem(x) ((x) & (VT_ITEM -1))
#define V_ITEM(x) ((x)|VT_ITEM) /* a moveable, sellable(?) commodity */
#define V_COND(x) ((x)|VT_COND) /* condition (plg time, etc) */
#define V_DIST(x) ((x)|VT_DIST) /* distribution command */
#define V_DEL(x) ((x)|VT_DEL) /* delivery command */
#define V_SELL(x) ((x)|VT_SELL) /* make a sale */
#define I_CIVIL 1
#define I_MILIT 2
@ -80,20 +66,6 @@
#define I_RAD 14
#define I_MAX 14
#define C_MINE 1
#define C_PSTAGE 2
#define C_PTIME 3
#define C_REM 4
#define C_CHE 5
#define C_FALLOUT 6
#define V_MINE V_COND(C_MINE)
#define V_PSTAGE V_COND(C_PSTAGE)
#define V_PTIME V_COND(C_PTIME)
#define V_REM V_COND(C_REM)
#define V_CHE V_COND(C_CHE)
#define V_FALLOUT V_COND(C_FALLOUT)
/* should this be here?? */
#define CHE_MAX 255
#define get_che_cnum(x) ((x) >> 8)
@ -116,34 +88,4 @@
#define V_UW V_ITEM(I_UW)
#define V_RAD V_ITEM(I_RAD)
#define V_CDEL V_DEL(I_CIVIL)
#define V_MDEL V_DEL(I_MILIT)
#define V_SDEL V_DEL(I_SHELL)
#define V_GDEL V_DEL(I_GUN)
#define V_PDEL V_DEL(I_PETROL)
#define V_IDEL V_DEL(I_IRON)
#define V_DDEL V_DEL(I_DUST)
#define V_BDEL V_DEL(I_BAR)
#define V_FDEL V_DEL(I_FOOD)
#define V_ODEL V_DEL(I_OIL)
#define V_LDEL V_DEL(I_LCM)
#define V_HDEL V_DEL(I_HCM)
#define V_UDEL V_DEL(I_UW)
#define V_RDEL V_DEL(I_RAD)
#define V_CDIST V_DIST(I_CIVIL)
#define V_MDIST V_DIST(I_MILIT)
#define V_SDIST V_DIST(I_SHELL)
#define V_GDIST V_DIST(I_GUN)
#define V_PDIST V_DIST(I_PETROL)
#define V_IDIST V_DIST(I_IRON)
#define V_DDIST V_DIST(I_DUST)
#define V_BDIST V_DIST(I_BAR)
#define V_FDIST V_DIST(I_FOOD)
#define V_ODIST V_DIST(I_OIL)
#define V_LDIST V_DIST(I_LCM)
#define V_HDIST V_DIST(I_HCM)
#define V_UDIST V_DIST(I_UW)
#define V_RDIST V_DIST(I_RAD)
#endif /* _VAR_H_ */