Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
 Couple bugs
Yesterday, 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, Yahoo!, DotBot

Members: 0
Guests: 15
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 » Codebases » SWR FUSS » Major bug with homes deleting...
Forum Rules | Mark all | Recent Posts

Major bug with homes deleting house contents
< Newer Topic :: Older Topic > act_wiz.c

Pages:<< prev 1 next >>
Post is unread #1 Sep 6, 2008, 8:42 am
Go to the top of the page
Go to the bottom of the page

Banner
Magician
GroupMembers
Posts169
JoinedNov 29, 2005

Heh. Doesn't look like this place is being updated, but whatever. -_-

There's a bug in the stock home system with SWR. My immortals generally use LOADUP on offline players to award them roleplay points for logs they've posted. When a player quits in their home and are loaded up, LOADUP does not load their home, so when they are transferred back and FQUIT, it overwrites the contents of their home file with an empty file.

However, the solution is simple. Use load_home in loadup to load the character's home. This loads all the objects from the player's home file, so that when they are transfered back and fquit and they save, they save the proper contents of the house and not a blank file.

In act_wiz.c, in do_loadup:

      if( get_trust( d->character ) >= get_trust( ch ) )
      {
         do_say( d->character, "Do *NOT* disturb me again!" );
         send_to_char( "I think you'd better leave that player alone!\n\r", ch );
         d->character->desc = NULL;
         do_quit( d->character, "" );
         return;
      }
      load_home(d->character);   // Add this line <-------
      d->character->desc = NULL;
      d->character->retran = old_room_vnum;
      d->character = NULL;
      DISPOSE( d->outbuf );
      DISPOSE( d );
      ch_printf( ch, "Player %s loaded from room %d.\n\r", capitalize( name ), old_room_vnum );
      sprintf( buf, "%s appears from nowhere, eyes glazed over.\n\r", capitalize( name ) );
      act( AT_IMMORT, buf, ch, NULL, NULL, TO_ROOM );
      send_to_char( "Done.\n\r", ch );
      return;
   }
       
Post is unread #2 Sep 6, 2008, 2:37 pm   Last edited Sep 6, 2008, 2:38 pm by Kayle
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

You're right, the SWR and SWFotE bases have seem to have fallen into a bit of disrepair...(that could be attributed to a lack of a true following except for sporadic few..) I'll have to page through the forums and find any missed fixes, give them a test, and see about getting these updated.

I'll also probably have to gather myself a greater understanding of the const char* fix from Smaug and apply it to these as well...
       
Post is unread #3 Sep 6, 2008, 7:57 pm
Go to the top of the page
Go to the bottom of the page

Banner
Magician
GroupMembers
Posts169
JoinedNov 29, 2005

I still faithfully report and bugs I find here in the hopes that they'll be posted, and.. well. If you need any help with any of them, I'm willing.
       
Post is unread #4 Dec 8, 2008, 11:17 pm
Go to the top of the page
Go to the bottom of the page

Banner
Magician
GroupMembers
Posts169
JoinedNov 29, 2005

Correction to the previous bugfix I forgot to mention. The above only dupes items and in the end causes more problems. In save.c, function save_home, at this at the very top:

     if( !ch->desc )
     {
         bug( "Refusing to save home.. %s is linkdead!", ch->name );
         return;
     }


This refuses to save the home if the player is linkdead, which solved all my problems. Be sure this is the only fix you apply. The load_home part was an error and needs to be removed if you added it.
       
Post is unread #5 Dec 9, 2008, 4:49 am
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

This sounds dangerous. If a player is loaded up like this, and then the player actually connects, will the link-dead character not be selected, causing the home to be overwritten with an empty home?
       
Post is unread #6 Dec 9, 2008, 3:20 pm
Go to the top of the page
Go to the bottom of the page

Banner
Magician
GroupMembers
Posts169
JoinedNov 29, 2005

If the player is loaded up and the character just happens to logon, they will login to the loaded up character.
       
Post is unread #7 Dec 10, 2008, 8:16 am
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

Right. And since the house hasn't been loaded, when they save, the house will be overwritten with an empty file. So the fixed-fix is not fully solving the problem, although it reduces the chances of a problem occurring to only those instances where a player connects while the character is loaded up.
       
Post is unread #8 Dec 17, 2008, 9:19 pm
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

Alright, Now that SWRFUSS has been updated, I've gotten the fixes for mppurge and do_order ready, so I need a proper solution to this one.

The original fix makes sense, loading the house when they're loaded up. But then it doesn't get saved if you don't force them to quit. So.. I dunno, can we get a cohesive fix in the works. Both of these proposed fixes have their flaws, I'd like to try and find one without flaws if possible.
       
Post is unread #9 Dec 18, 2008, 6:37 am
Go to the top of the page
Go to the bottom of the page

Keberus
Conjurer
GroupFUSS Project Team
Posts341
JoinedJun 4, 2005

Okay, I think I've found a solution. I tried this with FoteFuss v1.4, the room contents saved/loaded properly as normal, when you loaded someone up the contents were loaded, and if you force them to quit they were saved, also if you loaded someone up and then the logged in you don't get double room contents. So I think it covers all the necessary bases. Heres what I did...

in comm.c nanny function I removed:
         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(  );

            }
         }


I put this function in at the bottom of save.c
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(  );
    }
}


at the top of save.c I added the prototype for it:
void load_plr_home( CHAR_DATA * ch );


And then in save,c, the function load_char_obj right before this:
    return found;
}


I put in this:
    if( found )
    {
       if( ch->plr_home != NULL )
          load_plr_home( ch );
    }


I can't guarantee that it's failsafe, so if anyone has comments or whatever feel free to post. But like I said, I did test it with the above conditons, which would at least be the normal possibilites and it worked proplerly.

Later,
KeB
       
Pages:<< prev 1 next >>