forked from github/server
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:
parent
2e8f8e28a3
commit
592ac0ce03
|
@ -179,10 +179,7 @@ int
|
|||
season(int turn)
|
||||
{
|
||||
int year,month;
|
||||
int t = turn;
|
||||
#ifdef FIRST_TURN
|
||||
t -= FIRST_TURN;
|
||||
#endif
|
||||
int t = turn - FirstTurn();
|
||||
|
||||
year = t/(months_per_year * weeks_per_month) + 1;
|
||||
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;
|
||||
static char buf[256];
|
||||
int t = turn - FIRST_TURN;
|
||||
int t = turn - FirstTurn();
|
||||
|
||||
if (t<0) t = turn;
|
||||
assert(lang);
|
||||
|
@ -222,10 +219,7 @@ gamedate_season(const struct locale * lang)
|
|||
{
|
||||
int year,month,week,r;
|
||||
static char buf[256];
|
||||
int t = turn;
|
||||
#ifdef FIRST_TURN
|
||||
t -= FIRST_TURN;
|
||||
#endif
|
||||
int t = turn - FirstTurn();
|
||||
|
||||
if (t<0) t = turn;
|
||||
assert(lang);
|
||||
|
@ -249,10 +243,7 @@ gamedate2(const struct locale * lang)
|
|||
{
|
||||
int year,month,week,r;
|
||||
static char buf[256];
|
||||
int t = turn;
|
||||
#ifdef FIRST_TURN
|
||||
t -= FIRST_TURN;
|
||||
#endif
|
||||
int t = turn - FirstTurn();
|
||||
|
||||
if (t<0) t = turn;
|
||||
|
||||
|
@ -273,10 +264,7 @@ gamedate_short(const struct locale * lang)
|
|||
{
|
||||
int year,month,week,r;
|
||||
static char buf[256];
|
||||
int t = turn;
|
||||
#ifdef FIRST_TURN
|
||||
t -= FIRST_TURN;
|
||||
#endif
|
||||
int t = turn - FirstTurn();
|
||||
|
||||
if (t<0) t = turn;
|
||||
|
||||
|
|
|
@ -117,6 +117,17 @@ MaxAge(void) {
|
|||
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
|
||||
LongHunger(void) {
|
||||
static int value = -1;
|
||||
|
@ -2876,12 +2887,10 @@ int months_per_year;
|
|||
int
|
||||
month(int offset)
|
||||
{
|
||||
int t = turn + offset;
|
||||
int t = turn + offset - FirstTurn();
|
||||
int year, r, month;
|
||||
#ifdef FIRST_TURN
|
||||
t -= FIRST_TURN;
|
||||
#endif
|
||||
if (t<0) t = turn;
|
||||
|
||||
if (t<0) t = turn;
|
||||
|
||||
year = t/(months_per_year * weeks_per_month) + 1;
|
||||
r = t - (year-1) * months_per_year * weeks_per_month;
|
||||
|
|
|
@ -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 const char* get_param(const struct param * p, const char * name);
|
||||
|
||||
extern int FirstTurn(void);
|
||||
extern int NMRTimeout(void);
|
||||
extern int LongHunger(void);
|
||||
extern boolean TradeDisabled(void);
|
||||
|
|
|
@ -292,22 +292,21 @@ find_magetype(const unit * u)
|
|||
static void
|
||||
createspelllist(unit *u, magic_t mtyp)
|
||||
{
|
||||
int sk, i;
|
||||
if (mtyp == M_GRAU)
|
||||
return;
|
||||
spell_list * slist;
|
||||
int sk;
|
||||
|
||||
sk = effskill(u, SK_MAGIC);
|
||||
if (sk == 0)
|
||||
return;
|
||||
if (mtyp == M_GRAU) return;
|
||||
|
||||
for (i = 0; spelldaten[i].id != SPL_NOSPELL; i++) {
|
||||
if (spelldaten[i].magietyp == mtyp
|
||||
&& spelldaten[i].level <= sk)
|
||||
{
|
||||
if (!getspell(u, spelldaten[i].id))
|
||||
addspell(u, spelldaten[i].id);
|
||||
}
|
||||
}
|
||||
sk = effskill(u, SK_MAGIC);
|
||||
if (sk == 0) return;
|
||||
|
||||
for (slist=spells;slist!=NULL;slist=slist->next) {
|
||||
spell * sp = slist->data;
|
||||
if (sp->magietyp == mtyp && sp->level <= sk) {
|
||||
if (!has_spell(u, sp))
|
||||
addspell(u, sp->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
|
@ -366,57 +365,55 @@ void
|
|||
updatespelllist(unit * u)
|
||||
{
|
||||
int max = eff_skill(u, SK_MAGIC, u->region);
|
||||
int sk = max;
|
||||
int sk = max;
|
||||
spell_list * slist;
|
||||
spell * sp;
|
||||
magic_t gebiet = find_magetype(u);
|
||||
magic_t gebiet = find_magetype(u);
|
||||
boolean ismonster = u->faction->no==MONSTER_FACTION;
|
||||
|
||||
/* Nur Orkmagier bekommen den Keuschheitsamulettzauber */
|
||||
if (old_race(u->race) == RC_ORC
|
||||
&& !getspell(u, SPL_ARTEFAKT_CHASTITYBELT)
|
||||
&& find_spellbyid(SPL_ARTEFAKT_CHASTITYBELT)->level <= max)
|
||||
{
|
||||
addspell(u, SPL_ARTEFAKT_CHASTITYBELT);
|
||||
}
|
||||
sp = find_spellbyid(SPL_ARTEFAKT_CHASTITYBELT);
|
||||
if (old_race(u->race)==RC_ORC && !has_spell(u, sp) && sp->level<=max) {
|
||||
addspell(u, SPL_ARTEFAKT_CHASTITYBELT);
|
||||
}
|
||||
|
||||
/* Nur Wyrm-Magier bekommen den Wyrmtransformationszauber */
|
||||
if (fspecial(u->faction, FS_WYRM)
|
||||
&& !getspell(u, SPL_BECOMEWYRM)
|
||||
&& find_spellbyid(SPL_BECOMEWYRM)->level <= max)
|
||||
{
|
||||
addspell(u, SPL_BECOMEWYRM);
|
||||
}
|
||||
/* Nur Wyrm-Magier bekommen den Wyrmtransformationszauber */
|
||||
sp = find_spellbyid(SPL_BECOMEWYRM);
|
||||
if (fspecial(u->faction, FS_WYRM) && !has_spell(u, sp) && sp->level<=max) {
|
||||
addspell(u, SPL_BECOMEWYRM);
|
||||
}
|
||||
|
||||
/* Transformierte Wyrm-Magier bekommen Drachenodem */
|
||||
if (dragonrace(u->race)) {
|
||||
race_t urc = old_race(u->race);
|
||||
switch (urc) {
|
||||
/* keine breaks! Wyrme sollen alle drei Zauber können.*/
|
||||
case RC_WYRM:
|
||||
sp = find_spellbyid(SPL_WYRMODEM);
|
||||
if (sp!=NULL && !getspell(u, sp->id) && sp->level<=max) {
|
||||
addspell(u, sp->id);
|
||||
}
|
||||
case RC_DRAGON:
|
||||
sp = find_spellbyid(SPL_DRAGONODEM);
|
||||
if (sp!=NULL && !getspell(u, sp->id) && sp->level<=max) {
|
||||
addspell(u, sp->id);
|
||||
}
|
||||
case RC_FIREDRAGON:
|
||||
sp = find_spellbyid(SPL_FIREDRAGONODEM);
|
||||
if (sp!=NULL && getspell(u, sp->id) && sp->level<=max) {
|
||||
addspell(u, sp->id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Transformierte Wyrm-Magier bekommen Drachenodem */
|
||||
if (dragonrace(u->race)) {
|
||||
race_t urc = old_race(u->race);
|
||||
switch (urc) {
|
||||
/* keine breaks! Wyrme sollen alle drei Zauber können.*/
|
||||
case RC_WYRM:
|
||||
sp = find_spellbyid(SPL_WYRMODEM);
|
||||
if (sp!=NULL && !has_spell(u, sp) && sp->level<=max) {
|
||||
addspell(u, sp->id);
|
||||
}
|
||||
case RC_DRAGON:
|
||||
sp = find_spellbyid(SPL_DRAGONODEM);
|
||||
if (sp!=NULL && !has_spell(u, sp) && sp->level<=max) {
|
||||
addspell(u, sp->id);
|
||||
}
|
||||
case RC_FIREDRAGON:
|
||||
sp = find_spellbyid(SPL_FIREDRAGONODEM);
|
||||
if (sp!=NULL && has_spell(u, sp) && sp->level<=max) {
|
||||
addspell(u, sp->id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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
|
||||
* Drachen, die noch den Skill Magie haben */
|
||||
|
||||
for (sp = spelldaten; sp->id != SPL_NOSPELL; ++sp) {
|
||||
boolean know = getspell(u, sp->id);
|
||||
for (slist=spells;slist!=NULL;slist=slist->next) {
|
||||
spell * sp = slist->data;
|
||||
boolean know = has_spell(u, sp);
|
||||
|
||||
if (know || (gebiet!=M_GRAU && sp->magietyp == gebiet && sp->level <= sk)) {
|
||||
faction * f = u->faction;
|
||||
|
@ -451,104 +448,17 @@ addspell(unit *u, spellid_t spellid)
|
|||
}
|
||||
|
||||
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) {
|
||||
return false;
|
||||
}
|
||||
for (spt = m->spellptr; spt; spt = spt->next) {
|
||||
if (spt->spellid == spellid) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (m==NULL) return false;
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
/* Spruch identifizieren */
|
||||
|
||||
#include "umlaut.h"
|
||||
|
||||
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;
|
||||
for (spt = m->spellptr; spt; spt = spt->next) {
|
||||
if (spt->spellid == sp->id) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
|
@ -601,7 +511,7 @@ set_combatspell(unit *u, spell *sp, const char * cmd, int level)
|
|||
cmistake(u, cmd, 173, MSG_MAGIC);
|
||||
return;
|
||||
}
|
||||
if (getspell(u, sp->id) == false) {
|
||||
if (has_spell(u, sp) == false) {
|
||||
/* Diesen Zauber kennt die Einheit nicht */
|
||||
cmistake(u, cmd, 169, MSG_MAGIC);
|
||||
return;
|
||||
|
@ -957,7 +867,7 @@ knowsspell(const region * r, const unit * u, const spell * sp)
|
|||
return false;
|
||||
}
|
||||
/* 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? */
|
||||
if (find_magetype(u) != sp->magietyp){
|
||||
return false;
|
||||
|
|
|
@ -125,25 +125,9 @@ typedef struct sc_mage {
|
|||
struct spell_ptr *spellptr;
|
||||
} 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 */
|
||||
|
||||
|
||||
typedef struct castorder {
|
||||
struct castorder *next;
|
||||
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 */
|
||||
void addspell(struct unit *u, spellid_t spellid);
|
||||
/* 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. */
|
||||
void updatespelllist(struct unit *u);
|
||||
/* fügt alle Zauber des Magiegebietes der Einheit, deren Stufe kleiner
|
||||
|
|
|
@ -2056,136 +2056,139 @@ addally(const faction * f, ally ** sfp, int aid, int state)
|
|||
faction *
|
||||
readfaction(FILE * F)
|
||||
{
|
||||
ally **sfp;
|
||||
int planes;
|
||||
int i = rid(F);
|
||||
faction * f = findfaction(i);
|
||||
if (f==NULL) {
|
||||
f = (faction *) calloc(1, sizeof(faction));
|
||||
f->no = i;
|
||||
} else {
|
||||
ally **sfp;
|
||||
int planes;
|
||||
int i = rid(F);
|
||||
faction * f = findfaction(i);
|
||||
if (f==NULL) {
|
||||
f = (faction *) calloc(1, sizeof(faction));
|
||||
f->no = i;
|
||||
} else {
|
||||
#ifdef MSG_LEVELS
|
||||
f->warnings = NULL; /* mem leak */
|
||||
f->warnings = NULL; /* mem leak */
|
||||
#endif
|
||||
f->allies = NULL; /* mem leak */
|
||||
while (f->attribs) a_remove(&f->attribs, f->attribs);
|
||||
}
|
||||
f->subscription = ri(F);
|
||||
f->allies = NULL; /* mem leak */
|
||||
while (f->attribs) a_remove(&f->attribs, f->attribs);
|
||||
}
|
||||
f->subscription = ri(F);
|
||||
#ifdef ALLIANCES
|
||||
if (global.data_version>=ALLIANCES_VERSION) {
|
||||
int allianceid = rid(F);
|
||||
if (allianceid!=0) f->alliance = findalliance(allianceid);
|
||||
if (f->alliance) {
|
||||
faction_list * flist = malloc(sizeof(faction_list));
|
||||
flist->data = f;
|
||||
flist->next = f->alliance->members;
|
||||
f->alliance->members = flist;
|
||||
}
|
||||
}
|
||||
if (global.data_version>=ALLIANCES_VERSION) {
|
||||
int allianceid = rid(F);
|
||||
if (allianceid!=0) f->alliance = findalliance(allianceid);
|
||||
if (f->alliance) {
|
||||
faction_list * flist = malloc(sizeof(faction_list));
|
||||
flist->data = f;
|
||||
flist->next = f->alliance->members;
|
||||
f->alliance->members = flist;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
rds(F, &f->name);
|
||||
rds(F, &f->name);
|
||||
|
||||
#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
|
||||
|
||||
rds(F, &f->banner);
|
||||
rds(F, &f->email);
|
||||
rds(F, &f->passw);
|
||||
if (global.data_version >= OVERRIDE_VERSION) {
|
||||
rds(F, &f->override);
|
||||
} else {
|
||||
f->override = strdup(itoa36(rand()));
|
||||
}
|
||||
rds(F, &f->banner);
|
||||
rds(F, &f->email);
|
||||
rds(F, &f->passw);
|
||||
if (global.data_version >= OVERRIDE_VERSION) {
|
||||
rds(F, &f->override);
|
||||
} else {
|
||||
f->override = strdup(itoa36(rand()));
|
||||
}
|
||||
|
||||
if (global.data_version < LOCALE_VERSION) {
|
||||
f->locale = find_locale("de");
|
||||
} else {
|
||||
rs(F, buf);
|
||||
f->locale = find_locale(buf);
|
||||
}
|
||||
f->lastorders = ri(F);
|
||||
f->age = ri(F);
|
||||
if (global.data_version < NEWRACE_VERSION) {
|
||||
race_t rc = (char) ri(F);
|
||||
f->race = new_race[rc];
|
||||
} else {
|
||||
rs(F, buf);
|
||||
f->race = rc_find(buf);
|
||||
assert(f->race);
|
||||
}
|
||||
if (global.data_version < LOCALE_VERSION) {
|
||||
f->locale = find_locale("de");
|
||||
} else {
|
||||
rs(F, buf);
|
||||
f->locale = find_locale(buf);
|
||||
}
|
||||
f->lastorders = ri(F);
|
||||
f->age = ri(F);
|
||||
if (global.data_version < NEWRACE_VERSION) {
|
||||
race_t rc = (char) ri(F);
|
||||
f->race = new_race[rc];
|
||||
} else {
|
||||
rs(F, buf);
|
||||
f->race = rc_find(buf);
|
||||
assert(f->race);
|
||||
}
|
||||
#ifdef CONVERT_DBLINK
|
||||
convertunique(f);
|
||||
convertunique(f);
|
||||
#endif
|
||||
f->magiegebiet = (magic_t)ri(F);
|
||||
if (!playerrace(f->race)) {
|
||||
f->lastorders = turn+1;
|
||||
}
|
||||
f->karma = ri(F);
|
||||
f->flags = ri(F);
|
||||
freset(f, FFL_OVERRIDE);
|
||||
f->magiegebiet = (magic_t)ri(F);
|
||||
if (!playerrace(f->race)) {
|
||||
f->lastorders = turn+1;
|
||||
}
|
||||
f->karma = ri(F);
|
||||
f->flags = ri(F);
|
||||
freset(f, FFL_OVERRIDE);
|
||||
|
||||
a_read(F, &f->attribs);
|
||||
a_read(F, &f->attribs);
|
||||
#ifdef MSG_LEVELS
|
||||
read_msglevels(&f->warnings, F);
|
||||
read_msglevels(&f->warnings, F);
|
||||
#else
|
||||
for (;;) {
|
||||
int level;
|
||||
fscanf(F, "%s", buf);
|
||||
if (strcmp("end", buf)==0) break;
|
||||
fscanf(F, "%d ", &level);
|
||||
}
|
||||
for (;;) {
|
||||
int level;
|
||||
fscanf(F, "%s", buf);
|
||||
if (strcmp("end", buf)==0) break;
|
||||
fscanf(F, "%d ", &level);
|
||||
}
|
||||
#endif
|
||||
planes = ri(F);
|
||||
while(--planes >= 0) {
|
||||
int id = ri(F);
|
||||
int ux = ri(F);
|
||||
int uy = ri(F);
|
||||
set_ursprung(f, id, ux, uy);
|
||||
}
|
||||
f->newbies = 0;
|
||||
f->options = ri(F);
|
||||
planes = ri(F);
|
||||
while(--planes >= 0) {
|
||||
int id = ri(F);
|
||||
int ux = ri(F);
|
||||
int uy = ri(F);
|
||||
set_ursprung(f, id, ux, uy);
|
||||
}
|
||||
f->newbies = 0;
|
||||
|
||||
if (((f->options & Pow(O_REPORT)) == 0)
|
||||
&& (f->options & Pow(O_COMPUTER)) == 0) {
|
||||
/* Kein Report eingestellt, Fehler */
|
||||
f->options = f->options | Pow(O_REPORT) | Pow(O_ZUGVORLAGE);
|
||||
}
|
||||
i = f->options = ri(F);
|
||||
|
||||
if (global.data_version < TYPES_VERSION) {
|
||||
int i, sk = ri(F); /* f->seenspell überspringen */
|
||||
for (i = 0; spelldaten[i].id != SPL_NOSPELL; i++) {
|
||||
if (spelldaten[i].magietyp == f->magiegebiet && spelldaten[i].level <= sk) {
|
||||
a_add(&f->attribs, a_new(&at_seenspell))->data.i = spelldaten[i].id;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((i & Pow(O_REPORT))==0 && (i & Pow(O_COMPUTER))==0) {
|
||||
/* Kein Report eingestellt, Fehler */
|
||||
f->options = f->options | Pow(O_REPORT) | Pow(O_ZUGVORLAGE);
|
||||
}
|
||||
|
||||
sfp = &f->allies;
|
||||
if (global.data_version<ALLIANCES_VERSION) {
|
||||
int p = ri(F);
|
||||
while (--p >= 0) {
|
||||
int aid = rid(F);
|
||||
int state = ri(F);
|
||||
addally(f, sfp, aid, state);
|
||||
}
|
||||
} else {
|
||||
for (;;) {
|
||||
rs(F, buf);
|
||||
if (strcmp(buf, "end")==0) break;
|
||||
else {
|
||||
int aid = atoi36(buf);
|
||||
int state = ri(F);
|
||||
addally(f, sfp, aid, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
read_groups(F, f);
|
||||
if (global.data_version < TYPES_VERSION) {
|
||||
int sk = ri(F); /* f->seenspell überspringen */
|
||||
spell_list * slist;
|
||||
for (slist=spells;slist!=NULL;slist=slist->next) {
|
||||
spell * sp = slist->data;
|
||||
|
||||
if (sp->magietyp==f->magiegebiet && sp->level<=sk) {
|
||||
a_add(&f->attribs, a_new(&at_seenspell))->data.i = sp->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sfp = &f->allies;
|
||||
if (global.data_version<ALLIANCES_VERSION) {
|
||||
int p = ri(F);
|
||||
while (--p >= 0) {
|
||||
int aid = rid(F);
|
||||
int state = ri(F);
|
||||
addally(f, sfp, aid, state);
|
||||
}
|
||||
} else {
|
||||
for (;;) {
|
||||
rs(F, buf);
|
||||
if (strcmp(buf, "end")==0) break;
|
||||
else {
|
||||
int aid = atoi36(buf);
|
||||
int state = ri(F);
|
||||
addally(f, sfp, aid, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
read_groups(F, f);
|
||||
#ifdef REGIONOWNERS
|
||||
read_enemies(F, f);
|
||||
#endif
|
||||
return f;
|
||||
return f;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,16 +1,16 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
*
|
||||
* Eressea PB(E)M host Copyright (C) 1998-2003
|
||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||
* Henning Peters (faroul@beyond.kn-bremen.de)
|
||||
* Enno Rehling (enno@eressea-pbem.de)
|
||||
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
|
||||
*
|
||||
* This program may not be used, modified or distributed without
|
||||
* prior permission by the authors of Eressea.
|
||||
*/
|
||||
*
|
||||
*
|
||||
* Eressea PB(E)M host Copyright (C) 1998-2003
|
||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||
* Henning Peters (faroul@beyond.kn-bremen.de)
|
||||
* Enno Rehling (enno@eressea-pbem.de)
|
||||
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
|
||||
*
|
||||
* This program may not be used, modified or distributed without
|
||||
* prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifndef H_KRNL_SPELLS
|
||||
#define H_KRNL_SPELLS
|
||||
|
@ -18,275 +18,278 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct fighter;
|
||||
struct spell;
|
||||
struct border_type;
|
||||
struct attrib_type;
|
||||
struct curse_type;
|
||||
struct castorder;
|
||||
struct curse;
|
||||
struct fighter;
|
||||
struct spell;
|
||||
struct border_type;
|
||||
struct attrib_type;
|
||||
struct curse_type;
|
||||
struct castorder;
|
||||
struct curse;
|
||||
|
||||
/* Sprüche. Neue NUR hinten anfügen, oder das Datenfile geht kaputt */
|
||||
enum {
|
||||
SPL_NOSPELL,
|
||||
SPL_ARTEFAKT_OF_POWER,
|
||||
SPL_ARTEFAKT_OF_AURAPOWER,
|
||||
SPL_ARTEFAKT_OF_REGENERATION,
|
||||
SPL_FIREBALL,
|
||||
SPL_HAGEL,
|
||||
SPL_RUSTWEAPON,
|
||||
SPL_COMBATRUST,
|
||||
SPL_TREEGROW,
|
||||
SPL_HEALING,
|
||||
SPL_HEALINGSONG,
|
||||
SPL_BADDREAMS,
|
||||
SPL_GOODDREAMS,
|
||||
SPL_DREAMREADING,
|
||||
SPL_SWEETDREAMS,
|
||||
SPL_TIREDSOLDIERS,
|
||||
SPL_PLAGUE,
|
||||
SPL_MAGICBOOST,
|
||||
SPL_CHAOSROW,
|
||||
SPL_SONG_OF_CONFUSION,
|
||||
SPL_FLEE,
|
||||
SPL_SONG_OF_FEAR,
|
||||
SPL_BERSERK,
|
||||
SPL_BLOODTHIRST,
|
||||
SPL_MAELSTROM,
|
||||
SPL_BLESSEDHARVEST,
|
||||
SPL_RAINDANCE,
|
||||
SPL_TRANSFERAURA_DRUIDE,
|
||||
SPL_TRANSFERAURA_BARDE,
|
||||
SPL_TRANSFERAURA_CHAOS,
|
||||
SPL_TRANSFERAURA_TRAUM,
|
||||
SPL_TRANSFERAURA_ASTRAL,
|
||||
SPL_STONEGOLEM,
|
||||
SPL_IRONGOLEM,
|
||||
SPL_SUMMONSHADOW,
|
||||
SPL_SUMMONSHADOWLORDS,
|
||||
SPL_REELING_ARROWS,
|
||||
SPL_ANTIMAGICZONE,
|
||||
SPL_CREATE_ANTIMAGICCRYSTAL,
|
||||
SPL_KAELTESCHUTZ,
|
||||
SPL_STEALAURA,
|
||||
SPL_SUMMONUNDEAD,
|
||||
SPL_AURALEAK,
|
||||
SPL_GREAT_DROUGHT,
|
||||
SPL_STRONG_WALL,
|
||||
SPL_HOMESTONE,
|
||||
SPL_DROUGHT,
|
||||
SPL_FOREST_FIRE,
|
||||
SPL_STRENGTH,
|
||||
SPL_SUMMONENT,
|
||||
SPL_DISTURBINGDREAMS,
|
||||
SPL_DENYATTACK,
|
||||
SPL_SLEEP,
|
||||
SPL_EARTHQUAKE,
|
||||
SPL_IRONKEEPER,
|
||||
SPL_STORMWINDS,
|
||||
SPL_GOODWINDS,
|
||||
SPL_FLYING_SHIP,
|
||||
SPL_SUMMON_ALP,
|
||||
SPL_WINDSHIELD,
|
||||
SPL_RAISEPEASANTS,
|
||||
SPL_DEPRESSION,
|
||||
SPL_HEADACHE,
|
||||
SPL_ARTEFAKT_NIMBLEFINGERRING,
|
||||
SPL_ENTERASTRAL,
|
||||
SPL_LEAVEASTRAL,
|
||||
SPL_SHOWASTRAL,
|
||||
SPL_VERSTEINERN,
|
||||
SPL_TREEWALKENTER,
|
||||
SPL_TREEWALKEXIT,
|
||||
SPL_CHAOSSUCTION,
|
||||
SPL_VIEWREALITY,
|
||||
SPL_DISRUPTASTRAL,
|
||||
SPL_SEDUCE,
|
||||
SPL_PUMP,
|
||||
SPL_CALM_MONSTER,
|
||||
SPL_HERO,
|
||||
SPL_FRIGHTEN,
|
||||
SPL_MINDBLAST,
|
||||
SPL_SPEED,
|
||||
SPL_SPEED2,
|
||||
SPL_FIREDRAGONODEM,
|
||||
SPL_DRAGONODEM,
|
||||
SPL_WYRMODEM, /* 83 */
|
||||
SPL_MAGICSTREET,
|
||||
SPL_REANIMATE,
|
||||
SPL_RECRUIT,
|
||||
SPL_GENEROUS,
|
||||
SPL_PERMTRANSFER,
|
||||
SPL_SONG_OF_PEACE,
|
||||
SPL_MIGRANT,
|
||||
SPL_RALLYPEASANTMOB,
|
||||
SPL_RAISEPEASANTMOB,
|
||||
SPL_ILL_SHAPESHIFT,
|
||||
SPL_WOLFHOWL,
|
||||
SPL_FOG_OF_CONFUSION,
|
||||
SPL_DREAM_OF_CONFUSION,
|
||||
SPL_RESISTMAGICBONUS,
|
||||
SPL_KEEPLOOT,
|
||||
SPL_SCHILDRUNEN,
|
||||
SPL_SONG_RESISTMAGIC,
|
||||
SPL_SONG_SUSCEPTMAGIC,
|
||||
SPL_ANALYSEMAGIC,
|
||||
SPL_ANALYSEDREAM,
|
||||
SPL_UNIT_ANALYSESONG,
|
||||
SPL_OBJ_ANALYSESONG,
|
||||
SPL_TYBIED_DESTROY_MAGIC,
|
||||
SPL_DESTROY_MAGIC,
|
||||
SPL_METEORRAIN,
|
||||
SPL_REDUCESHIELD,
|
||||
SPL_ARMORSHIELD,
|
||||
SPL_DEATHCLOUD,
|
||||
SPL_ORKDREAM,
|
||||
SPL_SUMMONDRAGON,
|
||||
SPL_READMIND,
|
||||
SPL_BABBLER,
|
||||
SPL_MOVECASTLE,
|
||||
SPL_BLESSSTONECIRCLE,
|
||||
SPL_ILLAUN_FAMILIAR,
|
||||
SPL_GWYRRD_FAMILIAR,
|
||||
SPL_DRAIG_FAMILIAR,
|
||||
SPL_CERDDOR_FAMILIAR,
|
||||
SPL_TYBIED_FAMILIAR,
|
||||
SPL_SONG_OF_ENSLAVE,
|
||||
SPL_TRUESEEING_GWYRRD,
|
||||
SPL_TRUESEEING_DRAIG,
|
||||
SPL_TRUESEEING_ILLAUN,
|
||||
SPL_TRUESEEING_CERDDOR,
|
||||
SPL_TRUESEEING_TYBIED,
|
||||
SPL_INVISIBILITY_GWYRRD,
|
||||
SPL_INVISIBILITY_DRAIG,
|
||||
SPL_INVISIBILITY_ILLAUN,
|
||||
SPL_INVISIBILITY_CERDDOR,
|
||||
SPL_INVISIBILITY_TYBIED,
|
||||
SPL_ARTEFAKT_CHASTITYBELT,
|
||||
SPL_ARTEFAKT_RUNESWORD,
|
||||
SPL_FUMBLECURSE,
|
||||
SPL_ICASTLE,
|
||||
SPL_GWYRRD_DESTROY_MAGIC,
|
||||
SPL_DRAIG_DESTROY_MAGIC,
|
||||
SPL_ILLAUN_DESTROY_MAGIC,
|
||||
SPL_CERDDOR_DESTROY_MAGIC,
|
||||
SPL_GWYRRD_ARMORSHIELD,
|
||||
SPL_DRAIG_FUMBLESHIELD,
|
||||
SPL_GWYRRD_FUMBLESHIELD,
|
||||
SPL_CERRDOR_FUMBLESHIELD,
|
||||
SPL_TYBIED_FUMBLESHIELD,
|
||||
SPL_SHADOWKNIGHTS,
|
||||
SPL_FIRESWORD,
|
||||
SPL_CREATE_TACTICCRYSTAL,
|
||||
SPL_ITEMCLOAK,
|
||||
SPL_FIREWALL,
|
||||
SPL_WISPS,
|
||||
SPL_SPARKLE_CHAOS,
|
||||
SPL_SPARKLE_DREAM,
|
||||
SPL_BAG_OF_HOLDING,
|
||||
SPL_PULLASTRAL,
|
||||
SPL_FETCHASTRAL,
|
||||
SPL_ILLAUN_EARN_SILVER,
|
||||
SPL_GWYRRD_EARN_SILVER,
|
||||
SPL_DRAIG_EARN_SILVER,
|
||||
SPL_TYBIED_EARN_SILVER,
|
||||
SPL_CERDDOR_EARN_SILVER,
|
||||
SPL_SHOCKWAVE,
|
||||
SPL_UNDEADHERO,
|
||||
SPL_ARTEFAKT_SACK_OF_CONSERVATION,
|
||||
SPL_BECOMEWYRM,
|
||||
SPL_ETERNIZEWALL,
|
||||
SPL_PUTTOREST,
|
||||
SPL_UNHOLYPOWER,
|
||||
SPL_HOLYGROUND,
|
||||
SPL_BLOODSACRIFICE,
|
||||
SPL_MALLORN,
|
||||
SPL_CLONECOPY,
|
||||
SPL_DRAINODEM, /* 174? */
|
||||
SPL_AURA_OF_FEAR, /* 175? */
|
||||
SPL_SHADOWCALL, /* 176? */
|
||||
SPL_MALLORNTREEGROW,
|
||||
SPL_INVISIBILITY2_ILLAUN,
|
||||
SPL_BIGRECRUIT,
|
||||
SPL_IMMOLATION,
|
||||
SPL_FIREODEM, /* 181 */
|
||||
SPL_ICEODEM,
|
||||
SPL_ACIDODEM,
|
||||
/* Sprüche. Neue NUR hinten anfügen, oder das Datenfile geht kaputt */
|
||||
enum {
|
||||
SPL_NOSPELL,
|
||||
SPL_ARTEFAKT_OF_POWER,
|
||||
SPL_ARTEFAKT_OF_AURAPOWER,
|
||||
SPL_ARTEFAKT_OF_REGENERATION,
|
||||
SPL_FIREBALL,
|
||||
SPL_HAGEL,
|
||||
SPL_RUSTWEAPON,
|
||||
SPL_COMBATRUST,
|
||||
SPL_TREEGROW,
|
||||
SPL_HEALING,
|
||||
SPL_HEALINGSONG,
|
||||
SPL_BADDREAMS,
|
||||
SPL_GOODDREAMS,
|
||||
SPL_DREAMREADING,
|
||||
SPL_SWEETDREAMS,
|
||||
SPL_TIREDSOLDIERS,
|
||||
SPL_PLAGUE,
|
||||
SPL_MAGICBOOST,
|
||||
SPL_CHAOSROW,
|
||||
SPL_SONG_OF_CONFUSION,
|
||||
SPL_FLEE,
|
||||
SPL_SONG_OF_FEAR,
|
||||
SPL_BERSERK,
|
||||
SPL_BLOODTHIRST,
|
||||
SPL_MAELSTROM,
|
||||
SPL_BLESSEDHARVEST,
|
||||
SPL_RAINDANCE,
|
||||
SPL_TRANSFERAURA_DRUIDE,
|
||||
SPL_TRANSFERAURA_BARDE,
|
||||
SPL_TRANSFERAURA_CHAOS,
|
||||
SPL_TRANSFERAURA_TRAUM,
|
||||
SPL_TRANSFERAURA_ASTRAL,
|
||||
SPL_STONEGOLEM,
|
||||
SPL_IRONGOLEM,
|
||||
SPL_SUMMONSHADOW,
|
||||
SPL_SUMMONSHADOWLORDS,
|
||||
SPL_REELING_ARROWS,
|
||||
SPL_ANTIMAGICZONE,
|
||||
SPL_CREATE_ANTIMAGICCRYSTAL,
|
||||
SPL_KAELTESCHUTZ,
|
||||
SPL_STEALAURA,
|
||||
SPL_SUMMONUNDEAD,
|
||||
SPL_AURALEAK,
|
||||
SPL_GREAT_DROUGHT,
|
||||
SPL_STRONG_WALL,
|
||||
SPL_HOMESTONE,
|
||||
SPL_DROUGHT,
|
||||
SPL_FOREST_FIRE,
|
||||
SPL_STRENGTH,
|
||||
SPL_SUMMONENT,
|
||||
SPL_DISTURBINGDREAMS,
|
||||
SPL_DENYATTACK,
|
||||
SPL_SLEEP,
|
||||
SPL_EARTHQUAKE,
|
||||
SPL_IRONKEEPER,
|
||||
SPL_STORMWINDS,
|
||||
SPL_GOODWINDS,
|
||||
SPL_FLYING_SHIP,
|
||||
SPL_SUMMON_ALP,
|
||||
SPL_WINDSHIELD,
|
||||
SPL_RAISEPEASANTS,
|
||||
SPL_DEPRESSION,
|
||||
SPL_HEADACHE,
|
||||
SPL_ARTEFAKT_NIMBLEFINGERRING,
|
||||
SPL_ENTERASTRAL,
|
||||
SPL_LEAVEASTRAL,
|
||||
SPL_SHOWASTRAL,
|
||||
SPL_VERSTEINERN,
|
||||
SPL_TREEWALKENTER,
|
||||
SPL_TREEWALKEXIT,
|
||||
SPL_CHAOSSUCTION,
|
||||
SPL_VIEWREALITY,
|
||||
SPL_DISRUPTASTRAL,
|
||||
SPL_SEDUCE,
|
||||
SPL_PUMP,
|
||||
SPL_CALM_MONSTER,
|
||||
SPL_HERO,
|
||||
SPL_FRIGHTEN,
|
||||
SPL_MINDBLAST,
|
||||
SPL_SPEED,
|
||||
SPL_SPEED2,
|
||||
SPL_FIREDRAGONODEM,
|
||||
SPL_DRAGONODEM,
|
||||
SPL_WYRMODEM, /* 83 */
|
||||
SPL_MAGICSTREET,
|
||||
SPL_REANIMATE,
|
||||
SPL_RECRUIT,
|
||||
SPL_GENEROUS,
|
||||
SPL_PERMTRANSFER,
|
||||
SPL_SONG_OF_PEACE,
|
||||
SPL_MIGRANT,
|
||||
SPL_RALLYPEASANTMOB,
|
||||
SPL_RAISEPEASANTMOB,
|
||||
SPL_ILL_SHAPESHIFT,
|
||||
SPL_WOLFHOWL,
|
||||
SPL_FOG_OF_CONFUSION,
|
||||
SPL_DREAM_OF_CONFUSION,
|
||||
SPL_RESISTMAGICBONUS,
|
||||
SPL_KEEPLOOT,
|
||||
SPL_SCHILDRUNEN,
|
||||
SPL_SONG_RESISTMAGIC,
|
||||
SPL_SONG_SUSCEPTMAGIC,
|
||||
SPL_ANALYSEMAGIC,
|
||||
SPL_ANALYSEDREAM,
|
||||
SPL_UNIT_ANALYSESONG,
|
||||
SPL_OBJ_ANALYSESONG,
|
||||
SPL_TYBIED_DESTROY_MAGIC,
|
||||
SPL_DESTROY_MAGIC,
|
||||
SPL_METEORRAIN,
|
||||
SPL_REDUCESHIELD,
|
||||
SPL_ARMORSHIELD,
|
||||
SPL_DEATHCLOUD,
|
||||
SPL_ORKDREAM,
|
||||
SPL_SUMMONDRAGON,
|
||||
SPL_READMIND,
|
||||
SPL_BABBLER,
|
||||
SPL_MOVECASTLE,
|
||||
SPL_BLESSSTONECIRCLE,
|
||||
SPL_ILLAUN_FAMILIAR,
|
||||
SPL_GWYRRD_FAMILIAR,
|
||||
SPL_DRAIG_FAMILIAR,
|
||||
SPL_CERDDOR_FAMILIAR,
|
||||
SPL_TYBIED_FAMILIAR,
|
||||
SPL_SONG_OF_ENSLAVE,
|
||||
SPL_TRUESEEING_GWYRRD,
|
||||
SPL_TRUESEEING_DRAIG,
|
||||
SPL_TRUESEEING_ILLAUN,
|
||||
SPL_TRUESEEING_CERDDOR,
|
||||
SPL_TRUESEEING_TYBIED,
|
||||
SPL_INVISIBILITY_GWYRRD,
|
||||
SPL_INVISIBILITY_DRAIG,
|
||||
SPL_INVISIBILITY_ILLAUN,
|
||||
SPL_INVISIBILITY_CERDDOR,
|
||||
SPL_INVISIBILITY_TYBIED,
|
||||
SPL_ARTEFAKT_CHASTITYBELT,
|
||||
SPL_ARTEFAKT_RUNESWORD,
|
||||
SPL_FUMBLECURSE,
|
||||
SPL_ICASTLE,
|
||||
SPL_GWYRRD_DESTROY_MAGIC,
|
||||
SPL_DRAIG_DESTROY_MAGIC,
|
||||
SPL_ILLAUN_DESTROY_MAGIC,
|
||||
SPL_CERDDOR_DESTROY_MAGIC,
|
||||
SPL_GWYRRD_ARMORSHIELD,
|
||||
SPL_DRAIG_FUMBLESHIELD,
|
||||
SPL_GWYRRD_FUMBLESHIELD,
|
||||
SPL_CERRDOR_FUMBLESHIELD,
|
||||
SPL_TYBIED_FUMBLESHIELD,
|
||||
SPL_SHADOWKNIGHTS,
|
||||
SPL_FIRESWORD,
|
||||
SPL_CREATE_TACTICCRYSTAL,
|
||||
SPL_ITEMCLOAK,
|
||||
SPL_FIREWALL,
|
||||
SPL_WISPS,
|
||||
SPL_SPARKLE_CHAOS,
|
||||
SPL_SPARKLE_DREAM,
|
||||
SPL_BAG_OF_HOLDING,
|
||||
SPL_PULLASTRAL,
|
||||
SPL_FETCHASTRAL,
|
||||
SPL_ILLAUN_EARN_SILVER,
|
||||
SPL_GWYRRD_EARN_SILVER,
|
||||
SPL_DRAIG_EARN_SILVER,
|
||||
SPL_TYBIED_EARN_SILVER,
|
||||
SPL_CERDDOR_EARN_SILVER,
|
||||
SPL_SHOCKWAVE,
|
||||
SPL_UNDEADHERO,
|
||||
SPL_ARTEFAKT_SACK_OF_CONSERVATION,
|
||||
SPL_BECOMEWYRM,
|
||||
SPL_ETERNIZEWALL,
|
||||
SPL_PUTTOREST,
|
||||
SPL_UNHOLYPOWER,
|
||||
SPL_HOLYGROUND,
|
||||
SPL_BLOODSACRIFICE,
|
||||
SPL_MALLORN,
|
||||
SPL_CLONECOPY,
|
||||
SPL_DRAINODEM, /* 174? */
|
||||
SPL_AURA_OF_FEAR, /* 175? */
|
||||
SPL_SHADOWCALL, /* 176? */
|
||||
SPL_MALLORNTREEGROW,
|
||||
SPL_INVISIBILITY2_ILLAUN,
|
||||
SPL_BIGRECRUIT,
|
||||
SPL_IMMOLATION,
|
||||
SPL_FIREODEM, /* 181 */
|
||||
SPL_ICEODEM,
|
||||
SPL_ACIDODEM,
|
||||
#ifdef WDW_PYRAMIDSPELL
|
||||
SPL_WDWPYRAMID_TRAUM,
|
||||
SPL_WDWPYRAMID_ASTRAL,
|
||||
SPL_WDWPYRAMID_DRUIDE,
|
||||
SPL_WDWPYRAMID_BARDE,
|
||||
SPL_WDWPYRAMID_CHAOS,
|
||||
SPL_WDWPYRAMID_TRAUM,
|
||||
SPL_WDWPYRAMID_ASTRAL,
|
||||
SPL_WDWPYRAMID_DRUIDE,
|
||||
SPL_WDWPYRAMID_BARDE,
|
||||
SPL_WDWPYRAMID_CHAOS,
|
||||
#endif
|
||||
MAXALLSPELLS,
|
||||
NO_SPELL = (spellid_t) -1
|
||||
};
|
||||
MAXALLSPELLS,
|
||||
NO_SPELL = (spellid_t) -1
|
||||
};
|
||||
|
||||
/* Prototypen */
|
||||
/* Prototypen */
|
||||
|
||||
void do_shock(struct unit *u, const char *reason);
|
||||
int use_item_power(struct region * r, struct unit * u);
|
||||
int use_item_regeneration(struct region * r, struct unit * u);
|
||||
void showspells(struct region *r, struct unit *u);
|
||||
int sp_antimagiczone(struct castorder *co);
|
||||
extern double destr_curse(struct curse* c, int cast_level, double force);
|
||||
void do_shock(struct unit *u, const char *reason);
|
||||
int use_item_power(struct region * r, struct unit * u);
|
||||
int use_item_regeneration(struct region * r, struct unit * u);
|
||||
void showspells(struct region *r, struct unit *u);
|
||||
int sp_antimagiczone(struct castorder *co);
|
||||
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
|
||||
/* für Feuerwände: in movement muß das noch explizit getestet werden.
|
||||
* besser wäre eine blcok_type::move() routine, die den effekt
|
||||
* der Bewegung auf eine struct unit anwendet.
|
||||
*/
|
||||
extern struct border_type bt_firewall;
|
||||
extern struct border_type bt_wisps;
|
||||
typedef struct wall_data {
|
||||
struct unit * mage;
|
||||
int force;
|
||||
boolean active;
|
||||
} wall_data;
|
||||
/* für Feuerwände: in movement muß das noch explizit getestet werden.
|
||||
* besser wäre eine blcok_type::move() routine, die den effekt
|
||||
* der Bewegung auf eine struct unit anwendet.
|
||||
*/
|
||||
extern struct border_type bt_firewall;
|
||||
extern struct border_type bt_wisps;
|
||||
typedef struct wall_data {
|
||||
struct unit * mage;
|
||||
int force;
|
||||
boolean active;
|
||||
} wall_data;
|
||||
#endif
|
||||
|
||||
extern struct attrib_type at_cursewall;
|
||||
extern struct attrib_type at_unitdissolve;
|
||||
extern struct attrib_type at_cursewall;
|
||||
extern struct attrib_type at_unitdissolve;
|
||||
#ifdef WDW_PYRAMIDSPELL
|
||||
extern struct attrib_type at_wdwpyramid;
|
||||
extern struct attrib_type at_wdwpyramid;
|
||||
#endif
|
||||
extern struct spell spelldaten[];
|
||||
|
||||
extern struct spell_list * spells;
|
||||
extern void init_spells(void);
|
||||
extern void register_spell(struct spell * sp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ xml_to_locale(const xmlChar * xmlStr)
|
|||
static char zText[1024];
|
||||
char * inbuf = (char*)xmlStr;
|
||||
char * outbuf = zText;
|
||||
size_t inbytes = strlen(xmlStr)+1;
|
||||
size_t inbytes = strlen((const char*)xmlStr)+1;
|
||||
size_t outbytes = sizeof(zText);
|
||||
|
||||
if (context==(iconv_t)-1) {
|
||||
|
@ -926,15 +926,15 @@ xml_readstrings(xmlXPathContextPtr xpath, xmlNodePtr * nodeTab, int nodeNr, bool
|
|||
xmlChar * text;
|
||||
|
||||
xml_readtext(textNode, &lang, &text);
|
||||
if (text!=NULL) {
|
||||
assert(strcmp(zName, xml_cleanup_string(zName))==0);
|
||||
xml_cleanup_string(text);
|
||||
locale_setstring(lang, zName, xml_to_locale(text));
|
||||
xmlFree(text);
|
||||
} else {
|
||||
log_warning(("string %s has no text in locale %s\n",
|
||||
zName, locale_name(lang)));
|
||||
}
|
||||
if (text!=NULL) {
|
||||
assert(strcmp(zName, (const char*)xml_cleanup_string(BAD_CAST zName))==0);
|
||||
xml_cleanup_string(text);
|
||||
locale_setstring(lang, zName, xml_to_locale(text));
|
||||
xmlFree(text);
|
||||
} else {
|
||||
log_warning(("string %s has no text in locale %s\n",
|
||||
zName, locale_name(lang)));
|
||||
}
|
||||
}
|
||||
xmlXPathFreeObject(result);
|
||||
}
|
||||
|
@ -946,7 +946,6 @@ parse_strings(xmlDocPtr doc)
|
|||
xmlXPathContextPtr xpath = xmlXPathNewContext(doc);
|
||||
xmlXPathObjectPtr strings;
|
||||
|
||||
/* TODO: remember namespaces */
|
||||
/* reading eressea/strings/string */
|
||||
strings = xmlXPathEvalExpression(BAD_CAST "/eressea/strings/string", xpath);
|
||||
xml_readstrings(xpath, strings->nodesetval->nodeTab, strings->nodesetval->nodeNr, false);
|
||||
|
|
|
@ -49,7 +49,3 @@
|
|||
|
||||
#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
|
||||
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
|
||||
#include <curse.h>
|
||||
|
||||
/*
|
||||
#include "firewall.h"
|
||||
*/
|
||||
struct curse_type;
|
||||
extern const struct curse_type ct_firewall;
|
||||
extern void ct_register(const struct curse_type * ct);
|
||||
|
@ -30,9 +27,9 @@ extern void ct_register(const struct curse_type * ct);
|
|||
void
|
||||
register_spells(void)
|
||||
{
|
||||
/* sp_summon_alp */
|
||||
register_alp();
|
||||
/* init_firewall(); */
|
||||
ct_register(&ct_firewall);
|
||||
register_curses();
|
||||
/* sp_summon_alp */
|
||||
register_alp();
|
||||
/* init_firewall(); */
|
||||
ct_register(&ct_firewall);
|
||||
register_curses();
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void register_spells(void);
|
||||
extern void register_spells(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -269,54 +269,46 @@ attrib_type at_roadfix = {
|
|||
static void
|
||||
show_newspells(void)
|
||||
{
|
||||
region *r;
|
||||
/* Alle geänderten Zauber in das array newspellids[]. mit SPL_NOSPELL
|
||||
* terminieren */
|
||||
region *r;
|
||||
/* Alle geänderten Zauber in das array newspellids[]. mit SPL_NOSPELL
|
||||
* terminieren */
|
||||
|
||||
spellid_t newspellids[] = {
|
||||
#ifdef WDW_PHOENIX
|
||||
SPL_WDWPYRAMID_TRAUM,
|
||||
SPL_WDWPYRAMID_ASTRAL,
|
||||
SPL_WDWPYRAMID_DRUIDE,
|
||||
SPL_WDWPYRAMID_BARDE,
|
||||
SPL_WDWPYRAMID_CHAOS,
|
||||
#endif
|
||||
SPL_NOSPELL
|
||||
};
|
||||
spellid_t newspellids[] = {
|
||||
SPL_NOSPELL
|
||||
};
|
||||
|
||||
/* die id's der neuen oder veränderten Sprüche werden in newspellids[]
|
||||
* abgelegt */
|
||||
/* die id's der neuen oder veränderten Sprüche werden in newspellids[]
|
||||
* abgelegt */
|
||||
|
||||
for(r=regions; r; r=r->next) {
|
||||
unit *u;
|
||||
for(u=r->units;u;u=u->next) {
|
||||
sc_mage *m = get_mage(u);
|
||||
if (u->faction->no == MONSTER_FACTION) continue;
|
||||
if (m != NULL) {
|
||||
int i;
|
||||
for(r=regions; r; r=r->next) {
|
||||
unit *u;
|
||||
for(u=r->units;u;u=u->next) {
|
||||
sc_mage *m = get_mage(u);
|
||||
if (u->faction->no == MONSTER_FACTION) continue;
|
||||
if (m != NULL) {
|
||||
int i;
|
||||
|
||||
if (m->magietyp == M_GRAU) continue;
|
||||
if (m->magietyp == M_GRAU) continue;
|
||||
|
||||
for (i = 0; newspellids[i] != SPL_NOSPELL; i++) {
|
||||
spell *sp = find_spellbyid(newspellids[i]);
|
||||
for (i = 0; newspellids[i] != SPL_NOSPELL; i++) {
|
||||
spell *sp = find_spellbyid(newspellids[i]);
|
||||
|
||||
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 (!sp) continue;
|
||||
|
||||
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
|
||||
|
|
|
@ -149,14 +149,15 @@ static void
|
|||
unit_addspell(unit& u, const char * name)
|
||||
{
|
||||
bool add = false;
|
||||
spell * sp = spelldaten;
|
||||
while (sp->id!=SPL_NOSPELL) {
|
||||
spell_list * slist = spells;
|
||||
while (slist!=NULL) {
|
||||
spell * sp = slist->data;
|
||||
if (strcmp(name, sp->sname)==0) {
|
||||
if (add) log_error(("two spells are called %s.\n", name));
|
||||
addspell(&u, sp->id);
|
||||
add = true;
|
||||
}
|
||||
++sp;
|
||||
slist=slist->next;
|
||||
}
|
||||
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
|
||||
unit_isfamiliar(const unit& u)
|
||||
{
|
||||
return is_familiar(&u);
|
||||
return is_familiar(&u)!=0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -178,6 +178,7 @@ game_init(void)
|
|||
|
||||
init_locales();
|
||||
init_attributes();
|
||||
init_spells();
|
||||
init_races();
|
||||
init_items();
|
||||
init_races();
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
#include <kernel/building.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/spell.h>
|
||||
#include <kernel/message.h>
|
||||
#include <kernel/plane.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_attributes();
|
||||
init_spells();
|
||||
init_races();
|
||||
init_items();
|
||||
init_economy();
|
||||
|
|
|
@ -1724,6 +1724,7 @@ main(int argc, char *argv[])
|
|||
|
||||
init_locales();
|
||||
init_attributes();
|
||||
init_spells();
|
||||
|
||||
init_resources();
|
||||
#if NEW_RESOURCEGROWTH
|
||||
|
|
Loading…
Reference in New Issue