- Posts: 937
- Thank you received: 17
simple_list forced to reset itself
- JTP
- Topic Author
- Offline
- Platinum Member
-
Hope one of you know whats wrong ?
If i need to post the lines of the other stuff from gdb let me know. Would be good to get fixed, must lie in the Stock code somewhere, since iwe not modificere simple_list.
(gdb) bt
#0 0x00504402 in __kernel_vsyscall ()
#1 0x002e1b10 in raise () from /lib/libc.so.6
#2 0x002e3421 in abort () from /lib/libc.so.6
#3 0x0816b4d6 in core_dump_real (who=0x81b77f2 "lists.c", line=264) at utils.c:833
#4 0x0810916c in simple_list (pList=0xb446f68) at lists.c:264
#5 0x080e56d7 in perform_violence () at fight.c:1231
#6 0x080b54c5 in heartbeat (heart_pulse=56080) at comm.c:996
#7 0x080b8178 in game_loop (local_mother_desc=3) at comm.c:941
#8 0x080b9d37 in init_game (argc=Cannot access memory at address 0x391b
) at comm.c:536
#9 main (argc=Cannot access memory at address 0x391b
) at comm.c:356
/* control the fights going on. Called every 2 seconds from comm.c. */
void perform_violence(void)
{
struct char_data *ch, *tch;
for (ch = combat_list; ch; ch = next_combat_list) {
next_combat_list = ch->next_fighting;
if (FIGHTING(ch) == NULL || IN_ROOM(ch) != IN_ROOM(FIGHTING(ch))) {
stop_fighting(ch);
continue;
}
if (IS_NPC(ch)) {
if (GET_MOB_WAIT(ch) > 0) {
GET_MOB_WAIT(ch) -= PULSE_VIOLENCE;
continue;
}
GET_MOB_WAIT(ch) = 0;
if (GET_POS(ch) < POS_FIGHTING) {
GET_POS(ch) = POS_FIGHTING;
act("$n scrambles to $s feet!", TRUE, ch, 0, 0, TO_ROOM);
}
if ((GET_HIT(FIGHTING(ch)) <= 12) && (MOB_FLAGGED(ch, MOB_MERCY))) {
stop_fighting(FIGHTING(ch));
stop_fighting(ch);
act("$n says: Blessed are the merciful, for they shall obtain mercy!", FALSE, ch, 0, 0, TO_ROOM);
}
// re-wield weapon lost to SKILL_DISARM
if (LOST_WEAPON(ch)) {
if (DISARM_WAIT(ch) > 0) {
DISARM_WAIT(ch) -= PULSE_VIOLENCE;
} else {
do_wield(ch, OBJN(LOST_WEAPON(ch), ch), 0, 0);
LOST_WEAPON(ch) = NULL;
}
}
}
if (GET_POS(ch) < POS_FIGHTING) {
send_to_char(ch, "You can't fight while sitting!!\r\n");
continue;
}
if (GET_MOVE(ch) <= 0)
continue;
if (GROUP(ch)) {
while ((tch = (struct char_data *) simple_list(GROUP(ch)->members)) != NULL) { <<<---Line 1231
if (tch == ch)
continue;
if (!IS_NPC(tch) && !PRF_FLAGGED(tch, PRF_AUTOASSIST))
continue;
if (IN_ROOM(ch) != IN_ROOM(tch))
continue;
if (FIGHTING(tch))
continue;
if (GET_POS(tch) != POS_STANDING)
continue;
if (!CAN_SEE(tch, ch))
continue;
do_assist(tch, GET_NAME(ch), 0, 0);
}
}
{
hit(ch, FIGHTING(ch), TYPE_UNDEFINED);
GET_MOVE(ch) -= 1;
}
Update:
Just Saw it in fight...see pic.
Its happening when mobs assist it seems.
Please Log in or Create an account to join the conversation.
- thomas
-
- Offline
- Administrator
-
- Posts: 818
- Thank you received: 159
It looks like you are using mud events for triggering multiple attacks. Those events internally use simple_list() for determining which events to trigger. Unfortunately, calling simple_list() inside a loop governed by a call to simple_list() won't work as you might think it would.
Instead, at least one of the places, one must use the "long work-around":
- if (GROUP(ch)) {
- while ((tch = (struct char_data *) simple_list(GROUP(ch)->members)) != NULL) {
+ if (GROUP(ch) && GROUP(ch)->members && GROUP(ch)->members->iSize) {
+ struct iterator_data Iterator;
+
+ tch = (struct char_data *) merge_iterator(&Iterator, GROUP(ch)->members);
+ for (; tch ; tch = next_in_list(&Iterator)) {
if (tch == ch)
continue;
if (!IS_NPC(tch) && !PRF_FLAGGED(tch, PRF_AUTOASSIST))
continue;
if (IN_ROOM(ch) != IN_ROOM(tch))
continue;
if (FIGHTING(tch))
continue;
if (GET_POS(tch) != POS_STANDING)
continue;
if (!CAN_SEE(tch, ch))
continue;
do_assist(tch, GET_NAME(ch), 0, 0);
}
+ remove_iterator(&Iterator);
}
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
- Posts: 937
- Thank you received: 17
Is: != NULL
No longer needed ?
Please Log in or Create an account to join the conversation.
- thomas
-
- Offline
- Administrator
-
- Posts: 818
- Thank you received: 159
A for loop will evaluate a something pointing to NULL as false; since we have this in utils.h:
/* OS compatibility */
#ifndef NULL
/** Just in case NULL is not defined. */
#define NULL (void *)0
#endif
Of course, if someone was to use an old, strange, architecture it might not work. But then, most of the rest of the code would fail.
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
- Posts: 937
- Thank you received: 17
[ SYSERR: simple_list() forced to reset itself. ]
:( But didnt crash, just SYSERR in game
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
- Posts: 937
- Thank you received: 17
Please Log in or Create an account to join the conversation.
- thomas
-
- Offline
- Administrator
-
- Posts: 818
- Thank you received: 159
void * random_from_list(struct list_data * pList)
{
+ struct iterator_data localIterator;
void * pFoundItem;
bool found;
int number;
int count = 1;
if (pList->iSize <= 0)
return NULL;
else
number = rand_number(1, pList->iSize);
- pFoundItem = merge_iterator(&Iterator, pList);
+ pFoundItem = merge_iterator(&localIterator, pList);
- for (found = FALSE; pFoundItem != NULL; pFoundItem = next_in_list(&Iterator), count++) {
+ for (found = FALSE; pFoundItem != NULL; pFoundItem = next_in_list(&localIterator), count++) {
if (count == number) {
found = TRUE;
break;
}
}
- remove_iterator(&Iterator);
+ remove_iterator(&localIterator);
if (found)
return (pFoundItem);
else
return NULL;
}
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
- Posts: 937
- Thank you received: 17
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
- Posts: 937
- Thank you received: 17
Because that seems to be it, maybe your fix also fix that ?
Please Log in or Create an account to join the conversation.
- thomas
-
- Offline
- Administrator
-
- Posts: 818
- Thank you received: 159
I think you see this because if your whirlwind kills someone while you are in a group, you'll trigger group_gain() which uses simple_list(). Which also uses the static Iterator in lists.c.
Please Log in or Create an account to join the conversation.
- Fizban
- Offline
- Administrator
-
- Posts: 157
- Thank you received: 17
Please Log in or Create an account to join the conversation.
- Fizban
- Offline
- Administrator
-
- Posts: 157
- Thank you received: 17
Before making them when rumble whirlwinded it sometimes sent this.
[ WARNING: Attempting to get content from iterator with NULL list. ]
[ WARNING: Attempting to remove iterator from NULL list. ]
[ List being freed while not empty. ]
After adding the changes it still sends
[ WARNING: Attempting to get content from iterator with NULL list. ]
[ WARNING: Attempting to remove iterator from NULL list. ]
The third message though has no appeared since adding the changes.
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
- Posts: 937
- Thank you received: 17
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
- Posts: 937
- Thank you received: 17
Jan 20 19:32:48 :: SYSERR: simple_list() forced to reset itself.
Jan 20 19:32:48 :: SYSERR: Assertion failed at lists.c:264!
:(
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
- Posts: 937
- Thank you received: 17
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
- Posts: 937
- Thank you received: 17
Feb 25 08:50:48 :: SYSERR: simple_list() forced to reset itself.
Feb 25 08:50:48 :: SYSERR: Assertion failed at lists.c:264!
Please Log in or Create an account to join the conversation.