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:
parent
ba86513b01
commit
eccc5cb7d7
86 changed files with 853 additions and 1226 deletions
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <struct.h>
|
||||
#include <stddef.h>
|
||||
#include "misc.h"
|
||||
#include "var.h"
|
||||
#include "xy.h"
|
||||
|
@ -56,45 +56,48 @@
|
|||
|
||||
struct empfile empfile[] = {
|
||||
{"sect", EMPDIR "/data/sector", EFF_COM | EFF_XY | EFF_OWNER,
|
||||
0, sizeof(struct sctstr),
|
||||
0, 0, 0, {fldoff(sctstr, sct_nv), fldoff(sctstr, sct_vtype[0]),
|
||||
fldoff(sctstr, sct_vamt[0])}, MAXSCTV,
|
||||
0, sizeof(struct sctstr), 0, 0, 0, offsetof(struct sctstr, sct_item),
|
||||
-1, -1, 0, 0, 0, 0, 0},
|
||||
{"ship", EMPDIR "/data/ship", EFF_COM | EFF_XY | EFF_OWNER | EFF_GROUP,
|
||||
0, sizeof(struct shpstr),
|
||||
0, 0, 0, {fldoff(shpstr, shp_nv), fldoff(shpstr, shp_vtype[0]),
|
||||
fldoff(shpstr, shp_vamt[0])}, MAXSHPV,
|
||||
0, sizeof(struct shpstr), 0, 0, 0, offsetof(struct shpstr, shp_item),
|
||||
-1, -1, 0, 0, 0, 0, 0},
|
||||
{"plane", EMPDIR "/data/plane", EFF_XY | EFF_OWNER | EFF_GROUP,
|
||||
0, sizeof(struct plnstr),
|
||||
0, 0, 0, {0, 0, 0}, 0, -1, -1, 0, 0, 0, 0, 0},
|
||||
{"land", EMPDIR "/data/land", EFF_COM | EFF_XY | EFF_OWNER | EFF_GROUP,
|
||||
0, sizeof(struct lndstr),
|
||||
0, 0, 0, {fldoff(lndstr, lnd_nv), fldoff(lndstr, lnd_vtype[0]),
|
||||
fldoff(lndstr, lnd_vamt[0])}, MAXLNDV,
|
||||
0, sizeof(struct plnstr), 0, 0, 0, 0,
|
||||
-1, -1, 0, 0, 0, 0, 0},
|
||||
{"land", EMPDIR "/data/land", EFF_COM | EFF_XY | EFF_OWNER | EFF_GROUP,
|
||||
0, sizeof(struct lndstr), 0, 0, 0, offsetof(struct lndstr, lnd_item),
|
||||
-1, -1, 0, 0, 0, 0, 0},
|
||||
{"nuke", EMPDIR "/data/nuke", EFF_XY | EFF_OWNER,
|
||||
0, sizeof(struct nukstr), 0, 0, 0, 0,
|
||||
-1, -1, 0, 0, 0, 0, 0},
|
||||
{"nuke", EMPDIR "/data/nuke", EFF_XY | EFF_OWNER, 0, sizeof(struct nukstr),
|
||||
0, 0, 0, {0, 0, 0}, 0, -1, -1, 0, 0, 0, 0, 0},
|
||||
{"news", EMPDIR "/data/news", 0,
|
||||
0, sizeof(struct nwsstr),
|
||||
0, 0, 0, {0, 0, 0}, 0, -1, -1, 0, 0, 0, 0, 0},
|
||||
{"treaty", EMPDIR "/data/treaty", 0, 0, sizeof(struct trtstr),
|
||||
0, 0, 0, {0, 0, 0}, 0, -1, -1, 0, 0, 0, 0, 0},
|
||||
{"trade", EMPDIR "/data/trade", 0, 0, sizeof(struct trdstr),
|
||||
0, 0, 0, {0, 0, 0}, 0, -1, -1, 0, 0, 0, 0, 0},
|
||||
{"pow", EMPDIR "/data/power", 0, 0, sizeof(struct powstr),
|
||||
0, 0, 0, {0, 0, 0}, 0, -1, -1, 0, 0, 0, 0, 0},
|
||||
{"nat", EMPDIR "/data/nation", 0, 0, sizeof(struct natstr),
|
||||
0, 0, 0, {0, 0, 0}, 0, -1, -1, 0, 0, 0, 0, 0},
|
||||
0, sizeof(struct nwsstr), 0, 0, 0, 0,
|
||||
-1, -1, 0, 0, 0, 0, 0},
|
||||
{"treaty", EMPDIR "/data/treaty", 0,
|
||||
0, sizeof(struct trtstr), 0, 0, 0, 0,
|
||||
-1, -1, 0, 0, 0, 0, 0},
|
||||
{"trade", EMPDIR "/data/trade", 0,
|
||||
0, sizeof(struct trdstr), 0, 0, 0, 0,
|
||||
-1, -1, 0, 0, 0, 0, 0},
|
||||
{"pow", EMPDIR "/data/power", 0,
|
||||
0, sizeof(struct powstr), 0, 0, 0, 0,
|
||||
-1, -1, 0, 0, 0, 0, 0},
|
||||
{"nat", EMPDIR "/data/nation", 0,
|
||||
0, sizeof(struct natstr), 0, 0, 0, 0,
|
||||
-1, -1, 0, 0, 0, 0, 0},
|
||||
{"loan", EMPDIR "/data/loan", 0,
|
||||
0, sizeof(struct lonstr),
|
||||
0, 0, 0, {0, 0, 0}, 0, -1, -1, 0, 0, 0, 0, 0},
|
||||
{"map", EMPDIR "/data/map", 0, 0, DEF_WORLD_X * DEF_WORLD_Y / 2,
|
||||
0, 0, 0, {0, 0, 0}, 0, -1, -1, 0, 0, 0, 0, 0},
|
||||
{"bmap", EMPDIR "/data/bmap", 0, 0, DEF_WORLD_X * DEF_WORLD_Y / 2,
|
||||
0, 0, 0, {0, 0, 0}, 0, -1, -1, 0, 0, 0, 0, 0},
|
||||
{"commodity", EMPDIR "/data/commodity", 0, 0, sizeof(struct comstr),
|
||||
0, 0, 0, {0, 0, 0}, 0, -1, -1, 0, 0, 0, 0, 0},
|
||||
{"lost", EMPDIR "/data/lostitems", 0, 0, sizeof(struct loststr),
|
||||
0, 0, 0, {0, 0, 0}, 0, -1, -1, 0, 0, 0, 0, 0}
|
||||
0, sizeof(struct lonstr), 0, 0, 0, 0,
|
||||
-1, -1, 0, 0, 0, 0, 0},
|
||||
{"map", EMPDIR "/data/map", 0,
|
||||
0, DEF_WORLD_X * DEF_WORLD_Y / 2, 0, 0, 0, 0,
|
||||
-1, -1, 0, 0, 0, 0, 0},
|
||||
{"bmap", EMPDIR "/data/bmap", 0,
|
||||
0, DEF_WORLD_X * DEF_WORLD_Y / 2, 0, 0, 0, 0,
|
||||
-1, -1, 0, 0, 0, 0, 0},
|
||||
{"commodity", EMPDIR "/data/commodity", 0,
|
||||
0, sizeof(struct comstr), 0, 0, 0, 0,
|
||||
-1, -1, 0, 0, 0, 0, 0},
|
||||
{"lost", EMPDIR "/data/lostitems", 0, 0,
|
||||
sizeof(struct loststr), 0, 0, 0, 0,
|
||||
-1, -1, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue