forked from github/server
remove unused r->land->items list.
This commit is contained in:
parent
6b7dcadf84
commit
c7f8b16c07
6 changed files with 18 additions and 25 deletions
|
@ -1416,9 +1416,6 @@ static void cr_output_region(FILE * F, report_context * ctx, region * r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (r->land) {
|
|
||||||
print_items(F, r->land->items, f->locale);
|
|
||||||
}
|
|
||||||
cr_output_curses_compat(F, f, r, TYP_REGION);
|
cr_output_curses_compat(F, f, r, TYP_REGION);
|
||||||
cr_borders(r, f, r->seen.mode, F);
|
cr_borders(r, f, r->seen.mode, F);
|
||||||
if (r->seen.mode == seen_unit && is_astral(r)
|
if (r->seen.mode == seen_unit && is_astral(r)
|
||||||
|
|
|
@ -911,25 +911,27 @@ void read_items(struct storage *store, item ** ilist)
|
||||||
{
|
{
|
||||||
for (;;) {
|
for (;;) {
|
||||||
char ibuf[32];
|
char ibuf[32];
|
||||||
const item_type *itype;
|
|
||||||
int i;
|
int i;
|
||||||
READ_STR(store, ibuf, sizeof(ibuf));
|
READ_STR(store, ibuf, sizeof(ibuf));
|
||||||
if (!strcmp("end", ibuf)) {
|
if (!strcmp("end", ibuf)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
itype = it_find(ibuf);
|
|
||||||
READ_INT(store, &i);
|
READ_INT(store, &i);
|
||||||
if (i <= 0) {
|
if (ilist) {
|
||||||
log_error("data contains an entry with %d %s", i, ibuf);
|
const item_type *itype;
|
||||||
}
|
itype = it_find(ibuf);
|
||||||
else {
|
if (i <= 0) {
|
||||||
if (itype && itype->rtype) {
|
log_error("data contains an entry with %d %s", i, ibuf);
|
||||||
i_change(ilist, itype, i);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log_error("data contains unknown item type %s.", ibuf);
|
if (itype && itype->rtype) {
|
||||||
|
i_change(ilist, itype, i);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
log_error("data contains unknown item type %s.", ibuf);
|
||||||
|
}
|
||||||
|
assert(itype && itype->rtype);
|
||||||
}
|
}
|
||||||
assert(itype && itype->rtype);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1080,8 +1080,7 @@ void terraform_region(region * r, const terrain_type * terrain)
|
||||||
|
|
||||||
if (!fval(terrain, LAND_REGION)) {
|
if (!fval(terrain, LAND_REGION)) {
|
||||||
region_setinfo(r, NULL);
|
region_setinfo(r, NULL);
|
||||||
if (r->land != NULL) {
|
if (r->land) {
|
||||||
i_freeall(&r->land->items);
|
|
||||||
free_land(r->land);
|
free_land(r->land);
|
||||||
r->land = NULL;
|
r->land = NULL;
|
||||||
}
|
}
|
||||||
|
@ -1101,7 +1100,6 @@ void terraform_region(region * r, const terrain_type * terrain)
|
||||||
for (d = 0; d != MAXDIRECTIONS; ++d) {
|
for (d = 0; d != MAXDIRECTIONS; ++d) {
|
||||||
rsetroad(r, d, 0);
|
rsetroad(r, d, 0);
|
||||||
}
|
}
|
||||||
i_freeall(&r->land->items);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
static struct surround {
|
static struct surround {
|
||||||
|
@ -1176,11 +1174,6 @@ void terraform_region(region * r, const terrain_type * terrain)
|
||||||
|
|
||||||
if (fval(terrain, LAND_REGION)) {
|
if (fval(terrain, LAND_REGION)) {
|
||||||
const item_type *itype = NULL;
|
const item_type *itype = NULL;
|
||||||
char equip_hash[64];
|
|
||||||
|
|
||||||
/* TODO: put the equipment in struct terrain, faster */
|
|
||||||
sprintf(equip_hash, "terrain_%s", terrain->_name);
|
|
||||||
equip_items(&r->land->items, get_equipment(equip_hash));
|
|
||||||
|
|
||||||
if (r->terrain->herbs) {
|
if (r->terrain->herbs) {
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
|
@ -105,7 +105,6 @@ extern "C" {
|
||||||
int peasants;
|
int peasants;
|
||||||
int newpeasants;
|
int newpeasants;
|
||||||
int money;
|
int money;
|
||||||
struct item *items; /* items that can be claimed */
|
|
||||||
struct region_owner *ownership;
|
struct region_owner *ownership;
|
||||||
} land_region;
|
} land_region;
|
||||||
|
|
||||||
|
|
|
@ -1021,7 +1021,9 @@ static region *readregion(struct gamedata *data, int x, int y)
|
||||||
if (!r->land->demands) {
|
if (!r->land->demands) {
|
||||||
fix_demand(r);
|
fix_demand(r);
|
||||||
}
|
}
|
||||||
read_items(data->store, &r->land->items);
|
if (data->version < NOLANDITEM_VERSION) {
|
||||||
|
read_items(data->store, NULL);
|
||||||
|
}
|
||||||
if (data->version >= REGIONOWNER_VERSION) {
|
if (data->version >= REGIONOWNER_VERSION) {
|
||||||
READ_INT(data->store, &n);
|
READ_INT(data->store, &n);
|
||||||
region_set_morale(r, MAX(0, (short)n), -1);
|
region_set_morale(r, MAX(0, (short)n), -1);
|
||||||
|
@ -1095,7 +1097,6 @@ void writeregion(struct gamedata *data, const region * r)
|
||||||
WRITE_INT(data->store, demand->value);
|
WRITE_INT(data->store, demand->value);
|
||||||
}
|
}
|
||||||
WRITE_TOK(data->store, "end");
|
WRITE_TOK(data->store, "end");
|
||||||
write_items(data->store, r->land->items);
|
|
||||||
WRITE_SECTION(data->store);
|
WRITE_SECTION(data->store);
|
||||||
#if RELEASE_VERSION>=REGIONOWNER_VERSION
|
#if RELEASE_VERSION>=REGIONOWNER_VERSION
|
||||||
WRITE_INT(data->store, region_get_morale(r));
|
WRITE_INT(data->store, region_get_morale(r));
|
||||||
|
|
|
@ -33,10 +33,11 @@
|
||||||
#define ATHASH_VERSION 353 /* attribute-type hash, not name */
|
#define ATHASH_VERSION 353 /* attribute-type hash, not name */
|
||||||
#define NOWATCH_VERSION 354 /* plane->watchers is gone */
|
#define NOWATCH_VERSION 354 /* plane->watchers is gone */
|
||||||
#define KEYVAL_VERSION 355 /* at_keys has values */
|
#define KEYVAL_VERSION 355 /* at_keys has values */
|
||||||
|
#define NOLANDITEM_VERSION 356 /* land_region has no items */
|
||||||
/* unfinished: */
|
/* unfinished: */
|
||||||
#define CRYPT_VERSION 400 /* passwords are encrypted */
|
#define CRYPT_VERSION 400 /* passwords are encrypted */
|
||||||
|
|
||||||
#define RELEASE_VERSION KEYVAL_VERSION /* current datafile */
|
#define RELEASE_VERSION NOLANDITEM_VERSION /* current datafile */
|
||||||
#define MIN_VERSION INTPAK_VERSION /* minimal datafile we support */
|
#define MIN_VERSION INTPAK_VERSION /* minimal datafile we support */
|
||||||
#define MAX_VERSION RELEASE_VERSION /* change this if we can need to read the future datafile, and we can do so */
|
#define MAX_VERSION RELEASE_VERSION /* change this if we can need to read the future datafile, and we can do so */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue