Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
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
LOP 1.45
Author: Remcon
Submitted by: Remcon
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
Users Online
CommonCrawl, Yandex

Members: 0
Guests: 5
Stats
Files
Topics
Posts
Members
Newest Member
477
3,705
19,232
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » SWR FUSS Bugfix List » [Bug] Player homes delete the...
Forum Rules | Mark all | Recent Posts

[Bug] Player homes delete their contents if players are loaded up.
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Jan 2, 2009, 11:11 am
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
JoinedMar 21, 2006

Bug: Homes deleting their 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 >>