Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CF: Fix for Wizard crashes (fwd)



> ---------- Forwarded message ----------
> Date: Sat, 27 May 2000 03:17:11 +0200
> From: Norbert Irmer <>

> 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.  

> int find_animation(char *name)
> {
>     Animations search, *match;
> 
> +    if( !name || (strcmp(name,"(null)")==0) ) return 0;

An ugly workaround that seems to work only if the libc's sprintf()
implementation produces "(null)" when printing a null pointer as a
string.  I don't know how faces and animations are supposed to work,
but a real fix is required here.

> +    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!");
> +    }

Yes, this should fix the problem I noticed.

But there are at least two other problems:

>     remove_ob(weapon);
>     /*    apply_special(op, weapon, AP_UNAPPLY);*/

The apply_special() call is required.  Without it, we get problems like
monsters with FLAG_READY_WEAPON and no weapon.

apply_special() probably needs a new flag AP_FORCE_UNAPPLY that ignores
FLAG_CURSED and FLAG_DAMNED.

>     SET_FLAG(weapon,FLAG_APPLIED); /* so it can take acid damage */

Playing games with FLAG_APPLIED is not fun.  apply_special() does much
more than setting FLAG_APPLIED for weapons.  Even if this works now, it
may break easily.

I think a better solution is to let hit_player_attacktype() damage
unapplied objects in a golem.  If this shouldn't be done for normal
golems (type GOLEM), a new type for animated weapons could be created.

-- 
Jan
-
[you can put yourself on the announcement list only or unsubscribe altogether
by sending an email stating your wishes to ]