diff --git a/src/building_action.c b/src/building_action.c index bcddbec8c..32b798bdf 100644 --- a/src/building_action.c +++ b/src/building_action.c @@ -113,21 +113,16 @@ 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 */ - result = 0; - data->b = 0; - } - if (strcmp(name, NULLSTRING) == 0) - data->param = 0; - else { - data->param = _strdup(name); - } + READ_TOK(store, name, sizeof(name)); + if (strcmp(name, "tnnL") == 0) { + /* tunnel_action was the old Weltentore, their code has changed. ignore this object */ + result = 0; + data->b = 0; } - else { + if (strcmp(name, NULLSTRING) == 0) data->param = 0; + else { + data->param = _strdup(name); } if (result == 0 && !data->b) { return AT_READ_FAIL; diff --git a/src/kernel/curse.c b/src/kernel/curse.c index d80e93da5..9aa8897b9 100644 --- a/src/kernel/curse.c +++ b/src/kernel/curse.c @@ -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; - } + READ_FLT(store, &flt); + c->vigour = flt; if (global.data_version < INTPAK_VERSION) { ur = read_reference(&c->magician, store, read_int, resolve_unit); } diff --git a/src/kernel/save.c b/src/kernel/save.c index c9ae37e98..c390a6640 100644 --- a/src/kernel/save.c +++ b/src/kernel/save.c @@ -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); - } + read_items(data->store, &f->items); for (;;) { READ_TOK(data->store, name, sizeof(name)); if (strcmp("end", name) == 0) @@ -1286,28 +1272,16 @@ 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); + for (;;) { + int aid = 0; + READ_INT(data->store, &aid); + if (aid > 0) { + int state; READ_INT(data->store, &state); sfp = addally(f, sfp, aid, state); } - } - else { - for (;;) { - int aid = 0; - READ_INT(data->store, &aid); - if (aid > 0) { - int state; - READ_INT(data->store, &state); - sfp = addally(f, sfp, aid, state); - } - else { - break; - } + else { + break; } } read_groups(data->store, f); @@ -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_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); diff --git a/src/kernel/version.h b/src/kernel/version.h index 5287e527c..e54b387db 100644 --- a/src/kernel/version.h +++ b/src/kernel/version.h @@ -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 */ diff --git a/src/spells/unitcurse.c b/src/spells/unitcurse.c index 155842e2f..39a7d0ff2 100644 --- a/src/spells/unitcurse.c +++ b/src/spells/unitcurse.c @@ -44,32 +44,33 @@ */ /* erhöht/senkt regeneration und maxaura um effect% */ static message *cinfo_auraboost(const void *obj, objtype_t typ, const curse * c, - int self) + int self) { - struct unit *u = (struct unit *)obj; - unused_arg(typ); - assert(typ == TYP_UNIT); + struct unit *u = (struct unit *)obj; + unused_arg(typ); + assert(typ == TYP_UNIT); - if (self != 0) { - if (curse_geteffect(c) > 100) { - return msg_message("curseinfo::auraboost_0", "unit id", u, c->no); - } else { - return msg_message("curseinfo::auraboost_1", "unit id", u, c->no); + if (self != 0) { + if (curse_geteffect(c) > 100) { + return msg_message("curseinfo::auraboost_0", "unit id", u, c->no); + } + else { + return msg_message("curseinfo::auraboost_1", "unit id", u, c->no); + } } - } - return NULL; + return NULL; } static struct curse_type ct_auraboost = { - "auraboost", - CURSETYP_NORM, CURSE_SPREADMODULO, (NO_MERGE), - cinfo_auraboost + "auraboost", + CURSETYP_NORM, CURSE_SPREADMODULO, (NO_MERGE), + cinfo_auraboost }; /* Magic Boost - Gabe des Chaos */ static struct curse_type ct_magicboost = { - "magicboost", - CURSETYP_UNIT, CURSE_SPREADMODULO | CURSE_IMMUNE, M_MEN, cinfo_simple + "magicboost", + CURSETYP_UNIT, CURSE_SPREADMODULO | CURSE_IMMUNE, M_MEN, cinfo_simple }; /* ------------------------------------------------------------- */ @@ -77,24 +78,24 @@ static struct curse_type ct_magicboost = { * C_SLAVE */ static message *cinfo_slave(const void *obj, objtype_t typ, const curse * c, - int self) + int self) { - unit *u; - unused_arg(typ); + unit *u; + unused_arg(typ); - assert(typ == TYP_UNIT); - u = (unit *) obj; + assert(typ == TYP_UNIT); + u = (unit *)obj; - if (self != 0) { - return msg_message("curseinfo::slave_1", "unit duration id", u, c->duration, - c->no); - } - return NULL; + if (self != 0) { + return msg_message("curseinfo::slave_1", "unit duration id", u, c->duration, + c->no); + } + return NULL; } static struct curse_type ct_slavery = { "slavery", - CURSETYP_NORM, 0, NO_MERGE, - cinfo_slave +CURSETYP_NORM, 0, NO_MERGE, +cinfo_slave }; /* ------------------------------------------------------------- */ @@ -102,28 +103,28 @@ static struct curse_type ct_slavery = { "slavery", * C_CALM */ static message *cinfo_calm(const void *obj, objtype_t typ, const curse * c, - int self) + int self) { - unused_arg(typ); - assert(typ == TYP_UNIT); + unused_arg(typ); + assert(typ == TYP_UNIT); - if (c->magician && c->magician->faction) { - faction *f = c->magician->faction; - unit *u = (unit *) obj; + if (c->magician && c->magician->faction) { + faction *f = c->magician->faction; + unit *u = (unit *)obj; - if (f == NULL || self == 0) { - const struct race *rc = u_irace(c->magician); - return msg_message("curseinfo::calm_0", "unit race id", u, rc, c->no); + if (f == NULL || self == 0) { + const struct race *rc = u_irace(c->magician); + return msg_message("curseinfo::calm_0", "unit race id", u, rc, c->no); + } + return msg_message("curseinfo::calm_1", "unit faction id", u, f, c->no); } - return msg_message("curseinfo::calm_1", "unit faction id", u, f, c->no); - } - return NULL; + return NULL; } static struct curse_type ct_calmmonster = { - "calmmonster", - CURSETYP_NORM, CURSE_SPREADNEVER | CURSE_ONLYONE, NO_MERGE, - cinfo_calm + "calmmonster", + CURSETYP_NORM, CURSE_SPREADNEVER | CURSE_ONLYONE, NO_MERGE, + cinfo_calm }; /* ------------------------------------------------------------- */ @@ -131,23 +132,23 @@ static struct curse_type ct_calmmonster = { * C_SPEED */ static message *cinfo_speed(const void *obj, objtype_t typ, const curse * c, - int self) + int self) { - unused_arg(typ); - assert(typ == TYP_UNIT); + unused_arg(typ); + assert(typ == TYP_UNIT); - if (self != 0) { - unit *u = (unit *) obj; - return msg_message("curseinfo::speed_1", "unit number duration id", u, - c->data.i, c->duration, c->no); - } - return NULL; + if (self != 0) { + unit *u = (unit *)obj; + return msg_message("curseinfo::speed_1", "unit number duration id", u, + c->data.i, c->duration, c->no); + } + return NULL; } static struct curse_type ct_speed = { - "speed", - CURSETYP_UNIT, CURSE_SPREADNEVER, M_MEN, - cinfo_speed + "speed", + CURSETYP_UNIT, CURSE_SPREADNEVER, M_MEN, + cinfo_speed }; /* ------------------------------------------------------------- */ @@ -156,21 +157,21 @@ static struct curse_type ct_speed = { */ message *cinfo_unit(const void *obj, objtype_t typ, const curse * c, int self) { - unused_arg(typ); - assert(typ == TYP_UNIT); + unused_arg(typ); + assert(typ == TYP_UNIT); - if (self != 0) { - unit *u = (unit *) obj; - return msg_message(mkname("curseinfo", c->type->cname), "unit id", u, - c->no); - } - return NULL; + if (self != 0) { + unit *u = (unit *)obj; + return msg_message(mkname("curseinfo", c->type->cname), "unit id", u, + c->no); + } + return NULL; } static struct curse_type ct_orcish = { - "orcish", - CURSETYP_UNIT, CURSE_SPREADMODULO | CURSE_ISNEW, M_MEN, - cinfo_unit + "orcish", + CURSETYP_UNIT, CURSE_SPREADMODULO | CURSE_ISNEW, M_MEN, + cinfo_unit }; /* ------------------------------------------------------------- */ @@ -178,23 +179,23 @@ static struct curse_type ct_orcish = { * C_KAELTESCHUTZ */ static message *cinfo_kaelteschutz(const void *obj, objtype_t typ, const curse * c, - int self) + int self) { - unused_arg(typ); - assert(typ == TYP_UNIT); + unused_arg(typ); + assert(typ == TYP_UNIT); - if (self != 0) { - unit *u = (unit *) obj; - return msg_message("curseinfo::warmth_1", "unit number id", u, - get_cursedmen(u, c), c->no); - } - return NULL; + if (self != 0) { + unit *u = (unit *)obj; + return msg_message("curseinfo::warmth_1", "unit number id", u, + get_cursedmen(u, c), c->no); + } + return NULL; } static struct curse_type ct_insectfur = { - "insectfur", - CURSETYP_UNIT, CURSE_SPREADMODULO, (M_MEN | M_DURATION), - cinfo_kaelteschutz + "insectfur", + CURSETYP_UNIT, CURSE_SPREADMODULO, (M_MEN | M_DURATION), + cinfo_kaelteschutz }; /* ------------------------------------------------------------- */ @@ -202,64 +203,64 @@ static struct curse_type ct_insectfur = { * C_SPARKLE */ static message *cinfo_sparkle(const void *obj, objtype_t typ, const curse * c, - int self) + int self) { - const char *effects[] = { - NULL, /* end grau */ - "sparkle_1", - "sparkle_2", - NULL, /* end traum */ - "sparkle_3", - "sparkle_4", - NULL, /* end tybied */ - "sparkle_5", - "sparkle_6", - "sparkle_7", - "sparkle_8", - NULL, /* end cerrdor */ - "sparkle_9", - "sparkle_10", - "sparkle_11", - "sparkle_12", - NULL, /* end gwyrrd */ - "sparkle_13", - "sparkle_14", - "sparkle_15", - "sparkle_16", - "sparkle_17", - "sparkle_18", - NULL, /* end draig */ - }; - int m, begin = 0, end = 0; - unit *u; - unused_arg(typ); + const char *effects[] = { + NULL, /* end grau */ + "sparkle_1", + "sparkle_2", + NULL, /* end traum */ + "sparkle_3", + "sparkle_4", + NULL, /* end tybied */ + "sparkle_5", + "sparkle_6", + "sparkle_7", + "sparkle_8", + NULL, /* end cerrdor */ + "sparkle_9", + "sparkle_10", + "sparkle_11", + "sparkle_12", + NULL, /* end gwyrrd */ + "sparkle_13", + "sparkle_14", + "sparkle_15", + "sparkle_16", + "sparkle_17", + "sparkle_18", + NULL, /* end draig */ + }; + int m, begin = 0, end = 0; + unit *u; + unused_arg(typ); - assert(typ == TYP_UNIT); - u = (unit *) obj; + assert(typ == TYP_UNIT); + u = (unit *)obj; - if (!c->magician || !c->magician->faction) - return NULL; + if (!c->magician || !c->magician->faction) + return NULL; + + for (m = 0; m != c->magician->faction->magiegebiet; ++m) { + while (effects[end] != NULL) + ++end; + begin = end + 1; + end = begin; + } - for (m = 0; m != c->magician->faction->magiegebiet; ++m) { while (effects[end] != NULL) - ++end; - begin = end + 1; - end = begin; - } - - while (effects[end] != NULL) - ++end; - if (end == begin) - return NULL; - else { - int index = begin + curse_geteffect_int(c) % (end - begin); - return msg_message(mkname("curseinfo", effects[index]), "unit id", u, - c->no); - } + ++end; + if (end == begin) + return NULL; + else { + int index = begin + curse_geteffect_int(c) % (end - begin); + return msg_message(mkname("curseinfo", effects[index]), "unit id", u, + c->no); + } } static struct curse_type ct_sparkle = { "sparkle", - CURSETYP_UNIT, CURSE_SPREADMODULO, (M_MEN | M_DURATION), cinfo_sparkle +CURSETYP_UNIT, CURSE_SPREADMODULO, (M_MEN | M_DURATION), cinfo_sparkle }; /* ------------------------------------------------------------- */ @@ -267,7 +268,7 @@ static struct curse_type ct_sparkle = { "sparkle", * C_STRENGTH */ static struct curse_type ct_strength = { "strength", - CURSETYP_UNIT, CURSE_SPREADMODULO, M_MEN, cinfo_simple +CURSETYP_UNIT, CURSE_SPREADMODULO, M_MEN, cinfo_simple }; /* ------------------------------------------------------------- */ @@ -275,7 +276,7 @@ static struct curse_type ct_strength = { "strength", * C_ALLSKILLS (Alp) */ static struct curse_type ct_worse = { - "worse", CURSETYP_UNIT, CURSE_SPREADMODULO | CURSE_NOAGE, M_MEN, cinfo_unit + "worse", CURSETYP_UNIT, CURSE_SPREADMODULO | CURSE_NOAGE, M_MEN, cinfo_unit }; /* ------------------------------------------------------------- */ @@ -284,24 +285,24 @@ static struct curse_type ct_worse = { * C_ITEMCLOAK */ static struct curse_type ct_itemcloak = { - "itemcloak", CURSETYP_UNIT, CURSE_SPREADNEVER, M_DURATION, cinfo_unit + "itemcloak", CURSETYP_UNIT, CURSE_SPREADNEVER, M_DURATION, cinfo_unit }; /* ------------------------------------------------------------- */ static struct curse_type ct_fumble = { - "fumble", CURSETYP_NORM, CURSE_SPREADNEVER | CURSE_ONLYONE, NO_MERGE, + "fumble", CURSETYP_NORM, CURSE_SPREADNEVER | CURSE_ONLYONE, NO_MERGE, cinfo_unit }; /* ------------------------------------------------------------- */ static struct curse_type ct_oldrace = { - "oldrace", CURSETYP_NORM, CURSE_SPREADALWAYS, NO_MERGE, NULL + "oldrace", CURSETYP_NORM, CURSE_SPREADALWAYS, NO_MERGE, NULL }; static struct curse_type ct_magicresistance = { - "magicresistance", CURSETYP_UNIT, CURSE_SPREADMODULO, M_MEN, cinfo_simple + "magicresistance", CURSETYP_UNIT, CURSE_SPREADMODULO, M_MEN, cinfo_simple }; /* ------------------------------------------------------------- */ @@ -311,62 +312,58 @@ 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) { + int skill; READ_INT(store, &skill); - READ_INT(store, 0); /* men, ignored */ - } else { - READ_INT(store, &skill); - } - c->data.i = skill; - return 0; + c->data.i = skill; + return 0; } static int write_skill(struct storage *store, const curse * c, const void *target) { - WRITE_INT(store, c->data.i); - return 0; + WRITE_INT(store, c->data.i); + return 0; } static message *cinfo_skillmod(const void *obj, objtype_t typ, const curse * c, - int self) + int self) { - unused_arg(typ); + unused_arg(typ); - if (self != 0) { - unit *u = (unit *) obj; - 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) { - return msg_message("curseinfo::skill_2", "unit skill id", u, sk, c->no); + if (self != 0) { + unit *u = (unit *)obj; + 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) { + return msg_message("curseinfo::skill_2", "unit skill id", u, sk, c->no); + } } - } - return NULL; + return NULL; } static struct curse_type ct_skillmod = { - "skillmod", CURSETYP_NORM, CURSE_SPREADMODULO, M_MEN, cinfo_skillmod, - NULL, read_skill, write_skill + "skillmod", CURSETYP_NORM, CURSE_SPREADMODULO, M_MEN, cinfo_skillmod, + NULL, read_skill, write_skill }; /* ------------------------------------------------------------- */ void register_unitcurse(void) { - ct_register(&ct_auraboost); - ct_register(&ct_magicboost); - ct_register(&ct_slavery); - ct_register(&ct_calmmonster); - ct_register(&ct_speed); - ct_register(&ct_orcish); - ct_register(&ct_insectfur); - ct_register(&ct_sparkle); - ct_register(&ct_strength); - ct_register(&ct_worse); - ct_register(&ct_skillmod); - ct_register(&ct_itemcloak); - ct_register(&ct_fumble); - ct_register(&ct_oldrace); - ct_register(&ct_magicresistance); + ct_register(&ct_auraboost); + ct_register(&ct_magicboost); + ct_register(&ct_slavery); + ct_register(&ct_calmmonster); + ct_register(&ct_speed); + ct_register(&ct_orcish); + ct_register(&ct_insectfur); + ct_register(&ct_sparkle); + ct_register(&ct_strength); + ct_register(&ct_worse); + ct_register(&ct_skillmod); + ct_register(&ct_itemcloak); + ct_register(&ct_fumble); + ct_register(&ct_oldrace); + ct_register(&ct_magicresistance); } diff --git a/src/triggers/createcurse.c b/src/triggers/createcurse.c index 43e7ebab7..e426fd973 100644 --- a/src/triggers/createcurse.c +++ b/src/triggers/createcurse.c @@ -1,7 +1,7 @@ /* Copyright (c) 1998-2010, Enno Rehling - Katja Zedel +Katja Zedel Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -45,109 +45,98 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. **/ typedef struct createcurse_data { - struct unit *mage; - struct unit *target; - const curse_type *type; - float vigour; - int duration; - float effect; - int men; + struct unit *mage; + struct unit *target; + const curse_type *type; + float vigour; + int duration; + float effect; + int men; } createcurse_data; static void createcurse_init(trigger * t) { - t->data.v = calloc(sizeof(createcurse_data), 1); + t->data.v = calloc(sizeof(createcurse_data), 1); } static void createcurse_free(trigger * t) { - free(t->data.v); + free(t->data.v); } static int createcurse_handle(trigger * t, void *data) { - /* call an event handler on createcurse. - * data.v -> ( variant event, int timer ) - */ - createcurse_data *td = (createcurse_data *) t->data.v; - 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 { - log_error("could not perform createcurse::handle()\n"); - } - unused_arg(data); - return 0; + /* call an event handler on createcurse. + * data.v -> ( variant event, int timer ) + */ + createcurse_data *td = (createcurse_data *)t->data.v; + 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 { + log_error("could not perform createcurse::handle()\n"); + } + unused_arg(data); + return 0; } static void createcurse_write(const trigger * t, struct storage *store) { - createcurse_data *td = (createcurse_data *) t->data.v; - write_unit_reference(td->mage, store); - write_unit_reference(td->target, store); - WRITE_TOK(store, td->type->cname); - WRITE_FLT(store, (float)td->vigour); - WRITE_INT(store, td->duration); - WRITE_FLT(store, (float)td->effect); - WRITE_INT(store, td->men); + createcurse_data *td = (createcurse_data *)t->data.v; + write_unit_reference(td->mage, store); + write_unit_reference(td->target, store); + WRITE_TOK(store, td->type->cname); + WRITE_FLT(store, (float)td->vigour); + WRITE_INT(store, td->duration); + WRITE_FLT(store, (float)td->effect); + WRITE_INT(store, td->men); } static int createcurse_read(trigger * t, struct storage *store) { - createcurse_data *td = (createcurse_data *) t->data.v; - char zText[128]; + createcurse_data *td = (createcurse_data *)t->data.v; + char zText[128]; - read_reference(&td->mage, store, read_unit_reference, resolve_unit); - read_reference(&td->target, store, read_unit_reference, resolve_unit); + 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); READ_INT(store, &td->duration); if (global.data_version < CURSEFLOAT_VERSION) { - int n; - READ_INT(store, &n); - td->effect = (float)n; - } else { - READ_FLT(store, &td->effect); + int n; + READ_INT(store, &n); + td->effect = (float)n; + } + else { + READ_FLT(store, &td->effect); } READ_INT(store, &td->men); - } - return AT_READ_OK; + return AT_READ_OK; } trigger_type tt_createcurse = { - "createcurse", - createcurse_init, - createcurse_free, - createcurse_handle, - createcurse_write, - createcurse_read + "createcurse", + createcurse_init, + createcurse_free, + createcurse_handle, + createcurse_write, + createcurse_read }; trigger *trigger_createcurse(struct unit * mage, struct unit * target, - const curse_type * ct, float vigour, int duration, float effect, int men) + const curse_type * ct, float vigour, int duration, float effect, int men) { - trigger *t = t_new(&tt_createcurse); - createcurse_data *td = (createcurse_data *) t->data.v; - td->mage = mage; - td->target = target; - td->type = ct; - td->vigour = vigour; - td->duration = duration; - td->effect = effect; - td->men = men; - return t; + trigger *t = t_new(&tt_createcurse); + createcurse_data *td = (createcurse_data *)t->data.v; + td->mage = mage; + td->target = target; + td->type = ct; + td->vigour = vigour; + td->duration = duration; + td->effect = effect; + td->men = men; + return t; }