Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CF: Fix for Wizard crashes (fwd)
- To: crossfire (at) ifi.uio.no
- Subject: CF: Fix for Wizard crashes (fwd)
- From: Rick Tanner
- Date: Sat, 27 May 2000 13:23:00 -0500 (CDT)
- Sender:
---------- Forwarded message ----------
Date: Sat, 27 May 2000 03:17:11 +0200
From: Norbert Irmer <>
To: ,
Subject: Fix for Wizard crashes
Hi,
Rick could you please forward this to the crossfire mailing list ?
Jan Echternach wrote:
> On Fri, May 26, 2000 at 05:21:04AM -0700, John Cater wrote:
> > I think it may be when a wizard summons something like a vampire...
> Thanks for this hint. I could reproduce the problem now. The wizards
> are not the problem. It's a vampire that is crashing the server.
> Vampires
>
> a) can have weapons
> b) can have the animate weapon spell
>
> which means that animate_weapon() doesn't return early and gets to the
> point where it crashes the server reliably. There are some unconditional
> esrv_send_item() calls...
I looked a bit deeper into this, and made the following simple changes
to "animate_weapon()" in "server/spell_effect.c" (i just added a few new
lines marked with a "+").
But this alone wasn't sufficient. When you left and reentered a map which
contains animated weapons the server still crashed, because it couldn't
find the animation for e.g. "animated dagger" in the saved map file.
So I had to make the following change to "find_animation()" in "common/anim.c" too:
After these changes I experienced no further crashes.
---------------------------------------------------------
CHANGED PART OF "anim.c"
---------------------------------------------------------
int find_animation(char *name)
{
Animations search, *match;
+ if( !name || (strcmp(name,"(null)")==0) ) return 0;
search.name = name;
match = (Animations*)bsearch(&search, animations, (num_animations+1),
sizeof(Animations), (int (*)())anim_compare);
if (match) return match->num;
LOG(llevError,"Unable to find animation %s\n", name);
return 0;
}
---------------------------------------------------------
CHANGED PART OF "spell_effect.c"
---------------------------------------------------------
int animate_weapon( ..... )
...
/* spell-dependent finishing touches and descriptive text */
switch(spellnum) {
case SP_STAFF_TO_SNAKE:
/* now, remove object from op inv, insert into golem */
remove_ob(weapon);
/* apply_special(op, weapon, AP_UNAPPLY);*/
insert_ob_in_ob(weapon,tmp);
fix_player(op);
+ if(op->type==PLAYER)
+ {
esrv_send_item(op, weapon);
new_draw_info(NDI_UNIQUE, 0,op,"Your staff becomes a serpent and leaps to the ground!");
+ }
break;
case SP_ANIMATE_WEAPON:
/* now, remove object from op inv, insert into golem */
remove_ob(weapon);
/* apply_special(op, weapon, AP_UNAPPLY);*/
insert_ob_in_ob(weapon,tmp);
fix_player(op);
+ if(op->type==PLAYER)
+ {
esrv_send_item(op, weapon);
new_draw_info_format(NDI_UNIQUE, 0,op,"Your %s flies from your hand and hovers in mid-air!",
weapon->name);
+ }
if(tmp->name) free_string(tmp->name);
sprintf(buf, "animated %s", weapon->name);
tmp->name = add_string(buf);
tmp->face = weapon->face;
tmp->animation_id = weapon->animation_id;
tmp->anim_speed = weapon->anim_speed;
tmp->last_anim = weapon->last_anim;
tmp->state = weapon->state;
if(QUERY_FLAG(weapon, FLAG_ANIMATE)) {
SET_FLAG(tmp,FLAG_ANIMATE);
} else {
CLEAR_FLAG(tmp,FLAG_ANIMATE);
}
update_ob_speed(tmp);
SET_FLAG(weapon,FLAG_APPLIED); /* so it can take acid damage */
break;
case SP_DANCING_SWORD:
+ if(op->type==PLAYER) {
new_draw_info(NDI_UNIQUE, 0,op,"A magical sword appears in mid air, eager to slay your foes
for you!");
+ }
break;
default:
break;
}
--
email:
web: http://gul.sourceforge.net
-
[you can put yourself on the announcement list only or unsubscribe altogether
by sending an email stating your wishes to ]