clear CURSE_ISNEW explicitly in age(), not implicitly in write/read

This commit is contained in:
Steffen Mecke 2015-05-07 17:45:02 +02:00
parent 553cf23e9e
commit dedf9f2009
3 changed files with 20 additions and 15 deletions

View File

@ -117,6 +117,8 @@ int curse_age(attrib * a)
curse *c = (curse *)a->data.v;
int result = 0;
c_clearflag(c, CURSE_ISNEW);
if (c_flags(c) & CURSE_NOAGE) {
c->duration = INT_MAX;
}
@ -221,7 +223,9 @@ int curse_read(attrib * a, void *owner, struct storage *store)
return AT_READ_FAIL;
}
c->flags = flags;
c_clearflag(c, CURSE_ISNEW);
if (global.data_version < EXPLICIT_CURSE_ISNEW_VERSION) {
c_clearflag(c, CURSE_ISNEW);
}
if (c->type->read)
c->type->read(store, c, owner);
@ -248,7 +252,9 @@ void curse_write(const attrib * a, const void *owner, struct storage *store)
unit *mage = (c->magician && c->magician->number) ? c->magician : NULL;
/* copied from c_clearflag */
flags = (c->flags & ~CURSE_ISNEW) | (c->type->flags & CURSE_ISNEW);
if (global.data_version < EXPLICIT_CURSE_ISNEW_VERSION) {
flags = (c->flags & ~CURSE_ISNEW) | (c->type->flags & CURSE_ISNEW);
}
WRITE_INT(store, c->no);
WRITE_TOK(store, ct->cname);

View File

@ -248,48 +248,46 @@ extern "C" {
void destroy_curse(curse * c);
bool is_cursed_internal(struct attrib *ap, const curse_type * ctype);
/* ignoriert CURSE_ISNEW */
bool is_cursed_internal(struct attrib *ap, const curse_type * ctype);
/* löscht einen konkreten Spruch auf einem Objekt. */
bool remove_curse(struct attrib **ap, const struct curse *c);
/* löscht einen konkreten Spruch auf einem Objekt.
*/
int curse_geteffect_int(const struct curse *c);
float curse_geteffect(const struct curse *c);
/* gibt die Auswirkungen der Verzauberungen zurück. zB bei
* Skillmodifiziernden Verzauberungen ist hier der Modifizierer
* gespeichert. Wird automatisch beim Anlegen eines neuen curse
* gesetzt. Gibt immer den ersten Treffer von ap aus zurück.
*/
int curse_geteffect_int(const struct curse *c);
float curse_geteffect(const struct curse *c);
float curse_changevigour(struct attrib **ap, curse * c, float i);
/* verändert die Stärke der Verzauberung um i */
float curse_changevigour(struct attrib **ap, curse * c, float i);
int get_cursedmen(struct unit *u, const struct curse *c);
/* gibt bei Personenbeschränkten Verzauberungen die Anzahl der
* betroffenen Personen zurück. Ansonsten wird 0 zurückgegeben. */
int get_cursedmen(struct unit *u, const struct curse *c);
/* setzt/loescht Spezialflag einer Verzauberung (zB 'dauert ewig') */
void c_setflag(curse * c, unsigned int flag);
void c_clearflag(curse * c, unsigned int flags);
/* setzt/loescht Spezialflag einer Verzauberung (zB 'dauert ewig') */
void transfer_curse(struct unit *u, struct unit *u2, int n);
/* sorgt dafür, das bei der Übergabe von Personen die curse-attribute
* korrekt gehandhabt werden. Je nach internen Flag kann dies
* unterschiedlich gewünscht sein
* */
void transfer_curse(struct unit *u, struct unit *u2, int n);
struct curse *get_curse(struct attrib *ap, const curse_type * ctype);
/* gibt pointer auf die erste curse-struct zurück, deren Typ ctype ist,
* oder einen NULL-pointer
* */
struct curse *get_curse(struct attrib *ap, const curse_type * ctype);
int find_cursebyname(const char *c);
const curse_type *ct_find(const char *c);
void ct_register(const curse_type *);
void ct_checknames(void);
/* Regionszauber */
curse *cfindhash(int i);
@ -304,8 +302,8 @@ extern "C" {
int resolve_curse(variant data, void *address);
bool is_cursed_with(const struct attrib *ap, const struct curse *c);
bool curse_active(const struct curse *c);
/* gibt true, wenn der Curse nicht NULL oder inaktiv ist */
bool curse_active(const struct curse *c);
/*** COMPATIBILITY MACROS. DO NOT USE FOR NEW CODE, REPLACE IN OLD CODE: */
const char *oldcursename(int id);

View File

@ -29,8 +29,9 @@
#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 JSON_REPORT_VERSION 346 /* bit 3 in f->options flags the json report */
#define EXPLICIT_CURSE_ISNEW_VERSION 347 /* CURSE_ISNEW is not reset in read/write, but in age() */
#define RELEASE_VERSION JSON_REPORT_VERSION /* current datafile */
#define RELEASE_VERSION EXPLICIT_CURSE_ISNEW_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 */