forked from github/server
old eressea executable has problems with non-existing lua spells.
This commit is contained in:
parent
ef2e1c8da9
commit
a1de5d5701
3 changed files with 103 additions and 75 deletions
|
@ -1482,13 +1482,16 @@ do_combatmagic(battle *b, combatmagic_t was)
|
||||||
const spell * sp = co->sp;
|
const spell * sp = co->sp;
|
||||||
int level = co->level;
|
int level = co->level;
|
||||||
double power = co->force;
|
double power = co->force;
|
||||||
|
if (sp->sp_function==NULL) {
|
||||||
|
log_error(("spell '%s' has no function.\n", sp->sname));
|
||||||
|
} else {
|
||||||
level = ((cspell_f)sp->sp_function)(fig, level, power, sp);
|
level = ((cspell_f)sp->sp_function)(fig, level, power, sp);
|
||||||
if (level > 0) {
|
if (level > 0) {
|
||||||
pay_spell(fig->unit, sp, level, 1);
|
pay_spell(fig->unit, sp, level, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
for (spellrank = 0; spellrank < MAX_SPELLRANK; spellrank++) {
|
for (spellrank = 0; spellrank < MAX_SPELLRANK; spellrank++) {
|
||||||
free_castorders(cll[spellrank]);
|
free_castorders(cll[spellrank]);
|
||||||
}
|
}
|
||||||
|
@ -1561,11 +1564,15 @@ do_combatspell(troop at, int row)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sp->sp_function==NULL) {
|
||||||
|
log_error(("spell '%s' has no function.\n", sp->sname));
|
||||||
|
} else {
|
||||||
level = ((cspell_f)sp->sp_function)(fi, level, power, sp);
|
level = ((cspell_f)sp->sp_function)(fi, level, power, sp);
|
||||||
if (level > 0) {
|
if (level > 0) {
|
||||||
pay_spell(mage, sp, level, 1);
|
pay_spell(mage, sp, level, 1);
|
||||||
at.fighter->action_counter++;
|
at.fighter->action_counter++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1584,7 +1591,11 @@ do_extra_spell(troop at, const att *a)
|
||||||
|
|
||||||
/* nur bei Monstern können mehrere 'Magier' in einer Einheit sein */
|
/* nur bei Monstern können mehrere 'Magier' in einer Einheit sein */
|
||||||
power = sp->level * au->number;
|
power = sp->level * au->number;
|
||||||
|
if (sp->sp_function==NULL) {
|
||||||
|
log_error(("spell '%s' has no function.\n", sp->sname));
|
||||||
|
} else {
|
||||||
((cspell_f)sp->sp_function)(fi, sp->level, power, sp);
|
((cspell_f)sp->sp_function)(fi, sp->level, power, sp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -202,7 +202,6 @@ static int
|
||||||
read_mage(attrib * a, FILE * F)
|
read_mage(attrib * a, FILE * F)
|
||||||
{
|
{
|
||||||
int i, mtype;
|
int i, mtype;
|
||||||
boolean update = false;
|
|
||||||
sc_mage * mage = (sc_mage*)a->data.v;
|
sc_mage * mage = (sc_mage*)a->data.v;
|
||||||
char spname[64];
|
char spname[64];
|
||||||
|
|
||||||
|
@ -1355,7 +1354,11 @@ do_fumble(castorder *co)
|
||||||
case 5:
|
case 5:
|
||||||
case 6:
|
case 6:
|
||||||
/* Spruch gelingt, aber alle Magiepunkte weg */
|
/* Spruch gelingt, aber alle Magiepunkte weg */
|
||||||
|
if (sp->sp_function==NULL) {
|
||||||
|
log_error(("spell '%s' has no function.\n", sp->sname));
|
||||||
|
} else {
|
||||||
((nspell_f)sp->sp_function)(co);
|
((nspell_f)sp->sp_function)(co);
|
||||||
|
}
|
||||||
set_spellpoints(u, 0);
|
set_spellpoints(u, 0);
|
||||||
ADDMSG(&u->faction->msgs, msg_message("patzer4", "unit region spell",
|
ADDMSG(&u->faction->msgs, msg_message("patzer4", "unit region spell",
|
||||||
u, r, sp));
|
u, r, sp));
|
||||||
|
@ -1366,7 +1369,11 @@ do_fumble(castorder *co)
|
||||||
case 9:
|
case 9:
|
||||||
default:
|
default:
|
||||||
/* Spruch gelingt, alle nachfolgenden Sprüche werden 2^4 so teuer */
|
/* Spruch gelingt, alle nachfolgenden Sprüche werden 2^4 so teuer */
|
||||||
|
if (sp->sp_function==NULL) {
|
||||||
|
log_error(("spell '%s' has no function.\n", sp->sname));
|
||||||
|
} else {
|
||||||
((nspell_f)sp->sp_function)(co);
|
((nspell_f)sp->sp_function)(co);
|
||||||
|
}
|
||||||
ADDMSG(&u->faction->msgs, msg_message("patzer5", "unit region spell",
|
ADDMSG(&u->faction->msgs, msg_message("patzer5", "unit region spell",
|
||||||
u, r, sp));
|
u, r, sp));
|
||||||
countspells(u, 3);
|
countspells(u, 3);
|
||||||
|
@ -2758,7 +2765,12 @@ magic(void)
|
||||||
/* zuerst bezahlen, dann evt in do_fumble alle Aura verlieren */
|
/* zuerst bezahlen, dann evt in do_fumble alle Aura verlieren */
|
||||||
fumbled = true;
|
fumbled = true;
|
||||||
} else if (co->force>0) {
|
} else if (co->force>0) {
|
||||||
|
if (sp->sp_function==NULL) {
|
||||||
|
log_error(("spell '%s' has no function.\n", sp->sname));
|
||||||
|
co->level = 0;
|
||||||
|
} else {
|
||||||
co->level = ((nspell_f)sp->sp_function)(co);
|
co->level = ((nspell_f)sp->sp_function)(co);
|
||||||
|
}
|
||||||
if (co->level <= 0) {
|
if (co->level <= 0) {
|
||||||
/* Kosten nur für real benötige Stufe berechnen */
|
/* Kosten nur für real benötige Stufe berechnen */
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -197,7 +197,12 @@ unit_castspell(unit& u, const char * name)
|
||||||
co->par = NULL;
|
co->par = NULL;
|
||||||
co->rt = u.region;
|
co->rt = u.region;
|
||||||
co->sp = sp;
|
co->sp = sp;
|
||||||
|
if (sp->sp_function==NULL) {
|
||||||
|
log_error(("spell '%s' has no function.\n", sp->sname));
|
||||||
|
co->level = 0;
|
||||||
|
} else {
|
||||||
sp->sp_function(co);
|
sp->sp_function(co);
|
||||||
|
}
|
||||||
free(co);
|
free(co);
|
||||||
}
|
}
|
||||||
slist=slist->next;
|
slist=slist->next;
|
||||||
|
|
Loading…
Reference in a new issue