Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
Bug in do_drag( )
Oct 8, 2017, 12:40 am
By GatewaySysop
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Beastmaster 6D sound files
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, DotBot, Yahoo!, Google

Members: 0
Guests: 9
Stats
Files
Topics
Posts
Members
Newest Member
476
3,704
19,231
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » SWFOTE FUSS Bugfix List » [Bug] Homes deleting thier co...
Forum Rules | Mark all | Recent Posts

[Bug] Homes deleting thier contents
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Dec 20, 2008, 8:07 pm   Last edited Dec 20, 2008, 8:11 pm by Keberus
Go to the top of the page
Go to the bottom of the page

Keberus
Conjurer
GroupFUSS Project Team
Posts341
JoinedJun 4, 2005

Bug: Homes deleting thier contents
Danger: Medium - Players may lose the contents of thier home.
Found by: Banner
Fixed by: Banner/Keberus/DavidHaley

---

comm.c, nanny

remove:
         if( ch->plr_home != NULL )
         {
            char filename[256];
            FILE *fph;
            ROOM_INDEX_DATA *storeroom = ch->plr_home;
            OBJ_DATA *obj;
            OBJ_DATA *obj_next;

            for( obj = storeroom->first_content; obj; obj = obj_next )
            {
               obj_next = obj->next_content;
               extract_obj( obj );
            }

            sprintf( filename, "%s%c/%s.home", PLAYER_DIR, tolower( ch->name[0] ), capitalize( ch->name ) );
            if( ( fph = fopen( filename, "r" ) ) != NULL )
            {
               int iNest;
               bool found;
               OBJ_DATA *tobj, *tobj_next;

               rset_supermob( storeroom );
               for( iNest = 0; iNest < MAX_NEST; iNest++ )
                  rgObjNest[iNest] = NULL;

               found = TRUE;
               for( ;; )
               {
                  char letter;
                  char *word;

                  letter = fread_letter( fph );
                  if( letter == '*' )
                  {
                     fread_to_eol( fph );
                     continue;
                  }

                  if( letter != '#' )
                  {
                     bug( "Load_plr_home: # not found.", 0 );
                     bug( ch->name, 0 );
                     break;
                  }

                  word = fread_word( fph );
                  if( !str_cmp( word, "OBJECT" ) ) /* Objects  */
                     fread_obj( supermob, fph, OS_CARRY );
                  else if( !str_cmp( word, "END" ) )  /* Done     */
                     break;
                  else
                  {
                     bug( "Load_plr_home: bad section.", 0 );
                     bug( ch->name, 0 );
                     break;
                  }
               }

               fclose( fph );

               for( tobj = supermob->first_carrying; tobj; tobj = tobj_next )
               {
                  tobj_next = tobj->next_content;
                  obj_from_char( tobj );
                  obj_to_room( tobj, storeroom );
               }

               release_supermob(  );

            }
         }


save.c

Add this at the top:
void load_plr_home( CHAR_DATA * ch );


Put this at the bottom:
void load_plr_home( CHAR_DATA * ch )
{
    char filename[256];
    FILE *fph;
    ROOM_INDEX_DATA *storeroom = ch->plr_home;
    OBJ_DATA *obj;
    OBJ_DATA *obj_next;

    if( IS_NPC( ch ) || ch->plr_home == NULL )
        return;

    for( obj = storeroom->first_content; obj; obj = obj_next )
    {
        obj_next = obj->next_content;
        extract_obj( obj );
    }

    sprintf( filename, "%s%c/%s.home", PLAYER_DIR, tolower( ch->name[0] ), capitalize( ch->name ) );
    if( ( fph = fopen( filename, "r" ) ) != NULL )
    {
        int iNest;
        bool found;
        OBJ_DATA *tobj, *tobj_next;

        rset_supermob( storeroom );
        for( iNest = 0; iNest < MAX_NEST; iNest++ )
            rgObjNest[iNest] = NULL;

        found = TRUE;
        for( ;; )
        {
            char letter;
            char *word;

            letter = fread_letter( fph );
            if( letter == '*' )
            {
                fread_to_eol( fph );
                continue;
            }

            if( letter != '#' )
            {
                bug( "Load_plr_home: # not found.", 0 );
                bug( ch->name, 0 );
                break;
            }

            word = fread_word( fph );
            if( !str_cmp( word, "OBJECT" ) ) /* Objects  */
                fread_obj( supermob, fph, OS_CARRY );
            else if( !str_cmp( word, "END" ) )  /* Done     */
                break;
            else
            {
                bug( "Load_plr_home: bad section.", 0 );
                bug( ch->name, 0 );
                break;
            }
        }

        fclose( fph );

        for( tobj = supermob->first_carrying; tobj; tobj = tobj_next )
        {
            tobj_next = tobj->next_content;
            obj_from_char( tobj );
            obj_to_room( tobj, storeroom );
        }

        release_supermob(  );
    }
}



save.c, load_char_obj

find:
    return found;
}


Before that insert:
    if( found )
    {
       if( ch->plr_home != NULL )
          load_plr_home( ch );
    }


This will allow players to be loaded up without the risk of losing the contents of thier homes when resaved or if they log in while loaded up.
       
Pages:<< prev 1 next >>