allow version.h to declare a future version that is compatible with the current code as MAX_VERSION that save.c will accept.

This commit is contained in:
Enno Rehling 2015-04-19 08:13:40 +02:00
parent 93e79fcf8f
commit 6e9fca5e2f
4 changed files with 6 additions and 5 deletions

View File

@ -1,3 +1,3 @@
#define VERSION_MAJOR 3 #define VERSION_MAJOR 3
#define VERSION_MINOR 4 #define VERSION_MINOR 5
#define VERSION_BUILD 5 #define VERSION_BUILD 0

View File

@ -1385,7 +1385,7 @@ int readgame(const char *filename, int backup)
assert(stream_version == STREAM_VERSION || !"unsupported data format"); assert(stream_version == STREAM_VERSION || !"unsupported data format");
} }
assert(gdata.version >= MIN_VERSION || !"unsupported data format"); assert(gdata.version >= MIN_VERSION || !"unsupported data format");
assert(gdata.version <= RELEASE_VERSION || !"unsupported data format"); assert(gdata.version <= MAX_VERSION || !"unsupported data format");
gdata.encoding = enc_gamedata; gdata.encoding = enc_gamedata;
fstream_init(&strm, F); fstream_init(&strm, F);

View File

@ -30,7 +30,8 @@
#define AUTO_RACENAME_VERSION 345 /* NPC units with name==NULL will automatically get their race for a name */ #define AUTO_RACENAME_VERSION 345 /* NPC units with name==NULL will automatically get their race for a name */
#define JSON_REPORT_VERSION 346 /* bit 3 in f->options flags the json report */ #define JSON_REPORT_VERSION 346 /* bit 3 in f->options flags the json report */
#define MIN_VERSION INTPAK_VERSION /* minimal datafile we support */
#define RELEASE_VERSION JSON_REPORT_VERSION /* current datafile */ #define RELEASE_VERSION JSON_REPORT_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 */
#define STREAM_VERSION 2 /* internal encoding of binary files */ #define STREAM_VERSION 2 /* internal encoding of binary files */

View File

@ -316,7 +316,7 @@ int walkingcapacity(const struct unit *u)
if (rbelt) { if (rbelt) {
int belts = i_get(u->items, rbelt->itype); int belts = i_get(u->items, rbelt->itype);
if (belts) { if (belts) {
int multi = get_param_flt(global.parameters, "rules.trollbelt.multiplier", STRENGTHMULTIPLIER); int multi = get_param_int(global.parameters, "rules.trollbelt.multiplier", STRENGTHMULTIPLIER);
n += _min(people, belts) * (multi - 1) * u_race(u)->capacity; n += _min(people, belts) * (multi - 1) * u_race(u)->capacity;
} }
} }