fix bad castorder creation for combat spell (some unions are the WORST)

This commit is contained in:
Enno Rehling 2015-08-22 18:51:10 +02:00
parent dd667aa752
commit 9586d970e8
2 changed files with 10 additions and 7 deletions

View File

@ -1679,6 +1679,12 @@ static void report_failed_spell(struct battle * b, struct unit * mage, const str
msg_release(m); msg_release(m);
} }
static castorder * create_castorder_combat(castorder *co, fighter *fig, const spell * sp, int level, double force) {
co = create_castorder(co, fig->unit, 0, sp, fig->unit->region, level, force, 0, 0, 0);
co->magician.fig = fig;
return co;
}
void do_combatmagic(battle * b, combatmagic_t was) void do_combatmagic(battle * b, combatmagic_t was)
{ {
side *s; side *s;
@ -1714,7 +1720,8 @@ void do_combatmagic(battle * b, combatmagic_t was)
} }
} }
if (fig) { if (fig) {
co = create_castorder(0, fig->unit, 0, sp, r, 10, 10, 0, 0, 0); co = create_castorder_combat(0, fig, sp, 10, 10);
co->magician.fig = fig;
add_castorder(&spellranks[sp->rank], co); add_castorder(&spellranks[sp->rank], co);
break; break;
} }
@ -1779,8 +1786,7 @@ void do_combatmagic(battle * b, combatmagic_t was)
pay_spell(mage, sp, level, 1); pay_spell(mage, sp, level, 1);
} }
else { else {
co = create_castorder(0, fig->unit, 0, sp, r, level, power, 0, 0, 0); co = create_castorder_combat(0, fig, sp, level, power);
co->magician.fig = fig;
add_castorder(&spellranks[sp->rank], co); add_castorder(&spellranks[sp->rank], co);
} }
} }
@ -1812,8 +1818,7 @@ static int cast_combatspell(troop at, const spell * sp, int level, double force)
{ {
castorder co; castorder co;
create_castorder(&co, at.fighter->unit, 0, sp, at.fighter->unit->region, level, force, 0, 0, 0); create_castorder_combat(&co, at.fighter, sp, level, force);
co.magician.fig = at.fighter;
level = sp->cast(&co); level = sp->cast(&co);
free_castorder(&co); free_castorder(&co);
if (level > 0) { if (level > 0) {

View File

@ -42,8 +42,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
void register_triggers(void) void register_triggers(void)
{ {
if (verbosity >= 2)
printf("- registering triggers\n");
tt_register(&tt_changefaction); tt_register(&tt_changefaction);
tt_register(&tt_changerace); tt_register(&tt_changerace);
tt_register(&tt_createcurse); tt_register(&tt_createcurse);