remove even more obsolete datafile version support.

This commit is contained in:
Enno Rehling 2014-12-12 23:00:30 +01:00
parent d492487a5b
commit 0967ccaac6
6 changed files with 251 additions and 316 deletions

View File

@ -113,7 +113,6 @@ static int lc_read(struct attrib *a, void *owner, struct storage *store)
else {
data->fname = _strdup(name);
}
if (global.data_version >= BACTION_VERSION) {
READ_TOK(store, name, sizeof(name));
if (strcmp(name, "tnnL") == 0) {
/* tunnel_action was the old Weltentore, their code has changed. ignore this object */
@ -125,10 +124,6 @@ static int lc_read(struct attrib *a, void *owner, struct storage *store)
else {
data->param = _strdup(name);
}
}
else {
data->param = 0;
}
if (result == 0 && !data->b) {
return AT_READ_FAIL;
}

View File

@ -195,14 +195,8 @@ int curse_read(attrib * a, void *owner, struct storage *store)
READ_TOK(store, cursename, sizeof(cursename));
READ_INT(store, &flags);
READ_INT(store, &c->duration);
if (global.data_version >= CURSEVIGOURISFLOAT_VERSION) {
READ_FLT(store, &flt);
c->vigour = flt;
}
else {
READ_INT(store, &n);
c->vigour = (float)n;
}
if (global.data_version < INTPAK_VERSION) {
ur = read_reference(&c->magician, store, read_int, resolve_unit);
}

View File

@ -428,10 +428,6 @@ static void read_alliances(struct storage *store)
{
char pbuf[8];
int id, terminator = 0;
if (global.data_version < SAVEALLIANCE_VERSION) {
if (!AllianceRestricted() && !AllianceAuto())
return;
}
if (global.data_version < ALLIANCELEADER_VERSION) {
terminator = atoi36("end");
READ_STR(store, pbuf, sizeof(pbuf));
@ -730,14 +726,6 @@ unit *read_unit(struct gamedata *data)
}
READ_STR(data->store, obuf, sizeof(obuf));
}
if (data->version < NOLASTORDER_VERSION) {
order *ord;
READ_STR(data->store, obuf, sizeof(obuf));
ord = parse_order(obuf, u->faction->locale);
if (ord != NULL) {
addlist(&u->orders, ord);
}
}
set_order(&u->thisorder, NULL);
assert(u_race(u));
@ -1257,9 +1245,7 @@ faction *readfaction(struct gamedata * data)
}
a_read(data->store, &f->attribs, f);
if (data->version >= CLAIM_VERSION) {
read_items(data->store, &f->items);
}
for (;;) {
READ_TOK(data->store, name, sizeof(name));
if (strcmp("end", name) == 0)
@ -1286,17 +1272,6 @@ faction *readfaction(struct gamedata * data)
}
sfp = &f->allies;
if (data->version < ALLIANCES_VERSION) {
int p;
READ_INT(data->store, &p);
while (--p >= 0) {
int aid, state;
READ_INT(data->store, &aid);
READ_INT(data->store, &state);
sfp = addally(f, sfp, aid, state);
}
}
else {
for (;;) {
int aid = 0;
READ_INT(data->store, &aid);
@ -1309,7 +1284,6 @@ faction *readfaction(struct gamedata * data)
break;
}
}
}
read_groups(data->store, f);
f->spellbook = 0;
if (data->version >= REGIONOWNER_VERSION) {
@ -1439,9 +1413,8 @@ int readgame(const char *filename, int backup)
getchar();
}
}
else if (gdata.version >= SAVEXMLNAME_VERSION) {
char basefile[32];
READ_STR(&store, basefile, sizeof(basefile));
else {
READ_STR(&store, NULL, 0);
}
a_read(&store, &global.attribs, NULL);
READ_INT(&store, &turn);
@ -1512,9 +1485,7 @@ int readgame(const char *filename, int backup)
}
/* Read factions */
if (gdata.version >= ALLIANCES_VERSION) {
read_alliances(&store);
}
READ_INT(&store, &nread);
log_printf(stdout, " - Einzulesende Parteien: %d\n", nread);
fp = &factions;
@ -1806,9 +1777,7 @@ int writegame(const char *filename)
}
/* Write factions */
#if RELEASE_VERSION>=ALLIANCES_VERSION
write_alliances(&gdata);
#endif
n = listlen(factions);
WRITE_INT(&store, n);
WRITE_SECTION(&store);

View File

@ -10,16 +10,6 @@
without prior permission by the authors of Eressea.
*/
#define CURSETYPE_VERSION 312 /* turn 287 */
#define ALLIANCES_VERSION 313
#define DBLINK_VERSION 314
#define CURSEVIGOURISFLOAT_VERSION 315
#define SAVEXMLNAME_VERSION 316
#define SAVEALLIANCE_VERSION 317
#define CLAIM_VERSION 318
/* 319 is the HSE4 data version */
#define BACTION_VERSION 319 /* building action gets a param string */
#define NOLASTORDER_VERSION 320 /* do not use lastorder */
#define INTPAK_VERSION 329 /* in binary, ints can get packed */
#define NOZEROIDS_VERSION 330 /* 2008-05-16 zero is not a valid ID for anything (including factions) */
#define NOBORDERATTRIBS_VERSION 331 /* 2008-05-17 connection::attribs has been moved to userdata */
@ -38,6 +28,7 @@
#define SAVEGAMEID_VERSION 343 /* instead of XMLNAME, save the game.id parameter from the config */
#define BUILDNO_VERSION 344 /* storing the build number in the save */
#define AUTO_RACENAME_VERSION 345 /* NPC units with name==NULL will automatically get their race for a name */
#define MIN_VERSION INTPAK_VERSION /* minimal datafile we support */
#define RELEASE_VERSION AUTO_RACENAME_VERSION /* current datafile */

View File

@ -53,7 +53,8 @@ static message *cinfo_auraboost(const void *obj, objtype_t typ, const curse * c,
if (self != 0) {
if (curse_geteffect(c) > 100) {
return msg_message("curseinfo::auraboost_0", "unit id", u, c->no);
} else {
}
else {
return msg_message("curseinfo::auraboost_1", "unit id", u, c->no);
}
}
@ -312,12 +313,7 @@ static struct curse_type ct_magicresistance = {
static int read_skill(struct storage *store, curse * c, void *target)
{
int skill;
if (global.data_version < CURSETYPE_VERSION) {
READ_INT(store, &skill);
READ_INT(store, 0); /* men, ignored */
} else {
READ_INT(store, &skill);
}
c->data.i = skill;
return 0;
}
@ -339,7 +335,8 @@ static message *cinfo_skillmod(const void *obj, objtype_t typ, const curse * c,
int sk = c->data.i;
if (c->effect > 0) {
return msg_message("curseinfo::skill_1", "unit skill id", u, sk, c->no);
} else if (c->effect < 0) {
}
else if (c->effect < 0) {
return msg_message("curseinfo::skill_2", "unit skill id", u, sk, c->no);
}
}

View File

@ -73,7 +73,8 @@ static int createcurse_handle(trigger * t, void *data)
if (td->mage && td->target && td->mage->number && td->target->number) {
create_curse(td->mage, &td->target->attribs,
td->type, td->vigour, td->duration, td->effect, td->men);
} else {
}
else {
log_error("could not perform createcurse::handle()\n");
}
unused_arg(data);
@ -100,18 +101,6 @@ static int createcurse_read(trigger * t, struct storage *store)
read_reference(&td->mage, store, read_unit_reference, resolve_unit);
read_reference(&td->target, store, read_unit_reference, resolve_unit);
if (global.data_version < CURSETYPE_VERSION) {
int id1, id2, n;
READ_INT(store, &id1);
READ_INT(store, &id2);
assert(id2 == 0);
READ_FLT(store, &td->vigour);
READ_INT(store, &td->duration);
READ_INT(store, &n);
td->effect = (float)n;
READ_INT(store, &td->men);
td->type = ct_find(oldcursename(id1));
} else {
READ_TOK(store, zText, sizeof(zText));
td->type = ct_find(zText);
READ_FLT(store, &td->vigour);
@ -120,11 +109,11 @@ static int createcurse_read(trigger * t, struct storage *store)
int n;
READ_INT(store, &n);
td->effect = (float)n;
} else {
}
else {
READ_FLT(store, &td->effect);
}
READ_INT(store, &td->men);
}
return AT_READ_OK;
}