Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Development
Nov 28, 2018, 10:10 am
By Keirath
First Immortal
Oct 12, 2018, 12:02 pm
By GatewaySysop
Bug in do_climb( )
Jun 5, 2018, 5:31 pm
By joeyfogas
question on overland code
May 31, 2018, 10:03 am
By joeyfogas
KaVir's Protocol Snip
May 15, 2018, 7:57 pm
By joeyfogas
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, DotBot

Members: 0
Guests: 13
Stats
Files
Topics
Posts
Members
Newest Member
481
3,740
19,397
638
IgnacioBol
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » SmaugFUSS Bugfix List » [Bug] Pets wearing equipment ...
Forum Rules | Mark all | Recent Posts

[Bug] Pets wearing equipment cause player equipment to be stripped
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Dec 30, 2006, 7:38 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,644
JoinedJan 1, 2002

Bug: Pets wearing equipment cause player equipment to be stripped
Danger: Low - Incredibly annoying, but no data loss or other problems
Found by: Kayle, and oh so long ago, Tarl.
Fixed by: Kayle, and also oh so long ago, Tarl.

---

mud.h

Locate:
extern OBJ_DATA *save_equipment[MAX_WEAR][MAX_LAYERS];


Below that, add:
extern OBJ_DATA *mob_save_equipment[MAX_WEAR][MAX_LAYERS];


handler.c, obj_to_char

Locate:
   if( loading_char == ch )
   {
      int x, y;
      for( x = 0; x < MAX_WEAR; x++ )
         for( y = 0; y < MAX_LAYERS; y++ )
            if( save_equipment[x][y] == obj )
            {
               skipgroup = TRUE;
               break;
            }
   }


Change to:
   if( loading_char == ch )
   {
      int x, y;
      for( x = 0; x < MAX_WEAR; x++ )
      {
         for( y = 0; y < MAX_LAYERS; y++ )
         {
            if( IS_NPC( ch ) )
            {
               if( mob_save_equipment[x][y] == obj )
               {
                  skipgroup = TRUE;
                  break;
               }
            }
            else
            {
               if( save_equipment[x][y] == obj )
               {
                  skipgroup = TRUE;
                  break;
               }
            }
         }
      }
   }


handler.c, can_carry_n

Locate and remove:
   if( IS_NPC( ch ) && xIS_SET( ch->act, ACT_PET ) )
      return 0;


handler.c, can_carry_w

Locate and remove:
   if( IS_NPC( ch ) && xIS_SET( ch->act, ACT_PET ) )
      return 0;


save.c

Locate:
OBJ_DATA *save_equipment[MAX_WEAR][MAX_LAYERS];


Below that, add:
OBJ_DATA *mob_save_equipment[MAX_WEAR][MAX_LAYERS];


save.c, de_equip_char

Locate:
   for( x = 0; x < MAX_WEAR; x++ )
      for( y = 0; y < MAX_LAYERS; y++ )
         save_equipment[x][y] = NULL;


Change to:
   for( x = 0; x < MAX_WEAR; x++ )
   {
      for( y = 0; y < MAX_LAYERS; y++ )
      {
         if( IS_NPC( ch ) )
            mob_save_equipment[x][y] = NULL;
         else
            save_equipment[x][y] = NULL;
      }
   }


Locate:
            for( x = 0; x < MAX_LAYERS; x++ )
               if( !save_equipment[obj->wear_loc][x] )
               {
                  save_equipment[obj->wear_loc][x] = obj;
                  break;
               }


Change to:
            for( x = 0; x < MAX_LAYERS; x++ )
            {
               if( IS_NPC( ch ) )
               {
                  if( !mob_save_equipment[obj->wear_loc][x] )
                  {
                     mob_save_equipment[obj->wear_loc][x] = obj;
                     break;
                  }
               }
               else
               {
                  if( !save_equipment[obj->wear_loc][x] )
                  {
                     save_equipment[obj->wear_loc][x] = obj;
                     break;
                  }
               }
            }


save.c, re_equip_char

Replace the function with:
void re_equip_char( CHAR_DATA * ch )
{
   int x, y;

   for( x = 0; x < MAX_WEAR; x++ )
   {
      for( y = 0; y < MAX_LAYERS; y++ )
      {
         if( IS_NPC( ch ) )
         {
            if( mob_save_equipment[x][y] != NULL )
            {
               if( quitting_char != ch )
                  equip_char( ch, mob_save_equipment[x][y], x );
               mob_save_equipment[x][y] = NULL;
            }
            else
               break;
         }
         else
         {
            if( save_equipment[x][y] != NULL )
            {
               if( quitting_char != ch )
                  equip_char( ch, save_equipment[x][y], x );
               save_equipment[x][y] = NULL;
            }
            else
               break;
         }
      }
   }
}


save.c, fwrite_obj

Locate:
   for( wear = 0; wear < MAX_WEAR; wear++ )
      for( x = 0; x < MAX_LAYERS; x++ )
         if( obj == save_equipment[wear][x] )
         {
            wear_loc = wear;
            break;
         }
         else if( !save_equipment[wear][x] )
            break;


Change to:
   for( wear = 0; wear < MAX_WEAR; wear++ )
   {
      for( x = 0; x < MAX_LAYERS; x++ )
      {
         if( ch )
         {
            if( IS_NPC( ch ) )
            {
               if( obj == mob_save_equipment[wear][x] )
               {
                  wear_loc = wear;
                  break;
               }
               else if( !mob_save_equipment[wear][x] )
                  break;
            }
            else
            {
               if( obj == save_equipment[wear][x] )
               {
                  wear_loc = wear;
                  break;
               }
               else if( !save_equipment[wear][x] )
                  break;
            }
         }
      }
   }


save.c, fread_obj

Locate:
                        for( x = 0; x < MAX_LAYERS; x++ )
                           if( !save_equipment[wear_loc][x] )
                           {
                              save_equipment[wear_loc][x] = obj;
                              slot = x;
                              reslot = TRUE;
                              break;
                           }


Change to:
                        for( x = 0; x < MAX_LAYERS; x++ )
                        {
                           if( IS_NPC( ch ) )
                           {
                              if( !mob_save_equipment[wear_loc][x] )
                              {
                                 mob_save_equipment[wear_loc][x] = obj;
                                 slot = x;
                                 reslot = TRUE;
                                 break;
                              }
                           }
                           else
                           {
                              if( !save_equipment[wear_loc][x] )
                              {
                                 save_equipment[wear_loc][x] = obj;
                                 slot = x;
                                 reslot = TRUE;
                                 break;
                              }
                           }
                        }


Locate:
                     if( reslot && slot != -1 )
                        save_equipment[wear_loc][slot] = obj;


Change to:
                     if( reslot && slot != -1 )
                     {
                        if( IS_NPC( ch ) )
                           mob_save_equipment[wear_loc][slot] = obj;
                        else
                           save_equipment[wear_loc][slot] = obj;
                     }


save.c, load_char_obj

Locate:
   for( x = 0; x < MAX_WEAR; x++ )
      for( i = 0; i < MAX_LAYERS; i++ )
         save_equipment[x][i] = NULL;


Change to:
   for( x = 0; x < MAX_WEAR; x++ )
      for( i = 0; i < MAX_LAYERS; i++ )
      {
         save_equipment[x][i] = NULL;
         mob_save_equipment[x][i] = NULL;
      }


save.c, fwrite_mobile

Locate:
   if( !IS_NPC( mob ) || !fp )
      return;


Below that, add:
   de_equip_char( mob );


Locate and remove:
/* Might need these later --Shaddai
  de_equip_char( mob );
  re_equip_char( mob );
  */


Locate:
   if( mob->first_carrying )
      fwrite_obj( mob, mob->last_carrying, fp, 0, OS_CARRY, FALSE );
   fprintf( fp, "EndMobile\n" );


Below that, add:
   re_equip_char( mob );


save.c, fread_mobile

Locate:
         case '#':
            if( !str_cmp( word, "#OBJECT" ) )
               fread_obj( mob, fp, OS_CARRY );
            break;


Change to:
         case '#':
            if( !str_cmp( word, "#OBJECT" ) )
            {
               fread_obj( mob, fp, OS_CARRY );
               fMatch = TRUE;
               break;
            }
            break;


Locate:
               char_to_room( mob, pRoomIndex );


Below that, add:
               re_equip_char( mob );


The above huge mess completes a feature the Smaugdevs had apparently intended to have working all along but never got around to. Pets being able to carry, use, and keep inventory that is given to them by their masters. But without all of the extra support code for it, the results would be hazardous at best. So care should be taken while applying this.
       
Pages:<< prev 1 next >>