Hello everyone,
Every couple of weeks or so we'll crash with a problem in curse. Usually
the problem is vo is NULL. It always happened when curse was either an
affect that would be added after eating a pill, or when a scroll of curse
was recited on an object. In trying to squash this bug, I may have found
a problem in obj_cast_spell. Attached is the stock problematic(?) portion
of the code. I added brackets based on the indentions, in order to not
get ambiguous else statements when compiling.
case TAR_OBJ_CHAR_OFF:
if ( victim == NULL && obj == NULL)
{ <-- Added this so the compiler didn't complain.
if (ch->fighting != NULL)
victim = ch->fighting;
else
{
send_to_char("You can't do that.\n\r",ch);
return;
}
if (victim != NULL)
{
if (is_safe_spell(ch,victim,FALSE) && ch != victim)
{
send_to_char("Somehting isn't right...\n\r",ch);
return;
}
vo = (void *) victim;
target = TARGET_CHAR;
}
else
{
vo = (void *) obj;
target = TARGET_OBJ;
}
} <-- Added this so the compiler didn't complain.
break;
See how "something" is misspelled? Haha, what a horrible bug! Just
kidding. Seriously though, it offers no else statement for if ( victim ==
NULL && obj == NULL). I added as an alternative (a la TAR_OBJ_CHAR_DEF):
else if (victim != NULL)
{
vo = (void *) victim;
target = TARGET_CHAR;
}
else
{
vo = (void *) obj;
target = TARGET_OBJ;
}
I'm no longer able to crash the mud when reciting a scroll of curse on an
object, and my pills of curse work as well. I can still manually cast on
myself, on others, and on objects. Does anyone see anything wrong with
this, and is this in fact a bug? I'm simply helping with this mud, and
there have been tons of changes that may have "broken" it.
Thanks,
Jimmy