Ok, again.. I asked this a few days ago.

Does anyone have any idea why my saving objects would be duplicating. I posted the saving code and never got any responses.

What looks like is happening is that it's not properly moving to the next obj while running through the list. Thoughts??

It is definitely in the SAVE part, not the load part.

Here is the save part again, let me know what any of you think. Thanks!

void save_pit ( void )
{
   OBJ_DATA *obj, *obj_next;
   FILE *fp;
   char buf[MSL];

   sprintf( buf, "%sobjects.dat", DATA_DIR );

   if ( !( fp = fopen( buf, "w+" ) ) )
   {
       bug( "Save objects: fopen", 0 );
       return;
   }

   for ( obj = object_list; obj != NULL; obj = obj_next )
   {
       obj_next = obj->next;

       if ( obj->carried_by != NULL || obj->pIndexData->delete )
           continue;

       if ( obj->item_type == ITEM_CORPSE_PC
       || obj->pIndexData->vnum == OBJ_VNUM_PIT
       || IS_OBJ_STAT(obj, ITEM_SAVE) )
           fwrite_obj( NULL, obj, fp, 0 );
   }

   fprintf( fp, "#END\n" );
   fclose( fp );
   return;
}


- Valnir

Reply via email to