Welcome to the Builder Academy

Question Warrior skill whirlwind doesn't work.

More
02 Jul 2016 17:09 - 02 Jul 2016 17:09 #6059 by Errigour
When I use the whirlwind skill I get error messages and if I use it to much it crashes the mud segmentation fault anyone have any idea how to fix it or where it's going wrong?
Code:
Jul 02 10:23:29 201 :: WARNING: Attempting to remove contents that don't exist in list. Jul 02 10:23:29 201 :: WARNING: Attempting to remove contents that don't exist in list. Jul 02 10:23:29 201 :: WARNING: Attempting to remove contents that don't exist in list. Jul 02 10:23:29 201 :: WARNING: Attempting to remove contents that don't exist in list. Jul 02 10:23:29 201 :: WARNING: Attempting to remove contents that don't exist in list. Jul 02 10:23:29 201 :: List being freed while not empty.
Last edit: 02 Jul 2016 17:09 by Errigour.

Please Log in or Create an account to join the conversation.

More
02 Jul 2016 17:49 #6060 by krell
Weird.

The related code is in act.offensive.c. Maybe the command is looking at the wrong list or something.

Code:
EVENTFUNC(event_whirlwind) { struct char_data *ch, *tch; struct mud_event_data *pMudEvent; struct list_data *room_list; int count; /* This is just a dummy check, but we'll do it anyway */ if (event_obj == NULL) return 0; /* For the sake of simplicity, we will place the event data in easily * referenced pointers */ pMudEvent = (struct mud_event_data *) event_obj; ch = (struct char_data *) pMudEvent->pStruct; /* When using a list, we have to make sure to allocate the list as it * uses dynamic memory */ room_list = create_list(); /* We search through the "next_in_room", and grab all NPCs and add them * to our list */ for (tch = world[IN_ROOM(ch)].people; tch; tch = tch->next_in_room) if (IS_NPC(tch)) add_to_list(tch, room_list); /* If our list is empty or has "0" entries, we free it from memory and * close off our event */ if (room_list->iSize == 0) { free_list(room_list); send_to_char(ch, "There is no one in the room to whirlwind!\r\n"); return 0; } /* We spit out some ugly colour, making use of the new colour options, * to let the player know they are performing their whirlwind strike */ send_to_char(ch, "\t[f313]You deliver a vicious \t[f014]\t[b451]WHIRLWIND!!!\tn\r\n"); /* Lets grab some a random NPC from the list, and hit() them up */ for (count = dice(1, 4); count > 0; count--) { tch = random_from_list(room_list); hit(ch, tch, TYPE_UNDEFINED); } /* Now that our attack is done, let's free out list */ free_list(room_list); /* The "return" of the event function is the time until the event is called * again. If we return 0, then the event is freed and removed from the list, but * any other numerical response will be the delay until the next call */ if (GET_SKILL(ch, SKILL_WHIRLWIND) < rand_number(1, 101)) { send_to_char(ch, "You stop spinning.\r\n"); return 0; } else return 1.5 * PASSES_PER_SEC; }

Please Log in or Create an account to join the conversation.

More
02 Jul 2016 17:59 #6061 by krell
If there are no NPCs to attack does the game still crash or does the command exit normally with a message that there is no one to attack? Does the game only crash when you have NPCs in the room to attack?

Please Log in or Create an account to join the conversation.

More
02 Jul 2016 18:13 #6062 by Errigour
Affirmative it only crashes when there are npcs.

Please Log in or Create an account to join the conversation.

More
02 Jul 2016 18:17 - 02 Jul 2016 18:18 #6063 by Errigour
Well it doesn't seem to be crashing the mud now but it is still giving errors every time I use it.
Last edit: 02 Jul 2016 18:18 by Errigour.

Please Log in or Create an account to join the conversation.

More
02 Jul 2016 18:25 #6064 by krell
Okay, because I tried it out and it keeps crashing for me when there are NPCs but I don't get the error messages. My issue is an ongoing one that's unrelated to yours.

You might want to over the functions the command is calling on to see if the correct lists are being populated and freed is about the only suggestion I can think of at the moment.

Please Log in or Create an account to join the conversation.

Time to create page: 0.221 seconds