forked from github/server
BUG 2566 mountains with no low-level resources.
NB: new data version
This commit is contained in:
parent
a75b46d6d4
commit
fc6bb36ee4
2 changed files with 28 additions and 1 deletions
|
@ -41,8 +41,9 @@
|
||||||
#define CRYPT_VERSION 363 /* passwords are encrypted */
|
#define CRYPT_VERSION 363 /* passwords are encrypted */
|
||||||
#define FAMILIAR_FIXMAGE_VERSION 364 /* familiar links are fixed */
|
#define FAMILIAR_FIXMAGE_VERSION 364 /* familiar links are fixed */
|
||||||
#define FAMILIAR_FIXSPELLBOOK_VERSION 365 /* familiar spells are fixed */
|
#define FAMILIAR_FIXSPELLBOOK_VERSION 365 /* familiar spells are fixed */
|
||||||
|
#define FIX_STARTLEVEL_VERSION 366 /* fixing resource startlevels */
|
||||||
|
|
||||||
#define RELEASE_VERSION FAMILIAR_FIXSPELLBOOK_VERSION /* current datafile */
|
#define RELEASE_VERSION FIX_STARTLEVEL_VERSION /* current datafile */
|
||||||
#define MIN_VERSION UIDHASH_VERSION /* minimal datafile we support */
|
#define MIN_VERSION UIDHASH_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 */
|
||||||
|
|
||||||
|
|
|
@ -613,6 +613,27 @@ 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)
|
static region *readregion(gamedata *data, int x, int y)
|
||||||
{
|
{
|
||||||
region *r;
|
region *r;
|
||||||
|
@ -781,6 +802,11 @@ static region *readregion(gamedata *data, int x, int y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
read_attribs(data, &r->attribs, r);
|
read_attribs(data, &r->attribs, r);
|
||||||
|
|
||||||
|
if (r->resources && data->version < FIX_STARTLEVEL_VERSION) {
|
||||||
|
/* we had some badly made rawmaterials before this */
|
||||||
|
fix_baselevel(r);
|
||||||
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue