minor cleanup

This commit is contained in:
Enno Rehling 2019-03-31 10:19:02 +02:00
parent ef81a20c6e
commit 53662878aa
2 changed files with 20 additions and 2 deletions

View File

@ -63,6 +63,4 @@ void gamedata_close(gamedata *data);
gamedata *gamedata_open(const char *filename, const char *mode, int version);
int gamedata_openfile(gamedata *data, const char *filename, const char *mode, int version);
#define STREAM_VERSION 2 /* internal encoding of binary files */
#endif

View File

@ -613,6 +613,26 @@ static void read_regioninfo(gamedata *data, const region *r, char *info, size_t
}
}
static void fix_baselevel(region *r) {
struct terrain_production *p;
for (p = r->terrain->production; p->type; ++p) {
char *end;
long start = (int)strtol(p->startlevel, &end, 10);
if (*end == '\0') {
rawmaterial *res;
for (res = r->resources; res; res = res->next) {
if (p->type == res->rtype) {
if (start != res->startlevel) {
log_debug("setting resource start level for %s in %s to %d",
res->rtype->_name, regionname(r, NULL), start);
res->startlevel = start;
}
}
}
}
}
}
static region *readregion(gamedata *data, int x, int y)
{
region *r;