Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
 parse description bug
Yesterday, 10:08 pm
By Remcon
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
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, Sogou

Members: 0
Guests: 7
Stats
Files
Topics
Posts
Members
Newest Member
477
3,706
19,240
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » SWFOTE FUSS Bugfix List » [Bug] Mob resets do not work ...
Forum Rules | Mark all | Recent Posts

[Bug] Mob resets do not work properly when limits are specified
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Jan 12, 2008, 2:31 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Bug: Mob resets do not work properly when limits are specified
Danger: Low - The only real affect is that a reset will trigger more of a mob that someone actally wants.
Found by: Many people over time
Fixed by: Remcon

---

db.c, create_mobile

Locate:
   mob->act = pMobIndex->act;
   mob->home_vnum = -1;


Below that, add:
   mob->resetvnum = -1;
   mob->resetnum = -1;


handler.c

Near the top with other prototypes, locate:
OBJ_DATA *group_object( OBJ_DATA * obj1, OBJ_DATA * obj2 );


Below that, add:
void update_room_reset( CHAR_DATA *ch, bool setting );


handler.c, extract_char

Locate:
   if( ch->mount )
   {
      REMOVE_BIT( ch->mount->act, ACT_MOUNTED );
      ch->mount = NULL;
      ch->position = POS_STANDING;
   }


Change to:
   if( ch->mount )
   {
      update_room_reset( ch, TRUE );
      REMOVE_BIT( ch->mount->act, ACT_MOUNTED );
      ch->mount = NULL;
      ch->position = POS_STANDING;
   }


hotboot.c

Near the top, locate:
bool write_to_descriptor_old( int desc, char *txt, int length );


Below that, add:
void update_room_reset( CHAR_DATA *ch, bool setting );


hotboot.c, save_mobile

Locate:
   fprintf( fp, "Level   %d\n", mob->top_level );
   fprintf( fp, "Gold	%d\n", mob->gold );


Below that, add:
   fprintf( fp, "Resetvnum %d\n", mob->resetvnum );
   fprintf( fp, "Resetnum  %d\n", mob->resetnum );


hotboot.c, load_mobile

Locate:
               char_to_room( mob, pRoomIndex );
               mob->tempnum = -9998;   /* Yet another hackish fix! */


Below that, add:
               update_room_reset( mob, FALSE );


Locate:
         case 'R':
            KEY( "Room", inroom, fread_number( fp ) );
            break;


Change to:
         case 'R':
            KEY( "Room", inroom, fread_number( fp ) );
            KEY( "Resetvnum", mob->resetvnum, fread_number( fp ) );
            KEY( "Resetnum", mob->resetnum, fread_number( fp ) );
            break;


mud.h, struct char_data

Locate:
   short colors[MAX_COLORS];
   int home_vnum; /* hotboot tracker */


Below that, add:
   int resetvnum;
   int resetnum;


mud.h, struct reset_data

Locate:
   int arg1;
   int arg2;
   int arg3;


Below that, add:
   bool sreset;


reset.c, reset_room

Locate:
   char *filename = room->area->filename;
   int level = 0, n, num = 0, lastnest;


Change to:
   char *filename = room->area->filename;
   int level = 0, n, num = 0, lastnest, onreset = 0;


Locate:
   level = 0;
   for( pReset = room->first_reset; pReset; pReset = pReset->next )
   {
      switch ( pReset->command )


Change to:
   level = 0;
   for( pReset = room->first_reset; pReset; pReset = pReset->next )
   {
      ++onreset;
      switch ( pReset->command )


Locate:
            if( pMobIndex->count >= pReset->arg2 )
            {
               mob = NULL;
               break;
            }


Change to:
            if( !pReset->sreset )
            {
               mob = NULL;
               break;
            }


Locate:
            if( room_is_dark( pRoomIndex ) )
               SET_BIT( mob->affected_by, AFF_INFRARED );


Below that, add:
            mob->resetvnum = pRoomIndex->vnum;
            mob->resetnum = onreset;
            pReset->sreset = FALSE;


Locate:
               for( tReset = pReset->first_reset; tReset; tReset = tReset->next_reset )
               {
                  switch ( tReset->command )
                  {


Change to:
               for( tReset = pReset->first_reset; tReset; tReset = tReset->next_reset )
               {
                  ++onreset;
                  switch ( tReset->command )
                  {


Locate:
                           for( gReset = tReset->first_reset; gReset; gReset = gReset->next_reset )
                           {
                              int iNest;
                              to_obj = lastobj;

                              switch ( gReset->command )
                              {


Change to:
                           for( gReset = tReset->first_reset; gReset; gReset = gReset->next_reset )
                           {
                              int iNest;
                              to_obj = lastobj;

                              ++onreset;
                              switch ( gReset->command )
                              {


Locate:
               for( tReset = pReset->first_reset; tReset; tReset = tReset->next_reset )
               {
                  int iNest;

                  to_obj = lastobj;

                  switch ( tReset->command )
                  {


Change to:
               for( tReset = pReset->first_reset; tReset; tReset = tReset->next_reset )
               {
                  int iNest;

                  to_obj = lastobj;
                  ++onreset;

                  switch ( tReset->command )
                  {


reset.c

At the bottom of reset.c, add the following new function:
/* Update the mobile resets to let it know to reset it again */
void update_room_reset( CHAR_DATA *ch, bool setting )
{
   ROOM_INDEX_DATA *room;
   RESET_DATA *pReset, *tReset, *pReset_next, *tReset_next, *gReset, *gReset_next;
   int nfind = 0;

   if( !ch )
      return;

   if( !( room = get_room_index( ch->resetvnum ) ) )
      return;

   for( pReset = room->first_reset; pReset; pReset = pReset_next )
   {
      pReset_next = pReset->next;

      if( ++nfind == ch->resetnum )
      {
         pReset->sreset = setting;
         return;
      }

      for( tReset = pReset->first_reset; tReset; tReset = tReset_next )
      {
         tReset_next = tReset->next_reset;

         if( ++nfind == ch->resetnum )
         {
            tReset->sreset = setting;
            return;
         }

         for( gReset = tReset->first_reset; gReset; gReset = gReset_next )
         {
            gReset_next = gReset->next_reset;

            if( ++nfind == ch->resetnum )
            {
               gReset->sreset = setting;
               return;
            }
         }
      }
   }
}


The basic problem here is that resets for mobs can specify a limit to how many of them should be loaded at any given time. This ( I think? ) worked just fine when resets were still based on the area as a whole. No more than X number of mobs would load. But when things were converted to room based resets, the counts went out the window. Each room could specify its own limit, which was meaningless in the big picture. Remcon's fix takes a different approach by tying each reset number to the mobs it creates and then keeping track of them to see if they should be reset again when the area reset is called.
       
Pages:<< prev 1 next >>