From f45a49427780897e355f12a70fdbd5eafdde742b Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 23 May 2012 15:19:21 -0700 Subject: [PATCH] new datafile version: spell names are now unique (or will be soon), and writing the magic school with each is irrelevant. --- src/kernel/magic.c | 12 ++++++------ src/kernel/magic.h | 6 ++++-- src/kernel/version.h | 3 ++- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/kernel/magic.c b/src/kernel/magic.c index 2d8382fb8..1da2e01b8 100644 --- a/src/kernel/magic.c +++ b/src/kernel/magic.c @@ -344,7 +344,7 @@ sc_mage *get_mage(const unit * u) static int read_seenspell(attrib * a, void *owner, struct storage *store) { int i; - spell *sp = NULL; + spell *sp = 0; char token[32]; store->r_tok_buf(store, token, sizeof(token)); @@ -352,11 +352,12 @@ static int read_seenspell(attrib * a, void *owner, struct storage *store) if (i != 0) { sp = find_spellbyid((unsigned int) i); } else { - int mtype; - mtype = store->r_int(store); + if (store->versionr_int(store); /* ignore mtype */ + } sp = find_spell(token); if (!sp) { - log_error("read_seenspell: could not find spell '%s' in school '%s'\n", token, magic_school[mtype]); + log_error("read_seenspell: could not find spell '%s'\n", token); } } if (!sp) { @@ -371,7 +372,6 @@ write_seenspell(const attrib * a, const void *owner, struct storage *store) { const spell *sp = (const spell *)a->data.v; store->w_tok(store, sp->sname); - store->w_int(store, sp->magietyp); } attrib_type at_seenspell = { @@ -423,7 +423,7 @@ static boolean has_spell(quicklist * ql, const spell * sp) } /** update the spellbook with a new level -* Written for Eressea 1.1 +* Written for E3 */ void update_spellbook(faction * f, int level) { diff --git a/src/kernel/magic.h b/src/kernel/magic.h index 931ccf8f6..152e7118e 100644 --- a/src/kernel/magic.h +++ b/src/kernel/magic.h @@ -158,13 +158,15 @@ typedef struct sc_mage { char *sname; char *syntax; char *parameter; - magic_t magietyp; int sptyp; int rank; /* Reihenfolge der Zauber */ - int level; /* Stufe des Zaubers */ struct spell_component *components; spell_f cast; fumble_f patzer; + + /* this is not so much the spell's data, but the school's studying data */ + magic_t magietyp; + int level; /* Stufe des Zaubers */ } spell; /* ------------------------------------------------------------- */ diff --git a/src/kernel/version.h b/src/kernel/version.h index d2b6ba3b9..c179b99fb 100644 --- a/src/kernel/version.h +++ b/src/kernel/version.h @@ -67,6 +67,7 @@ #define FOSS_VERSION 336 /* the open source release */ #define OWNER_2_VERSION 337 /* region owners contain an alliance */ #define FIX_WATCHERS_VERSION 338 /* fixed storage of watchers */ +#define UNIQUE_SPELLS_VERSION 339 /* turn 775, spell names are now unique globally, not just per school */ #define MIN_VERSION CURSETYPE_VERSION /* minimal datafile we support */ -#define RELEASE_VERSION FIX_WATCHERS_VERSION /* current datafile */ +#define RELEASE_VERSION UNIQUE_SPELLS_VERSION /* current datafile */