Patrick Dughi wrote: > In other news, I found ..well.. I delt with what had become an > increasingly annoying problem. Basically, the problem was > mobile_activity. That's not to say the problem was _in_ mobile_activity, > but rather that it had a design flaw. > > Mobile activity contains a simple for loop, with the added cavet > that instead of iterating to ch->next, it saves ch->next in a var and then > iterates to that. This is so a mob can concievably > extract/purge/otherwise kill itself. However, the problem that is left - > what happens if a mob extracts/purges someone else? No problems, except > for that we're saving the value of 'next' before we operate. This could > in some circumstances become an issue as we opetate on a mangled pointer. > We can't work off the current mob else we loose the ability to have a mob > purge itself. So, there's a few solutions; > > 1) never extract chars in a spec-proc, or via mob actions in > mobile_Activity, except ones self. > 2) queue everyone to be deleted and deleted them in a seperate loop. > 3) think of something more inventive. 4. How about something like this (pseudocode, unchecked, variables names will differ)... for (currmob = top_of_table; *currmob; currmob = nextmob) { nextmob = currmob->next; /* Main Mob Code goes in here */ if (argument == REMOVE_PLAYER) { /* <--- Or something like that. */ if (player_to_be_removed == nextmob) nextmob = nextmov->next; /* Code to remove player in here. */ } /* Rest of Mob Code goes in here */ } +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST