Remove the use of the spelldaten[] array. Replace with registration of spells.

First step towards getting the spell implementations out of the kernel and into gamecode (separate spells from the spell datatype)
This commit is contained in:
Enno Rehling 2004-04-10 20:25:40 +00:00
parent 2e8f8e28a3
commit 592ac0ce03
17 changed files with 3454 additions and 3543 deletions

View File

@ -179,10 +179,7 @@ int
season(int turn) season(int turn)
{ {
int year,month; int year,month;
int t = turn; int t = turn - FirstTurn();
#ifdef FIRST_TURN
t -= FIRST_TURN;
#endif
year = t/(months_per_year * weeks_per_month) + 1; year = t/(months_per_year * weeks_per_month) + 1;
month = (t - (year-1) * months_per_year * weeks_per_month)/weeks_per_month; month = (t - (year-1) * months_per_year * weeks_per_month)/weeks_per_month;
@ -198,7 +195,7 @@ gamedate(const struct locale * lang)
{ {
int year,month,week,r; int year,month,week,r;
static char buf[256]; static char buf[256];
int t = turn - FIRST_TURN; int t = turn - FirstTurn();
if (t<0) t = turn; if (t<0) t = turn;
assert(lang); assert(lang);
@ -222,10 +219,7 @@ gamedate_season(const struct locale * lang)
{ {
int year,month,week,r; int year,month,week,r;
static char buf[256]; static char buf[256];
int t = turn; int t = turn - FirstTurn();
#ifdef FIRST_TURN
t -= FIRST_TURN;
#endif
if (t<0) t = turn; if (t<0) t = turn;
assert(lang); assert(lang);
@ -249,10 +243,7 @@ gamedate2(const struct locale * lang)
{ {
int year,month,week,r; int year,month,week,r;
static char buf[256]; static char buf[256];
int t = turn; int t = turn - FirstTurn();
#ifdef FIRST_TURN
t -= FIRST_TURN;
#endif
if (t<0) t = turn; if (t<0) t = turn;
@ -273,10 +264,7 @@ gamedate_short(const struct locale * lang)
{ {
int year,month,week,r; int year,month,week,r;
static char buf[256]; static char buf[256];
int t = turn; int t = turn - FirstTurn();
#ifdef FIRST_TURN
t -= FIRST_TURN;
#endif
if (t<0) t = turn; if (t<0) t = turn;

View File

@ -117,6 +117,17 @@ MaxAge(void) {
return value; return value;
} }
int
FirstTurn(void)
{
static int value = -1;
if (value<0) {
const char * str = get_param(global.parameters, "hunger.long");
value = str?atoi(str):0;
}
return value;
}
int int
LongHunger(void) { LongHunger(void) {
static int value = -1; static int value = -1;
@ -2876,12 +2887,10 @@ int months_per_year;
int int
month(int offset) month(int offset)
{ {
int t = turn + offset; int t = turn + offset - FirstTurn();
int year, r, month; int year, r, month;
#ifdef FIRST_TURN
t -= FIRST_TURN; if (t<0) t = turn;
#endif
if (t<0) t = turn;
year = t/(months_per_year * weeks_per_month) + 1; year = t/(months_per_year * weeks_per_month) + 1;
r = t - (year-1) * months_per_year * weeks_per_month; r = t - (year-1) * months_per_year * weeks_per_month;

View File

@ -1172,6 +1172,7 @@ extern const char * dbrace(const struct race * rc);
extern void set_param(struct param ** p, const char * name, const char * data); extern void set_param(struct param ** p, const char * name, const char * data);
extern const char* get_param(const struct param * p, const char * name); extern const char* get_param(const struct param * p, const char * name);
extern int FirstTurn(void);
extern int NMRTimeout(void); extern int NMRTimeout(void);
extern int LongHunger(void); extern int LongHunger(void);
extern boolean TradeDisabled(void); extern boolean TradeDisabled(void);

View File

@ -292,22 +292,21 @@ find_magetype(const unit * u)
static void static void
createspelllist(unit *u, magic_t mtyp) createspelllist(unit *u, magic_t mtyp)
{ {
int sk, i; spell_list * slist;
if (mtyp == M_GRAU) int sk;
return;
sk = effskill(u, SK_MAGIC); if (mtyp == M_GRAU) return;
if (sk == 0)
return;
for (i = 0; spelldaten[i].id != SPL_NOSPELL; i++) { sk = effskill(u, SK_MAGIC);
if (spelldaten[i].magietyp == mtyp if (sk == 0) return;
&& spelldaten[i].level <= sk)
{ for (slist=spells;slist!=NULL;slist=slist->next) {
if (!getspell(u, spelldaten[i].id)) spell * sp = slist->data;
addspell(u, spelldaten[i].id); if (sp->magietyp == mtyp && sp->level <= sk) {
} if (!has_spell(u, sp))
} addspell(u, sp->id);
}
}
} }
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
@ -366,57 +365,55 @@ void
updatespelllist(unit * u) updatespelllist(unit * u)
{ {
int max = eff_skill(u, SK_MAGIC, u->region); int max = eff_skill(u, SK_MAGIC, u->region);
int sk = max; int sk = max;
spell_list * slist;
spell * sp; spell * sp;
magic_t gebiet = find_magetype(u); magic_t gebiet = find_magetype(u);
boolean ismonster = u->faction->no==MONSTER_FACTION; boolean ismonster = u->faction->no==MONSTER_FACTION;
/* Nur Orkmagier bekommen den Keuschheitsamulettzauber */ /* Nur Orkmagier bekommen den Keuschheitsamulettzauber */
if (old_race(u->race) == RC_ORC sp = find_spellbyid(SPL_ARTEFAKT_CHASTITYBELT);
&& !getspell(u, SPL_ARTEFAKT_CHASTITYBELT) if (old_race(u->race)==RC_ORC && !has_spell(u, sp) && sp->level<=max) {
&& find_spellbyid(SPL_ARTEFAKT_CHASTITYBELT)->level <= max) addspell(u, SPL_ARTEFAKT_CHASTITYBELT);
{ }
addspell(u, SPL_ARTEFAKT_CHASTITYBELT);
}
/* Nur Wyrm-Magier bekommen den Wyrmtransformationszauber */ /* Nur Wyrm-Magier bekommen den Wyrmtransformationszauber */
if (fspecial(u->faction, FS_WYRM) sp = find_spellbyid(SPL_BECOMEWYRM);
&& !getspell(u, SPL_BECOMEWYRM) if (fspecial(u->faction, FS_WYRM) && !has_spell(u, sp) && sp->level<=max) {
&& find_spellbyid(SPL_BECOMEWYRM)->level <= max) addspell(u, SPL_BECOMEWYRM);
{ }
addspell(u, SPL_BECOMEWYRM);
}
/* Transformierte Wyrm-Magier bekommen Drachenodem */ /* Transformierte Wyrm-Magier bekommen Drachenodem */
if (dragonrace(u->race)) { if (dragonrace(u->race)) {
race_t urc = old_race(u->race); race_t urc = old_race(u->race);
switch (urc) { switch (urc) {
/* keine breaks! Wyrme sollen alle drei Zauber können.*/ /* keine breaks! Wyrme sollen alle drei Zauber können.*/
case RC_WYRM: case RC_WYRM:
sp = find_spellbyid(SPL_WYRMODEM); sp = find_spellbyid(SPL_WYRMODEM);
if (sp!=NULL && !getspell(u, sp->id) && sp->level<=max) { if (sp!=NULL && !has_spell(u, sp) && sp->level<=max) {
addspell(u, sp->id); addspell(u, sp->id);
} }
case RC_DRAGON: case RC_DRAGON:
sp = find_spellbyid(SPL_DRAGONODEM); sp = find_spellbyid(SPL_DRAGONODEM);
if (sp!=NULL && !getspell(u, sp->id) && sp->level<=max) { if (sp!=NULL && !has_spell(u, sp) && sp->level<=max) {
addspell(u, sp->id); addspell(u, sp->id);
} }
case RC_FIREDRAGON: case RC_FIREDRAGON:
sp = find_spellbyid(SPL_FIREDRAGONODEM); sp = find_spellbyid(SPL_FIREDRAGONODEM);
if (sp!=NULL && getspell(u, sp->id) && sp->level<=max) { if (sp!=NULL && has_spell(u, sp) && sp->level<=max) {
addspell(u, sp->id); addspell(u, sp->id);
} }
break; break;
} }
} }
/* Magier mit keinem bzw M_GRAU bekommen weder Sprüche angezeigt noch /* Magier mit keinem bzw M_GRAU bekommen weder Sprüche angezeigt noch
* neue Sprüche in ihre List-of-known-spells. Das sind zb alle alten * neue Sprüche in ihre List-of-known-spells. Das sind zb alle alten
* Drachen, die noch den Skill Magie haben */ * Drachen, die noch den Skill Magie haben */
for (sp = spelldaten; sp->id != SPL_NOSPELL; ++sp) { for (slist=spells;slist!=NULL;slist=slist->next) {
boolean know = getspell(u, sp->id); spell * sp = slist->data;
boolean know = has_spell(u, sp);
if (know || (gebiet!=M_GRAU && sp->magietyp == gebiet && sp->level <= sk)) { if (know || (gebiet!=M_GRAU && sp->magietyp == gebiet && sp->level <= sk)) {
faction * f = u->faction; faction * f = u->faction;
@ -451,104 +448,17 @@ addspell(unit *u, spellid_t spellid)
} }
boolean boolean
getspell(const unit *u, spellid_t spellid) has_spell(const unit *u, const spell * sp)
{ {
sc_mage *m; spell_ptr *spt;
spell_ptr *spt; sc_mage * m = get_mage(u);
m = get_mage(u); if (m==NULL) return false;
if (!m) {
return false;
}
for (spt = m->spellptr; spt; spt = spt->next) {
if (spt->spellid == spellid) {
return true;
}
}
return false;
}
/* ------------------------------------------------------------- */ for (spt = m->spellptr; spt; spt = spt->next) {
/* Spruch identifizieren */ if (spt->spellid == sp->id) return true;
}
#include "umlaut.h" return false;
typedef struct spell_names {
struct spell_names * next;
const struct locale * lang;
magic_t mtype;
struct tnode names;
} spell_names;
static spell_names * spellnames;
static spell_names *
init_spellnames(const struct locale * lang, magic_t mtype)
{
int i;
spell_names * sn = calloc(sizeof(spell_names), 1);
sn->next = spellnames;
sn->lang = lang;
sn->mtype = mtype;
for (i=0; spelldaten[i].id != SPL_NOSPELL; i++) {
const char * n = spelldaten[i].sname;
if (spelldaten[i].magietyp!=mtype) continue;
if (spelldaten[i].info==NULL) n = locale_string(lang, mkname("spell", n));
addtoken(&sn->names, n, (void*)(spelldaten+i));
}
return spellnames = sn;
}
static spell_names *
get_spellnames(const struct locale * lang, magic_t mtype)
{
spell_names * sn = spellnames;
while (sn) {
if (sn->mtype==mtype && sn->lang==lang) break;
sn=sn->next;
}
if (!sn) return init_spellnames(lang, mtype);
return sn;
}
spell *
find_spellbyname(unit *u, const char *name, const struct locale * lang)
{
spell_ptr *spt;
sc_mage * m = get_mage(u);
spell * sp = NULL;
spell_names * sn;
if (!m) return NULL;
sn = get_spellnames(lang, m->magietyp);
if (findtoken(&sn->names, name, (void**)&sp)==E_TOK_NOMATCH) {
magic_t mtype;
for(mtype=0;mtype!=MAXMAGIETYP;++mtype) {
sn = get_spellnames(lang, mtype);
if (findtoken(&sn->names, name, (void**)&sp)!=E_TOK_NOMATCH) break;
}
}
if (sp!=NULL) {
for (spt = m->spellptr; spt; spt = spt->next) {
if (sp->id==spt->spellid) return sp;
}
}
if (lang==default_locale) return NULL;
return find_spellbyname(u, name, default_locale);
}
spell *
find_spellbyid(spellid_t id)
{
int i;
for (i = 0; spelldaten[i].id != SPL_NOSPELL; i++) {
if (spelldaten[i].id == id) {
return &spelldaten[i];
}
}
return (spell *) NULL;
} }
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
@ -601,7 +511,7 @@ set_combatspell(unit *u, spell *sp, const char * cmd, int level)
cmistake(u, cmd, 173, MSG_MAGIC); cmistake(u, cmd, 173, MSG_MAGIC);
return; return;
} }
if (getspell(u, sp->id) == false) { if (has_spell(u, sp) == false) {
/* Diesen Zauber kennt die Einheit nicht */ /* Diesen Zauber kennt die Einheit nicht */
cmistake(u, cmd, 169, MSG_MAGIC); cmistake(u, cmd, 169, MSG_MAGIC);
return; return;
@ -957,7 +867,7 @@ knowsspell(const region * r, const unit * u, const spell * sp)
return false; return false;
} }
/* steht der Spruch in der Spruchliste? */ /* steht der Spruch in der Spruchliste? */
if (getspell(u, sp->id) == false){ if (has_spell(u, sp) == false){
/* ist der Spruch aus einem anderen Magiegebiet? */ /* ist der Spruch aus einem anderen Magiegebiet? */
if (find_magetype(u) != sp->magietyp){ if (find_magetype(u) != sp->magietyp){
return false; return false;

View File

@ -125,25 +125,9 @@ typedef struct sc_mage {
struct spell_ptr *spellptr; struct spell_ptr *spellptr;
} sc_mage; } sc_mage;
/* ------------------------------------------------------------- */
/* Spruchstukturdefinition:
* id:
* SPL_NOSPELL muss der letzte Spruch in der Liste spelldaten[] sein,
* denn nicht auf die Reihenfolge in der Liste sondern auf die id wird
* geprüft
* rank:
* gibt die Priorität und damit die Reihenfolge an, in der der Spruch
* gezaubert wird.
* sptyp:
* besondere Spruchtypen (Artefakt, Regionszauber, Kampfzauber ..)
* Komponenten[Anzahl mögl. Items][Art:Anzahl:Faktor]
*
*/
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
/* Zauberliste */ /* Zauberliste */
typedef struct castorder { typedef struct castorder {
struct castorder *next; struct castorder *next;
void *magician; /* Magier (kann vom Typ struct unit oder fighter sein) */ void *magician; /* Magier (kann vom Typ struct unit oder fighter sein) */
@ -300,7 +284,7 @@ void unset_combatspell(struct unit *u, spell *sp);
/* löscht Kampfzauber */ /* löscht Kampfzauber */
void addspell(struct unit *u, spellid_t spellid); void addspell(struct unit *u, spellid_t spellid);
/* fügt den Spruch mit der Id spellid der Spruchliste der Einheit hinzu. */ /* fügt den Spruch mit der Id spellid der Spruchliste der Einheit hinzu. */
boolean getspell(const struct unit *u, spellid_t spellid); boolean has_spell(const struct unit *u, const struct spell * sp);
/* prüft, ob der Spruch in der Spruchliste der Einheit steht. */ /* prüft, ob der Spruch in der Spruchliste der Einheit steht. */
void updatespelllist(struct unit *u); void updatespelllist(struct unit *u);
/* fügt alle Zauber des Magiegebietes der Einheit, deren Stufe kleiner /* fügt alle Zauber des Magiegebietes der Einheit, deren Stufe kleiner

View File

@ -2056,136 +2056,139 @@ addally(const faction * f, ally ** sfp, int aid, int state)
faction * faction *
readfaction(FILE * F) readfaction(FILE * F)
{ {
ally **sfp; ally **sfp;
int planes; int planes;
int i = rid(F); int i = rid(F);
faction * f = findfaction(i); faction * f = findfaction(i);
if (f==NULL) { if (f==NULL) {
f = (faction *) calloc(1, sizeof(faction)); f = (faction *) calloc(1, sizeof(faction));
f->no = i; f->no = i;
} else { } else {
#ifdef MSG_LEVELS #ifdef MSG_LEVELS
f->warnings = NULL; /* mem leak */ f->warnings = NULL; /* mem leak */
#endif #endif
f->allies = NULL; /* mem leak */ f->allies = NULL; /* mem leak */
while (f->attribs) a_remove(&f->attribs, f->attribs); while (f->attribs) a_remove(&f->attribs, f->attribs);
} }
f->subscription = ri(F); f->subscription = ri(F);
#ifdef ALLIANCES #ifdef ALLIANCES
if (global.data_version>=ALLIANCES_VERSION) { if (global.data_version>=ALLIANCES_VERSION) {
int allianceid = rid(F); int allianceid = rid(F);
if (allianceid!=0) f->alliance = findalliance(allianceid); if (allianceid!=0) f->alliance = findalliance(allianceid);
if (f->alliance) { if (f->alliance) {
faction_list * flist = malloc(sizeof(faction_list)); faction_list * flist = malloc(sizeof(faction_list));
flist->data = f; flist->data = f;
flist->next = f->alliance->members; flist->next = f->alliance->members;
f->alliance->members = flist; f->alliance->members = flist;
} }
} }
#endif #endif
rds(F, &f->name); rds(F, &f->name);
#ifndef AMIGA #ifndef AMIGA
if (!quiet) printf(" - Lese Partei %s (%s)\n", f->name, factionid(f)); if (!quiet) printf(" - Lese Partei %s (%s)\n", f->name, factionid(f));
#endif #endif
rds(F, &f->banner); rds(F, &f->banner);
rds(F, &f->email); rds(F, &f->email);
rds(F, &f->passw); rds(F, &f->passw);
if (global.data_version >= OVERRIDE_VERSION) { if (global.data_version >= OVERRIDE_VERSION) {
rds(F, &f->override); rds(F, &f->override);
} else { } else {
f->override = strdup(itoa36(rand())); f->override = strdup(itoa36(rand()));
} }
if (global.data_version < LOCALE_VERSION) { if (global.data_version < LOCALE_VERSION) {
f->locale = find_locale("de"); f->locale = find_locale("de");
} else { } else {
rs(F, buf); rs(F, buf);
f->locale = find_locale(buf); f->locale = find_locale(buf);
} }
f->lastorders = ri(F); f->lastorders = ri(F);
f->age = ri(F); f->age = ri(F);
if (global.data_version < NEWRACE_VERSION) { if (global.data_version < NEWRACE_VERSION) {
race_t rc = (char) ri(F); race_t rc = (char) ri(F);
f->race = new_race[rc]; f->race = new_race[rc];
} else { } else {
rs(F, buf); rs(F, buf);
f->race = rc_find(buf); f->race = rc_find(buf);
assert(f->race); assert(f->race);
} }
#ifdef CONVERT_DBLINK #ifdef CONVERT_DBLINK
convertunique(f); convertunique(f);
#endif #endif
f->magiegebiet = (magic_t)ri(F); f->magiegebiet = (magic_t)ri(F);
if (!playerrace(f->race)) { if (!playerrace(f->race)) {
f->lastorders = turn+1; f->lastorders = turn+1;
} }
f->karma = ri(F); f->karma = ri(F);
f->flags = ri(F); f->flags = ri(F);
freset(f, FFL_OVERRIDE); freset(f, FFL_OVERRIDE);
a_read(F, &f->attribs); a_read(F, &f->attribs);
#ifdef MSG_LEVELS #ifdef MSG_LEVELS
read_msglevels(&f->warnings, F); read_msglevels(&f->warnings, F);
#else #else
for (;;) { for (;;) {
int level; int level;
fscanf(F, "%s", buf); fscanf(F, "%s", buf);
if (strcmp("end", buf)==0) break; if (strcmp("end", buf)==0) break;
fscanf(F, "%d ", &level); fscanf(F, "%d ", &level);
} }
#endif #endif
planes = ri(F); planes = ri(F);
while(--planes >= 0) { while(--planes >= 0) {
int id = ri(F); int id = ri(F);
int ux = ri(F); int ux = ri(F);
int uy = ri(F); int uy = ri(F);
set_ursprung(f, id, ux, uy); set_ursprung(f, id, ux, uy);
} }
f->newbies = 0; f->newbies = 0;
f->options = ri(F);
i = f->options = ri(F);
if (((f->options & Pow(O_REPORT)) == 0) if ((i & Pow(O_REPORT))==0 && (i & Pow(O_COMPUTER))==0) {
&& (f->options & Pow(O_COMPUTER)) == 0) { /* Kein Report eingestellt, Fehler */
/* Kein Report eingestellt, Fehler */ f->options = f->options | Pow(O_REPORT) | Pow(O_ZUGVORLAGE);
f->options = f->options | Pow(O_REPORT) | Pow(O_ZUGVORLAGE); }
}
if (global.data_version < TYPES_VERSION) { if (global.data_version < TYPES_VERSION) {
int i, sk = ri(F); /* f->seenspell überspringen */ int sk = ri(F); /* f->seenspell überspringen */
for (i = 0; spelldaten[i].id != SPL_NOSPELL; i++) { spell_list * slist;
if (spelldaten[i].magietyp == f->magiegebiet && spelldaten[i].level <= sk) { for (slist=spells;slist!=NULL;slist=slist->next) {
a_add(&f->attribs, a_new(&at_seenspell))->data.i = spelldaten[i].id; spell * sp = slist->data;
}
}
}
sfp = &f->allies; if (sp->magietyp==f->magiegebiet && sp->level<=sk) {
if (global.data_version<ALLIANCES_VERSION) { a_add(&f->attribs, a_new(&at_seenspell))->data.i = sp->id;
int p = ri(F); }
while (--p >= 0) { }
int aid = rid(F); }
int state = ri(F);
addally(f, sfp, aid, state); sfp = &f->allies;
} if (global.data_version<ALLIANCES_VERSION) {
} else { int p = ri(F);
for (;;) { while (--p >= 0) {
rs(F, buf); int aid = rid(F);
if (strcmp(buf, "end")==0) break; int state = ri(F);
else { addally(f, sfp, aid, state);
int aid = atoi36(buf); }
int state = ri(F); } else {
addally(f, sfp, aid, state); for (;;) {
} rs(F, buf);
} if (strcmp(buf, "end")==0) break;
} else {
read_groups(F, f); int aid = atoi36(buf);
int state = ri(F);
addally(f, sfp, aid, state);
}
}
}
read_groups(F, f);
#ifdef REGIONOWNERS #ifdef REGIONOWNERS
read_enemies(F, f); read_enemies(F, f);
#endif #endif
return f; return f;
} }
void void

File diff suppressed because it is too large Load Diff

View File

@ -1,16 +1,16 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* *
* Eressea PB(E)M host Copyright (C) 1998-2003 * Eressea PB(E)M host Copyright (C) 1998-2003
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
* Henning Peters (faroul@beyond.kn-bremen.de) * Henning Peters (faroul@beyond.kn-bremen.de)
* Enno Rehling (enno@eressea-pbem.de) * Enno Rehling (enno@eressea-pbem.de)
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de) * Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
* *
* This program may not be used, modified or distributed without * This program may not be used, modified or distributed without
* prior permission by the authors of Eressea. * prior permission by the authors of Eressea.
*/ */
#ifndef H_KRNL_SPELLS #ifndef H_KRNL_SPELLS
#define H_KRNL_SPELLS #define H_KRNL_SPELLS
@ -18,275 +18,278 @@
extern "C" { extern "C" {
#endif #endif
struct fighter; struct fighter;
struct spell; struct spell;
struct border_type; struct border_type;
struct attrib_type; struct attrib_type;
struct curse_type; struct curse_type;
struct castorder; struct castorder;
struct curse; struct curse;
/* Sprüche. Neue NUR hinten anfügen, oder das Datenfile geht kaputt */ /* Sprüche. Neue NUR hinten anfügen, oder das Datenfile geht kaputt */
enum { enum {
SPL_NOSPELL, SPL_NOSPELL,
SPL_ARTEFAKT_OF_POWER, SPL_ARTEFAKT_OF_POWER,
SPL_ARTEFAKT_OF_AURAPOWER, SPL_ARTEFAKT_OF_AURAPOWER,
SPL_ARTEFAKT_OF_REGENERATION, SPL_ARTEFAKT_OF_REGENERATION,
SPL_FIREBALL, SPL_FIREBALL,
SPL_HAGEL, SPL_HAGEL,
SPL_RUSTWEAPON, SPL_RUSTWEAPON,
SPL_COMBATRUST, SPL_COMBATRUST,
SPL_TREEGROW, SPL_TREEGROW,
SPL_HEALING, SPL_HEALING,
SPL_HEALINGSONG, SPL_HEALINGSONG,
SPL_BADDREAMS, SPL_BADDREAMS,
SPL_GOODDREAMS, SPL_GOODDREAMS,
SPL_DREAMREADING, SPL_DREAMREADING,
SPL_SWEETDREAMS, SPL_SWEETDREAMS,
SPL_TIREDSOLDIERS, SPL_TIREDSOLDIERS,
SPL_PLAGUE, SPL_PLAGUE,
SPL_MAGICBOOST, SPL_MAGICBOOST,
SPL_CHAOSROW, SPL_CHAOSROW,
SPL_SONG_OF_CONFUSION, SPL_SONG_OF_CONFUSION,
SPL_FLEE, SPL_FLEE,
SPL_SONG_OF_FEAR, SPL_SONG_OF_FEAR,
SPL_BERSERK, SPL_BERSERK,
SPL_BLOODTHIRST, SPL_BLOODTHIRST,
SPL_MAELSTROM, SPL_MAELSTROM,
SPL_BLESSEDHARVEST, SPL_BLESSEDHARVEST,
SPL_RAINDANCE, SPL_RAINDANCE,
SPL_TRANSFERAURA_DRUIDE, SPL_TRANSFERAURA_DRUIDE,
SPL_TRANSFERAURA_BARDE, SPL_TRANSFERAURA_BARDE,
SPL_TRANSFERAURA_CHAOS, SPL_TRANSFERAURA_CHAOS,
SPL_TRANSFERAURA_TRAUM, SPL_TRANSFERAURA_TRAUM,
SPL_TRANSFERAURA_ASTRAL, SPL_TRANSFERAURA_ASTRAL,
SPL_STONEGOLEM, SPL_STONEGOLEM,
SPL_IRONGOLEM, SPL_IRONGOLEM,
SPL_SUMMONSHADOW, SPL_SUMMONSHADOW,
SPL_SUMMONSHADOWLORDS, SPL_SUMMONSHADOWLORDS,
SPL_REELING_ARROWS, SPL_REELING_ARROWS,
SPL_ANTIMAGICZONE, SPL_ANTIMAGICZONE,
SPL_CREATE_ANTIMAGICCRYSTAL, SPL_CREATE_ANTIMAGICCRYSTAL,
SPL_KAELTESCHUTZ, SPL_KAELTESCHUTZ,
SPL_STEALAURA, SPL_STEALAURA,
SPL_SUMMONUNDEAD, SPL_SUMMONUNDEAD,
SPL_AURALEAK, SPL_AURALEAK,
SPL_GREAT_DROUGHT, SPL_GREAT_DROUGHT,
SPL_STRONG_WALL, SPL_STRONG_WALL,
SPL_HOMESTONE, SPL_HOMESTONE,
SPL_DROUGHT, SPL_DROUGHT,
SPL_FOREST_FIRE, SPL_FOREST_FIRE,
SPL_STRENGTH, SPL_STRENGTH,
SPL_SUMMONENT, SPL_SUMMONENT,
SPL_DISTURBINGDREAMS, SPL_DISTURBINGDREAMS,
SPL_DENYATTACK, SPL_DENYATTACK,
SPL_SLEEP, SPL_SLEEP,
SPL_EARTHQUAKE, SPL_EARTHQUAKE,
SPL_IRONKEEPER, SPL_IRONKEEPER,
SPL_STORMWINDS, SPL_STORMWINDS,
SPL_GOODWINDS, SPL_GOODWINDS,
SPL_FLYING_SHIP, SPL_FLYING_SHIP,
SPL_SUMMON_ALP, SPL_SUMMON_ALP,
SPL_WINDSHIELD, SPL_WINDSHIELD,
SPL_RAISEPEASANTS, SPL_RAISEPEASANTS,
SPL_DEPRESSION, SPL_DEPRESSION,
SPL_HEADACHE, SPL_HEADACHE,
SPL_ARTEFAKT_NIMBLEFINGERRING, SPL_ARTEFAKT_NIMBLEFINGERRING,
SPL_ENTERASTRAL, SPL_ENTERASTRAL,
SPL_LEAVEASTRAL, SPL_LEAVEASTRAL,
SPL_SHOWASTRAL, SPL_SHOWASTRAL,
SPL_VERSTEINERN, SPL_VERSTEINERN,
SPL_TREEWALKENTER, SPL_TREEWALKENTER,
SPL_TREEWALKEXIT, SPL_TREEWALKEXIT,
SPL_CHAOSSUCTION, SPL_CHAOSSUCTION,
SPL_VIEWREALITY, SPL_VIEWREALITY,
SPL_DISRUPTASTRAL, SPL_DISRUPTASTRAL,
SPL_SEDUCE, SPL_SEDUCE,
SPL_PUMP, SPL_PUMP,
SPL_CALM_MONSTER, SPL_CALM_MONSTER,
SPL_HERO, SPL_HERO,
SPL_FRIGHTEN, SPL_FRIGHTEN,
SPL_MINDBLAST, SPL_MINDBLAST,
SPL_SPEED, SPL_SPEED,
SPL_SPEED2, SPL_SPEED2,
SPL_FIREDRAGONODEM, SPL_FIREDRAGONODEM,
SPL_DRAGONODEM, SPL_DRAGONODEM,
SPL_WYRMODEM, /* 83 */ SPL_WYRMODEM, /* 83 */
SPL_MAGICSTREET, SPL_MAGICSTREET,
SPL_REANIMATE, SPL_REANIMATE,
SPL_RECRUIT, SPL_RECRUIT,
SPL_GENEROUS, SPL_GENEROUS,
SPL_PERMTRANSFER, SPL_PERMTRANSFER,
SPL_SONG_OF_PEACE, SPL_SONG_OF_PEACE,
SPL_MIGRANT, SPL_MIGRANT,
SPL_RALLYPEASANTMOB, SPL_RALLYPEASANTMOB,
SPL_RAISEPEASANTMOB, SPL_RAISEPEASANTMOB,
SPL_ILL_SHAPESHIFT, SPL_ILL_SHAPESHIFT,
SPL_WOLFHOWL, SPL_WOLFHOWL,
SPL_FOG_OF_CONFUSION, SPL_FOG_OF_CONFUSION,
SPL_DREAM_OF_CONFUSION, SPL_DREAM_OF_CONFUSION,
SPL_RESISTMAGICBONUS, SPL_RESISTMAGICBONUS,
SPL_KEEPLOOT, SPL_KEEPLOOT,
SPL_SCHILDRUNEN, SPL_SCHILDRUNEN,
SPL_SONG_RESISTMAGIC, SPL_SONG_RESISTMAGIC,
SPL_SONG_SUSCEPTMAGIC, SPL_SONG_SUSCEPTMAGIC,
SPL_ANALYSEMAGIC, SPL_ANALYSEMAGIC,
SPL_ANALYSEDREAM, SPL_ANALYSEDREAM,
SPL_UNIT_ANALYSESONG, SPL_UNIT_ANALYSESONG,
SPL_OBJ_ANALYSESONG, SPL_OBJ_ANALYSESONG,
SPL_TYBIED_DESTROY_MAGIC, SPL_TYBIED_DESTROY_MAGIC,
SPL_DESTROY_MAGIC, SPL_DESTROY_MAGIC,
SPL_METEORRAIN, SPL_METEORRAIN,
SPL_REDUCESHIELD, SPL_REDUCESHIELD,
SPL_ARMORSHIELD, SPL_ARMORSHIELD,
SPL_DEATHCLOUD, SPL_DEATHCLOUD,
SPL_ORKDREAM, SPL_ORKDREAM,
SPL_SUMMONDRAGON, SPL_SUMMONDRAGON,
SPL_READMIND, SPL_READMIND,
SPL_BABBLER, SPL_BABBLER,
SPL_MOVECASTLE, SPL_MOVECASTLE,
SPL_BLESSSTONECIRCLE, SPL_BLESSSTONECIRCLE,
SPL_ILLAUN_FAMILIAR, SPL_ILLAUN_FAMILIAR,
SPL_GWYRRD_FAMILIAR, SPL_GWYRRD_FAMILIAR,
SPL_DRAIG_FAMILIAR, SPL_DRAIG_FAMILIAR,
SPL_CERDDOR_FAMILIAR, SPL_CERDDOR_FAMILIAR,
SPL_TYBIED_FAMILIAR, SPL_TYBIED_FAMILIAR,
SPL_SONG_OF_ENSLAVE, SPL_SONG_OF_ENSLAVE,
SPL_TRUESEEING_GWYRRD, SPL_TRUESEEING_GWYRRD,
SPL_TRUESEEING_DRAIG, SPL_TRUESEEING_DRAIG,
SPL_TRUESEEING_ILLAUN, SPL_TRUESEEING_ILLAUN,
SPL_TRUESEEING_CERDDOR, SPL_TRUESEEING_CERDDOR,
SPL_TRUESEEING_TYBIED, SPL_TRUESEEING_TYBIED,
SPL_INVISIBILITY_GWYRRD, SPL_INVISIBILITY_GWYRRD,
SPL_INVISIBILITY_DRAIG, SPL_INVISIBILITY_DRAIG,
SPL_INVISIBILITY_ILLAUN, SPL_INVISIBILITY_ILLAUN,
SPL_INVISIBILITY_CERDDOR, SPL_INVISIBILITY_CERDDOR,
SPL_INVISIBILITY_TYBIED, SPL_INVISIBILITY_TYBIED,
SPL_ARTEFAKT_CHASTITYBELT, SPL_ARTEFAKT_CHASTITYBELT,
SPL_ARTEFAKT_RUNESWORD, SPL_ARTEFAKT_RUNESWORD,
SPL_FUMBLECURSE, SPL_FUMBLECURSE,
SPL_ICASTLE, SPL_ICASTLE,
SPL_GWYRRD_DESTROY_MAGIC, SPL_GWYRRD_DESTROY_MAGIC,
SPL_DRAIG_DESTROY_MAGIC, SPL_DRAIG_DESTROY_MAGIC,
SPL_ILLAUN_DESTROY_MAGIC, SPL_ILLAUN_DESTROY_MAGIC,
SPL_CERDDOR_DESTROY_MAGIC, SPL_CERDDOR_DESTROY_MAGIC,
SPL_GWYRRD_ARMORSHIELD, SPL_GWYRRD_ARMORSHIELD,
SPL_DRAIG_FUMBLESHIELD, SPL_DRAIG_FUMBLESHIELD,
SPL_GWYRRD_FUMBLESHIELD, SPL_GWYRRD_FUMBLESHIELD,
SPL_CERRDOR_FUMBLESHIELD, SPL_CERRDOR_FUMBLESHIELD,
SPL_TYBIED_FUMBLESHIELD, SPL_TYBIED_FUMBLESHIELD,
SPL_SHADOWKNIGHTS, SPL_SHADOWKNIGHTS,
SPL_FIRESWORD, SPL_FIRESWORD,
SPL_CREATE_TACTICCRYSTAL, SPL_CREATE_TACTICCRYSTAL,
SPL_ITEMCLOAK, SPL_ITEMCLOAK,
SPL_FIREWALL, SPL_FIREWALL,
SPL_WISPS, SPL_WISPS,
SPL_SPARKLE_CHAOS, SPL_SPARKLE_CHAOS,
SPL_SPARKLE_DREAM, SPL_SPARKLE_DREAM,
SPL_BAG_OF_HOLDING, SPL_BAG_OF_HOLDING,
SPL_PULLASTRAL, SPL_PULLASTRAL,
SPL_FETCHASTRAL, SPL_FETCHASTRAL,
SPL_ILLAUN_EARN_SILVER, SPL_ILLAUN_EARN_SILVER,
SPL_GWYRRD_EARN_SILVER, SPL_GWYRRD_EARN_SILVER,
SPL_DRAIG_EARN_SILVER, SPL_DRAIG_EARN_SILVER,
SPL_TYBIED_EARN_SILVER, SPL_TYBIED_EARN_SILVER,
SPL_CERDDOR_EARN_SILVER, SPL_CERDDOR_EARN_SILVER,
SPL_SHOCKWAVE, SPL_SHOCKWAVE,
SPL_UNDEADHERO, SPL_UNDEADHERO,
SPL_ARTEFAKT_SACK_OF_CONSERVATION, SPL_ARTEFAKT_SACK_OF_CONSERVATION,
SPL_BECOMEWYRM, SPL_BECOMEWYRM,
SPL_ETERNIZEWALL, SPL_ETERNIZEWALL,
SPL_PUTTOREST, SPL_PUTTOREST,
SPL_UNHOLYPOWER, SPL_UNHOLYPOWER,
SPL_HOLYGROUND, SPL_HOLYGROUND,
SPL_BLOODSACRIFICE, SPL_BLOODSACRIFICE,
SPL_MALLORN, SPL_MALLORN,
SPL_CLONECOPY, SPL_CLONECOPY,
SPL_DRAINODEM, /* 174? */ SPL_DRAINODEM, /* 174? */
SPL_AURA_OF_FEAR, /* 175? */ SPL_AURA_OF_FEAR, /* 175? */
SPL_SHADOWCALL, /* 176? */ SPL_SHADOWCALL, /* 176? */
SPL_MALLORNTREEGROW, SPL_MALLORNTREEGROW,
SPL_INVISIBILITY2_ILLAUN, SPL_INVISIBILITY2_ILLAUN,
SPL_BIGRECRUIT, SPL_BIGRECRUIT,
SPL_IMMOLATION, SPL_IMMOLATION,
SPL_FIREODEM, /* 181 */ SPL_FIREODEM, /* 181 */
SPL_ICEODEM, SPL_ICEODEM,
SPL_ACIDODEM, SPL_ACIDODEM,
#ifdef WDW_PYRAMIDSPELL #ifdef WDW_PYRAMIDSPELL
SPL_WDWPYRAMID_TRAUM, SPL_WDWPYRAMID_TRAUM,
SPL_WDWPYRAMID_ASTRAL, SPL_WDWPYRAMID_ASTRAL,
SPL_WDWPYRAMID_DRUIDE, SPL_WDWPYRAMID_DRUIDE,
SPL_WDWPYRAMID_BARDE, SPL_WDWPYRAMID_BARDE,
SPL_WDWPYRAMID_CHAOS, SPL_WDWPYRAMID_CHAOS,
#endif #endif
MAXALLSPELLS, MAXALLSPELLS,
NO_SPELL = (spellid_t) -1 NO_SPELL = (spellid_t) -1
}; };
/* Prototypen */ /* Prototypen */
void do_shock(struct unit *u, const char *reason); void do_shock(struct unit *u, const char *reason);
int use_item_power(struct region * r, struct unit * u); int use_item_power(struct region * r, struct unit * u);
int use_item_regeneration(struct region * r, struct unit * u); int use_item_regeneration(struct region * r, struct unit * u);
void showspells(struct region *r, struct unit *u); void showspells(struct region *r, struct unit *u);
int sp_antimagiczone(struct castorder *co); int sp_antimagiczone(struct castorder *co);
extern double destr_curse(struct curse* c, int cast_level, double force); extern double destr_curse(struct curse* c, int cast_level, double force);
/* Kampfzauber */
extern int sp_fumbleshield(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_shadowknights(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_combatrosthauch(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_kampfzauber(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_healing(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_keeploot(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_reanimate(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_chaosrow(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_flee(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_berserk(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_tiredsoldiers(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_reeling_arrows(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_denyattack(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_sleep(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_windshield(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_strong_wall(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_versteinern(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_hero(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_frighten(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_mindblast(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_speed(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_wolfhowl(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_dragonodem(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_reduceshield(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_armorshield(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_stun(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_undeadhero(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_shadowcall(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_immolation(struct fighter * fi, int level, double power, struct spell * sp);
/* ------------------------------------------------------------- */ /* Kampfzauber */
extern int sp_fumbleshield(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_shadowknights(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_combatrosthauch(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_kampfzauber(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_healing(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_keeploot(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_reanimate(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_chaosrow(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_flee(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_berserk(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_tiredsoldiers(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_reeling_arrows(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_denyattack(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_sleep(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_windshield(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_strong_wall(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_versteinern(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_hero(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_frighten(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_mindblast(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_speed(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_wolfhowl(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_dragonodem(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_reduceshield(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_armorshield(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_stun(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_undeadhero(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_shadowcall(struct fighter * fi, int level, double power, struct spell * sp);
extern int sp_immolation(struct fighter * fi, int level, double power, struct spell * sp);
/* ------------------------------------------------------------- */
#if USE_FIREWALL #if USE_FIREWALL
/* für Feuerwände: in movement muß das noch explizit getestet werden. /* für Feuerwände: in movement muß das noch explizit getestet werden.
* besser wäre eine blcok_type::move() routine, die den effekt * besser wäre eine blcok_type::move() routine, die den effekt
* der Bewegung auf eine struct unit anwendet. * der Bewegung auf eine struct unit anwendet.
*/ */
extern struct border_type bt_firewall; extern struct border_type bt_firewall;
extern struct border_type bt_wisps; extern struct border_type bt_wisps;
typedef struct wall_data { typedef struct wall_data {
struct unit * mage; struct unit * mage;
int force; int force;
boolean active; boolean active;
} wall_data; } wall_data;
#endif #endif
extern struct attrib_type at_cursewall; extern struct attrib_type at_cursewall;
extern struct attrib_type at_unitdissolve; extern struct attrib_type at_unitdissolve;
#ifdef WDW_PYRAMIDSPELL #ifdef WDW_PYRAMIDSPELL
extern struct attrib_type at_wdwpyramid; extern struct attrib_type at_wdwpyramid;
#endif #endif
extern struct spell spelldaten[];
extern struct spell_list * spells;
extern void init_spells(void);
extern void register_spell(struct spell * sp);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -62,7 +62,7 @@ xml_to_locale(const xmlChar * xmlStr)
static char zText[1024]; static char zText[1024];
char * inbuf = (char*)xmlStr; char * inbuf = (char*)xmlStr;
char * outbuf = zText; char * outbuf = zText;
size_t inbytes = strlen(xmlStr)+1; size_t inbytes = strlen((const char*)xmlStr)+1;
size_t outbytes = sizeof(zText); size_t outbytes = sizeof(zText);
if (context==(iconv_t)-1) { if (context==(iconv_t)-1) {
@ -926,15 +926,15 @@ xml_readstrings(xmlXPathContextPtr xpath, xmlNodePtr * nodeTab, int nodeNr, bool
xmlChar * text; xmlChar * text;
xml_readtext(textNode, &lang, &text); xml_readtext(textNode, &lang, &text);
if (text!=NULL) { if (text!=NULL) {
assert(strcmp(zName, xml_cleanup_string(zName))==0); assert(strcmp(zName, (const char*)xml_cleanup_string(BAD_CAST zName))==0);
xml_cleanup_string(text); xml_cleanup_string(text);
locale_setstring(lang, zName, xml_to_locale(text)); locale_setstring(lang, zName, xml_to_locale(text));
xmlFree(text); xmlFree(text);
} else { } else {
log_warning(("string %s has no text in locale %s\n", log_warning(("string %s has no text in locale %s\n",
zName, locale_name(lang))); zName, locale_name(lang)));
} }
} }
xmlXPathFreeObject(result); xmlXPathFreeObject(result);
} }
@ -946,7 +946,6 @@ parse_strings(xmlDocPtr doc)
xmlXPathContextPtr xpath = xmlXPathNewContext(doc); xmlXPathContextPtr xpath = xmlXPathNewContext(doc);
xmlXPathObjectPtr strings; xmlXPathObjectPtr strings;
/* TODO: remember namespaces */
/* reading eressea/strings/string */ /* reading eressea/strings/string */
strings = xmlXPathEvalExpression(BAD_CAST "/eressea/strings/string", xpath); strings = xmlXPathEvalExpression(BAD_CAST "/eressea/strings/string", xpath);
xml_readstrings(xpath, strings->nodesetval->nodeTab, strings->nodesetval->nodeNr, false); xml_readstrings(xpath, strings->nodesetval->nodeTab, strings->nodesetval->nodeNr, false);

View File

@ -49,7 +49,3 @@
#define MAILITPATH "/usr/sbin:$HOME/eressea/bin:/bin:/usr/bin:/usr/local/bin" #define MAILITPATH "/usr/sbin:$HOME/eressea/bin:/bin:/usr/bin:/usr/local/bin"
/* Krücke für die Berechnung der Jahreszeiten in Eressea */
#define FIRST_TURN 184

View File

@ -20,9 +20,6 @@
#include <curse.h> #include <curse.h>
/*
#include "firewall.h"
*/
struct curse_type; struct curse_type;
extern const struct curse_type ct_firewall; extern const struct curse_type ct_firewall;
extern void ct_register(const struct curse_type * ct); extern void ct_register(const struct curse_type * ct);
@ -30,9 +27,9 @@ extern void ct_register(const struct curse_type * ct);
void void
register_spells(void) register_spells(void)
{ {
/* sp_summon_alp */ /* sp_summon_alp */
register_alp(); register_alp();
/* init_firewall(); */ /* init_firewall(); */
ct_register(&ct_firewall); ct_register(&ct_firewall);
register_curses(); register_curses();
} }

View File

@ -18,7 +18,7 @@
extern "C" { extern "C" {
#endif #endif
extern void register_spells(void); extern void register_spells(void);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -269,54 +269,46 @@ attrib_type at_roadfix = {
static void static void
show_newspells(void) show_newspells(void)
{ {
region *r; region *r;
/* Alle geänderten Zauber in das array newspellids[]. mit SPL_NOSPELL /* Alle geänderten Zauber in das array newspellids[]. mit SPL_NOSPELL
* terminieren */ * terminieren */
spellid_t newspellids[] = { spellid_t newspellids[] = {
#ifdef WDW_PHOENIX SPL_NOSPELL
SPL_WDWPYRAMID_TRAUM, };
SPL_WDWPYRAMID_ASTRAL,
SPL_WDWPYRAMID_DRUIDE,
SPL_WDWPYRAMID_BARDE,
SPL_WDWPYRAMID_CHAOS,
#endif
SPL_NOSPELL
};
/* die id's der neuen oder veränderten Sprüche werden in newspellids[] /* die id's der neuen oder veränderten Sprüche werden in newspellids[]
* abgelegt */ * abgelegt */
for(r=regions; r; r=r->next) { for(r=regions; r; r=r->next) {
unit *u; unit *u;
for(u=r->units;u;u=u->next) { for(u=r->units;u;u=u->next) {
sc_mage *m = get_mage(u); sc_mage *m = get_mage(u);
if (u->faction->no == MONSTER_FACTION) continue; if (u->faction->no == MONSTER_FACTION) continue;
if (m != NULL) { if (m != NULL) {
int i; int i;
if (m->magietyp == M_GRAU) continue; if (m->magietyp == M_GRAU) continue;
for (i = 0; newspellids[i] != SPL_NOSPELL; i++) { for (i = 0; newspellids[i] != SPL_NOSPELL; i++) {
spell *sp = find_spellbyid(newspellids[i]); spell *sp = find_spellbyid(newspellids[i]);
if (!sp) continue; if (!sp) continue;
if (m->magietyp == sp->magietyp || getspell(u, sp->id)) {
attrib * a = a_find(u->faction->attribs, &at_reportspell);
while (a && a->data.i != sp->id) a = a->nexttype;
if (!a) {
/* spell is not being shown yet. if seen before, remove to show again */
a = a_find(u->faction->attribs, &at_seenspell);
while (a && a->data.i != sp->id) a = a->nexttype;
if (a) a_remove(&u->faction->attribs, a);
}
}
}
}
}
}
if (m->magietyp == sp->magietyp || has_spell(u, sp)) {
attrib * a = a_find(u->faction->attribs, &at_reportspell);
while (a && a->data.i != sp->id) a = a->nexttype;
if (!a) {
/* spell is not being shown yet. if seen before, remove to show again */
a = a_find(u->faction->attribs, &at_seenspell);
while (a && a->data.i != sp->id) a = a->nexttype;
if (a) a_remove(&u->faction->attribs, a);
}
}
}
}
}
}
} }
static int static int

View File

@ -149,14 +149,15 @@ static void
unit_addspell(unit& u, const char * name) unit_addspell(unit& u, const char * name)
{ {
bool add = false; bool add = false;
spell * sp = spelldaten; spell_list * slist = spells;
while (sp->id!=SPL_NOSPELL) { while (slist!=NULL) {
spell * sp = slist->data;
if (strcmp(name, sp->sname)==0) { if (strcmp(name, sp->sname)==0) {
if (add) log_error(("two spells are called %s.\n", name)); if (add) log_error(("two spells are called %s.\n", name));
addspell(&u, sp->id); addspell(&u, sp->id);
add = true; add = true;
} }
++sp; slist=slist->next;
} }
if (!add) log_error(("spell %s could not be found\n", name)); if (!add) log_error(("spell %s could not be found\n", name));
} }
@ -164,7 +165,7 @@ unit_addspell(unit& u, const char * name)
static bool static bool
unit_isfamiliar(const unit& u) unit_isfamiliar(const unit& u)
{ {
return is_familiar(&u); return is_familiar(&u)!=0;
} }
static void static void

View File

@ -178,6 +178,7 @@ game_init(void)
init_locales(); init_locales();
init_attributes(); init_attributes();
init_spells();
init_races(); init_races();
init_items(); init_items();
init_races(); init_races();

View File

@ -65,6 +65,7 @@
#include <kernel/building.h> #include <kernel/building.h>
#include <kernel/faction.h> #include <kernel/faction.h>
#include <kernel/item.h> #include <kernel/item.h>
#include <kernel/spell.h>
#include <kernel/message.h> #include <kernel/message.h>
#include <kernel/plane.h> #include <kernel/plane.h>
#include <kernel/race.h> #include <kernel/race.h>
@ -182,6 +183,7 @@ game_init(void)
/* init_resources(); must be done inside the xml-read, because requirements use items */ /* init_resources(); must be done inside the xml-read, because requirements use items */
init_attributes(); init_attributes();
init_spells();
init_races(); init_races();
init_items(); init_items();
init_economy(); init_economy();

View File

@ -1724,6 +1724,7 @@ main(int argc, char *argv[])
init_locales(); init_locales();
init_attributes(); init_attributes();
init_spells();
init_resources(); init_resources();
#if NEW_RESOURCEGROWTH #if NEW_RESOURCEGROWTH