fix a crash where wolves have not enough firce

This commit is contained in:
Enno Rehling 2012-04-16 06:58:03 +02:00
parent c070d999a3
commit 03f74f0a47
1 changed files with 21 additions and 19 deletions

View File

@ -795,30 +795,32 @@ int sp_wolfhowl(fighter * fi, int level, double power, spell * sp)
attrib *a; attrib *a;
message *msg; message *msg;
int force = (int)(get_force(power, 3) / 2); int force = (int)(get_force(power, 3) / 2);
unit *u = const race * rc = new_race[RC_WOLF];
create_unit(r, mage->faction, force, new_race[RC_WOLF], 0, NULL, mage); if (force>0) {
unused(sp); unit *u =
create_unit(r, mage->faction, force, rc, 0, NULL, mage);
unused(sp);
leave(u, true); leave(u, true);
setstatus(u, ST_FIGHT); setstatus(u, ST_FIGHT);
set_level(u, SK_WEAPONLESS, (int)(power / 3)); set_level(u, SK_WEAPONLESS, (int)(power / 3));
set_level(u, SK_STAMINA, (int)(power / 3)); set_level(u, SK_STAMINA, (int)(power / 3));
u->hp = u->number * unit_max_hp(u); u->hp = u->number * unit_max_hp(u);
if (fval(mage, UFL_ANON_FACTION)) {
fset(u, UFL_ANON_FACTION);
}
if (fval(mage, UFL_ANON_FACTION)) { a = a_new(&at_unitdissolve);
fset(u, UFL_ANON_FACTION); a->data.ca[0] = 0;
a->data.ca[1] = 100;
a_add(&u->attribs, a);
make_fighter(b, u, fi->side, is_attacker(fi));
} }
a = a_new(&at_unitdissolve);
a->data.ca[0] = 0;
a->data.ca[1] = 100;
a_add(&u->attribs, a);
make_fighter(b, u, fi->side, is_attacker(fi));
msg = msg =
msg_message("sp_wolfhowl_effect", "mage amount race", mage, u->number, msg_message("sp_wolfhowl_effect", "mage amount race", mage, force, rc);
u->race);
message_all(b, msg); message_all(b, msg);
msg_release(msg); msg_release(msg);