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)
|
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;
|
||||||
|
|
||||||
|
|
|
@ -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,11 +2887,9 @@ 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;
|
|
||||||
#endif
|
|
||||||
if (t<0) t = turn;
|
if (t<0) t = turn;
|
||||||
|
|
||||||
year = t/(months_per_year * weeks_per_month) + 1;
|
year = t/(months_per_year * weeks_per_month) + 1;
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -292,20 +292,19 @@ 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;
|
|
||||||
|
if (mtyp == M_GRAU) return;
|
||||||
|
|
||||||
sk = effskill(u, SK_MAGIC);
|
sk = effskill(u, SK_MAGIC);
|
||||||
if (sk == 0)
|
if (sk == 0) return;
|
||||||
return;
|
|
||||||
|
|
||||||
for (i = 0; spelldaten[i].id != SPL_NOSPELL; i++) {
|
for (slist=spells;slist!=NULL;slist=slist->next) {
|
||||||
if (spelldaten[i].magietyp == mtyp
|
spell * sp = slist->data;
|
||||||
&& spelldaten[i].level <= sk)
|
if (sp->magietyp == mtyp && sp->level <= sk) {
|
||||||
{
|
if (!has_spell(u, sp))
|
||||||
if (!getspell(u, spelldaten[i].id))
|
addspell(u, sp->id);
|
||||||
addspell(u, spelldaten[i].id);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -367,23 +366,20 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,17 +390,17 @@ updatespelllist(unit * u)
|
||||||
/* 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;
|
||||||
|
@ -415,8 +411,9 @@ updatespelllist(unit * u)
|
||||||
* 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;
|
|
||||||
|
|
||||||
m = get_mage(u);
|
|
||||||
if (!m) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (spt = m->spellptr; spt; spt = spt->next) {
|
|
||||||
if (spt->spellid == spellid) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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;
|
spell_ptr *spt;
|
||||||
sc_mage * m = get_mage(u);
|
sc_mage * m = get_mage(u);
|
||||||
spell * sp = NULL;
|
|
||||||
spell_names * sn;
|
|
||||||
|
|
||||||
if (!m) return NULL;
|
if (m==NULL) return false;
|
||||||
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) {
|
for (spt = m->spellptr; spt; spt = spt->next) {
|
||||||
if (sp->id==spt->spellid) return sp;
|
if (spt->spellid == sp->id) return true;
|
||||||
}
|
}
|
||||||
}
|
return false;
|
||||||
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;
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -2145,19 +2145,22 @@ readfaction(FILE * F)
|
||||||
set_ursprung(f, id, ux, uy);
|
set_ursprung(f, id, ux, uy);
|
||||||
}
|
}
|
||||||
f->newbies = 0;
|
f->newbies = 0;
|
||||||
f->options = ri(F);
|
|
||||||
|
|
||||||
if (((f->options & Pow(O_REPORT)) == 0)
|
i = f->options = ri(F);
|
||||||
&& (f->options & Pow(O_COMPUTER)) == 0) {
|
|
||||||
|
if ((i & Pow(O_REPORT))==0 && (i & 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;
|
||||||
|
|
||||||
|
if (sp->magietyp==f->magiegebiet && sp->level<=sk) {
|
||||||
|
a_add(&f->attribs, a_new(&at_seenspell))->data.i = sp->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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,16 +18,16 @@
|
||||||
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,
|
||||||
|
@ -221,72 +221,75 @@ enum {
|
||||||
#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 */
|
/* Kampfzauber */
|
||||||
extern int sp_fumbleshield(struct fighter * fi, int level, double power, struct spell * sp);
|
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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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);
|
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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
||||||
|
@ -927,7 +927,7 @@ xml_readstrings(xmlXPathContextPtr xpath, xmlNodePtr * nodeTab, int nodeNr, bool
|
||||||
|
|
||||||
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);
|
||||||
|
@ -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);
|
||||||
|
|
|
@ -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
|
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void register_spells(void);
|
extern void register_spells(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -274,13 +274,6 @@ show_newspells(void)
|
||||||
* terminieren */
|
* terminieren */
|
||||||
|
|
||||||
spellid_t newspellids[] = {
|
spellid_t newspellids[] = {
|
||||||
#ifdef WDW_PHOENIX
|
|
||||||
SPL_WDWPYRAMID_TRAUM,
|
|
||||||
SPL_WDWPYRAMID_ASTRAL,
|
|
||||||
SPL_WDWPYRAMID_DRUIDE,
|
|
||||||
SPL_WDWPYRAMID_BARDE,
|
|
||||||
SPL_WDWPYRAMID_CHAOS,
|
|
||||||
#endif
|
|
||||||
SPL_NOSPELL
|
SPL_NOSPELL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -302,7 +295,7 @@ show_newspells(void)
|
||||||
|
|
||||||
if (!sp) continue;
|
if (!sp) continue;
|
||||||
|
|
||||||
if (m->magietyp == sp->magietyp || getspell(u, sp->id)) {
|
if (m->magietyp == sp->magietyp || has_spell(u, sp)) {
|
||||||
attrib * a = a_find(u->faction->attribs, &at_reportspell);
|
attrib * a = a_find(u->faction->attribs, &at_reportspell);
|
||||||
while (a && a->data.i != sp->id) a = a->nexttype;
|
while (a && a->data.i != sp->id) a = a->nexttype;
|
||||||
if (!a) {
|
if (!a) {
|
||||||
|
@ -316,7 +309,6 @@ show_newspells(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue