remove unused r->land->items list.

This commit is contained in:
Enno Rehling 2017-05-09 18:49:10 +02:00
parent 6b7dcadf84
commit c7f8b16c07
6 changed files with 18 additions and 25 deletions

View File

@ -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_borders(r, f, r->seen.mode, F);
if (r->seen.mode == seen_unit && is_astral(r)

View File

@ -911,25 +911,27 @@ void read_items(struct storage *store, item ** ilist)
{
for (;;) {
char ibuf[32];
const item_type *itype;
int i;
READ_STR(store, ibuf, sizeof(ibuf));
if (!strcmp("end", ibuf)) {
break;
}
itype = it_find(ibuf);
READ_INT(store, &i);
if (i <= 0) {
log_error("data contains an entry with %d %s", i, ibuf);
}
else {
if (itype && itype->rtype) {
i_change(ilist, itype, i);
if (ilist) {
const item_type *itype;
itype = it_find(ibuf);
if (i <= 0) {
log_error("data contains an entry with %d %s", i, ibuf);
}
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);
}
}
}

View File

@ -1080,8 +1080,7 @@ void terraform_region(region * r, const terrain_type * terrain)
if (!fval(terrain, LAND_REGION)) {
region_setinfo(r, NULL);
if (r->land != NULL) {
i_freeall(&r->land->items);
if (r->land) {
free_land(r->land);
r->land = NULL;
}
@ -1101,7 +1100,6 @@ void terraform_region(region * r, const terrain_type * terrain)
for (d = 0; d != MAXDIRECTIONS; ++d) {
rsetroad(r, d, 0);
}
i_freeall(&r->land->items);
}
else {
static struct surround {
@ -1176,11 +1174,6 @@ void terraform_region(region * r, const terrain_type * terrain)
if (fval(terrain, LAND_REGION)) {
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) {
int len = 0;

View File

@ -105,7 +105,6 @@ extern "C" {
int peasants;
int newpeasants;
int money;
struct item *items; /* items that can be claimed */
struct region_owner *ownership;
} land_region;

View File

@ -1021,7 +1021,9 @@ static region *readregion(struct gamedata *data, int x, int y)
if (!r->land->demands) {
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) {
READ_INT(data->store, &n);
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_TOK(data->store, "end");
write_items(data->store, r->land->items);
WRITE_SECTION(data->store);
#if RELEASE_VERSION>=REGIONOWNER_VERSION
WRITE_INT(data->store, region_get_morale(r));

View File

@ -33,10 +33,11 @@
#define ATHASH_VERSION 353 /* attribute-type hash, not name */
#define NOWATCH_VERSION 354 /* plane->watchers is gone */
#define KEYVAL_VERSION 355 /* at_keys has values */
#define NOLANDITEM_VERSION 356 /* land_region has no items */
/* unfinished: */
#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 MAX_VERSION RELEASE_VERSION /* change this if we can need to read the future datafile, and we can do so */