new datafile version: spell names are now unique (or will be soon), and writing the magic school with each is irrelevant.

This commit is contained in:
Enno Rehling 2012-05-23 15:19:21 -07:00
parent db7ed24b3e
commit f45a494277
3 changed files with 12 additions and 9 deletions

View File

@ -344,7 +344,7 @@ sc_mage *get_mage(const unit * u)
static int read_seenspell(attrib * a, void *owner, struct storage *store) static int read_seenspell(attrib * a, void *owner, struct storage *store)
{ {
int i; int i;
spell *sp = NULL; spell *sp = 0;
char token[32]; char token[32];
store->r_tok_buf(store, token, sizeof(token)); 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) { if (i != 0) {
sp = find_spellbyid((unsigned int) i); sp = find_spellbyid((unsigned int) i);
} else { } else {
int mtype; if (store->version<UNIQUE_SPELLS_VERSION) {
mtype = store->r_int(store); store->r_int(store); /* ignore mtype */
}
sp = find_spell(token); sp = find_spell(token);
if (!sp) { 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) { 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; const spell *sp = (const spell *)a->data.v;
store->w_tok(store, sp->sname); store->w_tok(store, sp->sname);
store->w_int(store, sp->magietyp);
} }
attrib_type at_seenspell = { attrib_type at_seenspell = {
@ -423,7 +423,7 @@ static boolean has_spell(quicklist * ql, const spell * sp)
} }
/** update the spellbook with a new level /** update the spellbook with a new level
* Written for Eressea 1.1 * Written for E3
*/ */
void update_spellbook(faction * f, int level) void update_spellbook(faction * f, int level)
{ {

View File

@ -158,13 +158,15 @@ typedef struct sc_mage {
char *sname; char *sname;
char *syntax; char *syntax;
char *parameter; char *parameter;
magic_t magietyp;
int sptyp; int sptyp;
int rank; /* Reihenfolge der Zauber */ int rank; /* Reihenfolge der Zauber */
int level; /* Stufe des Zaubers */
struct spell_component *components; struct spell_component *components;
spell_f cast; spell_f cast;
fumble_f patzer; 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; } spell;
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */

View File

@ -67,6 +67,7 @@
#define FOSS_VERSION 336 /* the open source release */ #define FOSS_VERSION 336 /* the open source release */
#define OWNER_2_VERSION 337 /* region owners contain an alliance */ #define OWNER_2_VERSION 337 /* region owners contain an alliance */
#define FIX_WATCHERS_VERSION 338 /* fixed storage of watchers */ #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 MIN_VERSION CURSETYPE_VERSION /* minimal datafile we support */
#define RELEASE_VERSION FIX_WATCHERS_VERSION /* current datafile */ #define RELEASE_VERSION UNIQUE_SPELLS_VERSION /* current datafile */