Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
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, Yandex, Bing

Members: 0
Guests: 9
Stats
Files
Topics
Posts
Members
Newest Member
481
3,734
19,366
618
Micheal64X
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » AFKMud Bugfix List » AFKMud Bug Archive » [Bug] Extracting mounted NPCs...
Forum Rules | Mark all | Recent Posts

[Bug] Extracting mounted NPCs resets the wrong bit flag
< Newer Topic :: Older Topic > AFKMud 1.77

Pages:<< prev 1 next >>
Post is unread #1 Jul 29, 2006, 10:45 am
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,643
JoinedJan 1, 2002

Bug: Extracting mounted NPCs resets the wrong bit flag
Danger: Medium - Unpredictable effects depending on which flag is incorrectly reset
Discovered in: AFKMud 1.77
Found by: Kiasyn
Fixed by: Kiasyn

---

handler.c, extract_char

Locate:
   /*
    * check if this NPC was a mount or a pet
    */
   if( IS_NPC( ch ) && !mud_down )
   {
      for( wch = first_char; wch; wch = wch->next )
      {
         if( wch->mount == ch )
         {
            wch->mount = NULL;
            wch->position = POS_SITTING;
            if( wch->in_room == ch->in_room )
            {
               act( AT_SOCIAL, "Your faithful mount, $N collapses beneath you...", wch, NULL, ch, TO_CHAR );
               act( AT_SOCIAL, "You hit the ground with a thud.", wch, NULL, NULL, TO_CHAR );
               act( AT_PLAIN, "$n falls from $N as $N is slain.", wch, NULL, ch, TO_ROOM );
               check_mount_objs( ch, TRUE ); /* Check to see if they have ITEM_MUSTMOUNT stuff */
            }
         }
         if( !IS_NPC( wch ) && wch->first_pet )
         {
            if( ch->master == wch )
            {
               unbind_follower( ch, wch );
               if( wch->in_room == ch->in_room )
                  act( AT_SOCIAL, "You mourn for the loss of $N.", wch, NULL, ch, TO_CHAR );
            }
         }
      }
   }
   REMOVE_ACT_FLAG( ch, ACT_MOUNTED );


Change to:
   /*
    * check if this NPC was a mount or a pet
    */
   if( IS_NPC( ch ) && !mud_down )
   {
      REMOVE_ACT_FLAG( ch, ACT_MOUNTED );
      for( wch = first_char; wch; wch = wch->next )
      {
         if( wch->mount == ch )
         {
            wch->mount = NULL;
            wch->position = POS_SITTING;
            if( wch->in_room == ch->in_room )
            {
               act( AT_SOCIAL, "Your faithful mount, $N collapses beneath you...", wch, NULL, ch, TO_CHAR );
               act( AT_SOCIAL, "You hit the ground with a thud.", wch, NULL, NULL, TO_CHAR );
               act( AT_PLAIN, "$n falls from $N as $N is slain.", wch, NULL, ch, TO_ROOM );
               check_mount_objs( ch, TRUE ); /* Check to see if they have ITEM_MUSTMOUNT stuff */
            }
         }

         if( !IS_NPC( wch ) && wch->first_pet )
         {
            if( ch->master == wch )
            {
               unbind_follower( ch, wch );
               if( wch->in_room == ch->in_room )
                  act( AT_SOCIAL, "You mourn for the loss of $N.", wch, NULL, ch, TO_CHAR );
            }
         }
      }
   }


This bug is very sutble and would probably have been undetected for a long time had it not been for Kiasyn's eagle eye here. The check for removing the ACT_MOUNTED flag appears perfectly valid and will not trigger any bug messages. But it does not verify that it's being done on an NPC. Players and NPCs in Smaug share the ch->act bit and so on players this bit reset could have any number of undesired affects depending on what changes have been made in the code. For stock AFKMud code, this would have removed the PLR_LOG bit which under the vast majority of cases would never have been noticed.
       
Pages:<< prev 1 next >>