- Posts: 937
- Thank you received: 17
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Because this warning tells us that "obj" is not set to anything useful before being used. And in the function, GET_EQ(ch, WEAR_LIGHT) is consistently used to get a pointer to the object.JTP wrote:
Code:void update_char_objects(struct char_data *ch) { int i; - struct obj_data *obj; if (GET_EQ(ch, WEAR_LIGHT) != NULL) if (GET_OBJ_TYPE(GET_EQ(ch, WEAR_LIGHT)) == ITEM_LIGHT) if (GET_OBJ_VAL(GET_EQ(ch, WEAR_LIGHT), 2) > 0) { i = --GET_OBJ_VAL(GET_EQ(ch, WEAR_LIGHT), 2); if (i == 1) { send_to_char(ch, "Your light begins to flicker and fade.\r\n"); act("$n's light begins to flicker and fade.", FALSE, ch, 0, 0, TO_ROOM); } else if (i == 0) { send_to_char(ch, "Your light sputters out and dies.\r\n"); act("$n's light sputters out and dies.", FALSE, ch, 0, 0, TO_ROOM); - extract_obj(obj); + extract_obj(GET_EQ(ch, WEAR_LIGHT)); world[IN_ROOM(ch)].light--; } }
JTP wrote: Compile:
handler.c: In function ‘update_char_objects’:
handler.c:884: warning: ‘obj’ is used uninitialized in this function
JTP wrote: I also tried extract_obj(WEAR_LIGHT)
That crashed the mud when light ran out,
Item was still in my eq list
Also tried putting the extract last after world[IN_ROOM......
That also crashed the mud, BUT when i got the game back up, the item was actually gone. But sucks it crashed it.
Please Log in or Create an account to join the conversation.
tbaMUD © 2024