[NEWBIE][CODE] object_list and extract_obj

From: Mundi King (kingmundi@YAHOO.COM)
Date: 07/05/98


i have heard that the grenade code in ranged2_1.patch,
can cause erros, but have been unable to
reproduce them, however i did some investingating,
and have a question of whether the following code
has been written correctly

in ranged2_1.patch there is a piece of code
for tick_grenade in fight.c

for (i=object_list; i; i=->next)
{
  if (IS_SET(GET_OBJ_EXTRA(i), ITEM_LIVE_GRENADE)) {
       /* update ticks */

       blah
       }
  blah
  blah

  extract_obj(i);
}

compared to
point_update in limits.c

for(j = object_list;j;j = next_thing) {
  next_thing = j->next;

  blah blah
  blah

  extract_obj(j);
}

i believe i see the reasoning behind this,
but would like some feedback from someone
with more coding experience, is the following
true

extract_obj affects the object_list,
and extracting an object without first
keeping a holder variable of the item,
can knock the for loop out of reference




_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST