forked from github/server
Das durcheinander mit 0 und -1 bei den spells (SPL_NOSPELL) hoffentlich bereinigt.
This commit is contained in:
parent
fa69b66879
commit
8d04c6a448
|
@ -209,11 +209,13 @@ read_mage(attrib * a, FILE * F)
|
|||
int i, mtype;
|
||||
sc_mage * mage = (sc_mage*)a->data.v;
|
||||
spell_ptr ** sp = &mage->spellptr;
|
||||
|
||||
fscanf(F, "%d %d %d", &mtype, &mage->spellpoints, &mage->spchange);
|
||||
mage->magietyp = (magic_t)mtype;
|
||||
for (i=0;i!=MAXCOMBATSPELLS;++i) {
|
||||
int spid;
|
||||
fscanf (F, "%d %d", &spid, &mage->combatspelllevel[i]);
|
||||
if (spid<0) spid = SPL_NOSPELL;
|
||||
mage->combatspell[i] = (spellid_t)spid;
|
||||
}
|
||||
for (;;) {
|
||||
|
@ -232,12 +234,11 @@ write_mage(const attrib * a, FILE * F) {
|
|||
int i;
|
||||
sc_mage *mage = (sc_mage*)a->data.v;
|
||||
spell_ptr *sp = mage->spellptr;
|
||||
fprintf (F, "%d %d %d ",
|
||||
mage->magietyp, mage->spellpoints, mage->spchange);
|
||||
fprintf(F, "%d %d %d ", mage->magietyp, mage->spellpoints, mage->spchange);
|
||||
for (i=0;i!=MAXCOMBATSPELLS;++i) {
|
||||
fprintf(F, "%d %d ", mage->combatspell[i], mage->combatspelllevel[i]);
|
||||
}
|
||||
while (sp) {
|
||||
while (sp!=NULL) {
|
||||
fprintf (F, "%d ", sp->spellid);
|
||||
sp = sp->next;
|
||||
}
|
||||
|
@ -490,7 +491,7 @@ get_combatspell(const unit *u, int nr)
|
|||
m = get_mage(u);
|
||||
if (m) {
|
||||
return find_spellbyid(m->combatspell[nr]);
|
||||
} else if(u->race->precombatspell != NO_SPELL) {
|
||||
} else if(u->race->precombatspell != SPL_NOSPELL) {
|
||||
return find_spellbyid(u->race->precombatspell);
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ rc_new(const char * zName)
|
|||
rc->_name[2] = strdup(zBuffer);
|
||||
sprintf(zBuffer, "%s_x", zName);
|
||||
rc->_name[3] = strdup(zBuffer);
|
||||
rc->precombatspell = NO_SPELL;
|
||||
rc->precombatspell = SPL_NOSPELL;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
|
@ -7784,7 +7784,6 @@ find_spellbyid(spellid_t id)
|
|||
{
|
||||
spell_list * slist;
|
||||
|
||||
assert(id!=SPL_DONOTUSE);
|
||||
for (slist=spells;slist!=NULL;slist=slist->next) {
|
||||
spell* sp = slist->data;
|
||||
if (sp->id == id) return sp;
|
||||
|
|
|
@ -28,7 +28,7 @@ extern "C" {
|
|||
|
||||
/* Sprüche. Neue NUR hinten anfügen, oder das Datenfile geht kaputt */
|
||||
enum {
|
||||
SPL_DONOTUSE,
|
||||
SPL_NOSPELL,
|
||||
SPL_ARTEFAKT_OF_POWER,
|
||||
SPL_ARTEFAKT_OF_AURAPOWER,
|
||||
SPL_ARTEFAKT_OF_REGENERATION,
|
||||
|
@ -219,9 +219,7 @@ extern "C" {
|
|||
SPL_WDWPYRAMID_BARDE,
|
||||
SPL_WDWPYRAMID_CHAOS,
|
||||
#endif
|
||||
SPL_NOSPELL = (spellid_t) -1
|
||||
};
|
||||
#define NO_SPELL SPL_NOSPELL
|
||||
|
||||
/* Prototypen */
|
||||
|
||||
|
|
|
@ -774,10 +774,10 @@ parse_races(xmlDocPtr doc)
|
|||
/* reading eressea/races/race/precombatspell */
|
||||
xpath->node = node;
|
||||
result = xmlXPathEvalExpression(BAD_CAST "precombatspell", xpath);
|
||||
assert(rc->precombatspell==NO_SPELL || !"precombatspell is already initialized");
|
||||
assert(rc->precombatspell==SPL_NOSPELL || !"precombatspell is already initialized");
|
||||
for (k=0;k!=result->nodesetval->nodeNr;++k) {
|
||||
xmlNodePtr node = result->nodesetval->nodeTab[k];
|
||||
rc->precombatspell = (spellid_t)xml_ivalue(node, "spell", NO_SPELL);
|
||||
rc->precombatspell = (spellid_t)xml_ivalue(node, "spell", SPL_NOSPELL);
|
||||
}
|
||||
xmlXPathFreeObject(result);
|
||||
|
||||
|
|
Loading…
Reference in New Issue