I'm having a problem with a function that is supposed to crumble and
object after the timer expires. What happens is if a character is wield
or wearing an item that is supposed to be crumbled the MUD crashes. If
it is just in the inventory or in the room, no crash. I have been able
to track down the line that is causing the mud to crash but I don't
understand why or how to fix it.
void crumble_obj(struct char_data *ch, struct obj_data *obj)
{
struct obj_data *loop;
int index;
char debug[80];
if (obj->in_room != NOWHERE) /* In a room */
{
if (world[obj->in_room].people)
{
act("A quivering horde of maggots consumes $p.",
TRUE, world[obj->in_room].people, obj, 0, TO_ROOM);
act("A quivering horde of maggots consumes $p.",
TRUE, world[obj->in_room].people, obj, 0, TO_CHAR);
for(loop = obj->contains; loop; loop = obj->contains)
{
obj_from_obj(loop);
obj_to_room(loop, obj->in_room);
}
}
}
else if(!obj->in_obj) /* Worn or inventory */
{
act("$p decays in your hands.", FALSE, ch, obj, 0, TO_CHAR);
for(loop = obj->contains; loop; loop = obj->contains)
{
obj_from_obj(loop);
obj_to_char(loop, ch);
}
if (!obj->carried_by)
{
for(index = 0; index < NUM_WEARS; index++)
{
----------->if(GET_EQ(ch, index) && ch->equipment[index] == obj)
crash {
here obj = unequip_char(ch, index);
}
}
}
}
It crashes when checking if an item is at any of the wear locations.
I guess it checks the first wear location (lightsource if memory serves
me) and gets a segmentation fault because nothing is there? Does anyone
know how to fix this problem?
-Brian
--
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Haddixx | -=-=-Implementor of Avalanche MUD-=-=- |
+ Brian M. Menges + Running at: 143.207.31.45 8000 +
| haddixx@megamed.com | Web Page: http://www.megamed.com/~haddixx |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://cspo.queensu.ca/~fletcher/Circle/list_faq.html |
+-----------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/07/00 PST