George Greer wrote: > > [ Doh, take 3, it was originally a 204-line patch. It's now missing the > handler.h prototype for e_p_c, and the #defines for {PLR,MOB}_NOTDEADYET. ] > > Here's what I'm using for the 'extracting a dead character in the middle of > a loop' fix. Can anyone think of cases that this will either break or that > will break this? You have 16 hours. :) You forgot to check extractions_pending before looping through the entire player base (you check for an invlid value but you don't check to see if it's set). Also, I would move the validity test to right before you extract the character. Test for 0 there, not -1, then you can make extractions_pending unsigned (and effectively double its capacity). See below... > +/* local vars */ - +int extractions_pending = 0; + unsigned int extractions_pending = 0; > +void extract_pending_chars(void) > +{ > + struct char_data *vict, *next_vict; + int overflow = 0; > + - + if (extractions_pending < 0) - + log("SYSERR: Negative (%d) extractions pending.", extractions_pending); + if (!extractions_pending) + return; > + > + for (vict = character_list; vict && extractions_pending; vict = next_vict) { > + next_vict = vict->next; > + > + if (MOB_FLAGGED(vict, MOB_NOTDEADYET)) > + REMOVE_BIT(MOB_FLAGS(vict), MOB_NOTDEADYET); > + else if (PLR_FLAGGED(vict, PLR_NOTDEADYET)) > + REMOVE_BIT(PLR_FLAGS(vict), PLR_NOTDEADYET); > + else > + continue; > + > + extract_char_final(vict); + if (extractions_pending) > + extractions_pending--; + else + overflow++; > + } + if (overflow) + log("SYSERR: %d more extractions than extractions_pending.", overflow); + if (extractions_pending) + log("SYSERR: %d less extractions than extractions_pending", extractions_pending); > + extractions_pending = 0; > +} Regards, Peter -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/04/01 PST