I recently posted about object resets, this time I am going to
post the part of the code that I am working with.

   if ( pRoom->area->nplayer > 0
     || ( LastObj = get_obj_type( pObjToIndex ) ) == NULL
     || ( LastObj->in_room == NULL && !last)
     || ( pObjIndex->count >= limit /* && number_range(0,4) != 0 */ )
     || ( count = count_obj_list( pObjIndex, LastObj->contains ) )
pReset->arg4  )
   {
       last = FALSE;
       break;
   }
                                       /* lastObj->level  -  ROM */

   while (count < pReset->arg4)
   {
   pObj = create_object( pObjIndex, number_fuzzy( LastObj->level ) );
   obj_to_obj( pObj, LastObj );
       count++;
       if (pObjIndex->count >= limit)
           break;
   }

Here is what I see. LastObj is a container and pObj is being reset
into it, the reset will take place unless the count > pReset->arg4
the problem is that if one of those objects exists anywhere in the
world like in my inventory for example it will not be reset. Looks
to me like a global count is being done for pObj. See below.

     || ( count = count_obj_list( pObjIndex, LastObj->contains ) )

I still don't understand why it is that if the pObj is not inside
the LastObj but exists elsewhere there seems to be no way to get
it reset into the LastObj.

Whats even worse is that this seems to be SUPPOSED to only count
how many pObj are in LastObj shown above.

/*
* Count occurrences of an obj in a list.
*/
int count_obj_list( OBJ_INDEX_DATA *pObjIndex, OBJ_DATA *list )
{
   OBJ_DATA *obj;
   int nMatch;

   nMatch = 0;
   for ( obj = list; obj != NULL; obj = obj->next_content )
   {
       if ( obj->pIndexData == pObjIndex )
           nMatch++;
   }

   return nMatch;
}

Look, it looks like its only counting whats inside LastObj but I have
done a little more experimenting with it, I am SURE it is counting
global instead of just the contents of LastObj. I reset 3 rabbits
feet into a magician's hat which is a container, not headware. If I
to get all three of them, leave the area and reset it none will be
inside the hat, if I sac one, leave the area, reset the area and check
there will be 1 inside the hat. This proves the other 2 were counted
which proves a global count of pObj. All I want is to reset 3 rabbit
feet into the hat no matter who has one in their inventory.

_________________________________________________________________
MSN 8: advanced junk mail protection and 2 months FREE*. http://join.msn.com/?page=features/junkmail


Reply via email to