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, Sogou, Bing, DotBot

Members: 0
Guests: 8
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 » AFKMud Bugfix List » [Bug] Bad room assignments ma...
Forum Rules | Mark all | Recent Posts

[Bug] Bad room assignments made in check_social
< Newer Topic :: Older Topic > AFKMud 2.0

Pages:<< prev 1 next >>
Post is unread #1 Jan 27, 2007, 1:22 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: Bad room assignments made in check_social
Danger: High - Will lead to potential crashes and improper character movements
Discovered in: AFKMud 2.0
Found by: Samson
Fixed by: Samson

---

commands.cpp, check_social

Replace that entire bug ridden mess with:
bool check_social( char_data * ch, char *command, char *argument )
{
   char arg[MIL];
   social_type *social;
   char_data *victim = NULL;

   if( !( social = find_social( command ) ) )
      return false;

   if( ch->has_pcflag( PCFLAG_NO_EMOTE ) )
   {
      ch->print( "You are not allowed to use socials.\r\n" );
      return true;
   }

   switch ( ch->position )
   {
      default:
         break;

      case POS_DEAD:
         ch->print( "Lie still; you are DEAD.\r\n" );
         return true;

      case POS_INCAP:
      case POS_MORTAL:
         ch->print( "You are hurt far too bad for that.\r\n" );
         return true;

      case POS_STUNNED:
         ch->print( "You are too stunned to do that.\r\n" );
         return true;

      case POS_SLEEPING:
         /*
          * I just know this is the path to a 12" 'if' statement.  :(
          * But two players asked for it already!  -- Furey
          */
         if( !str_cmp( social->name, "snore" ) )
            break;
         ch->print( "In your dreams, or what?\r\n" );
         return true;
   }

   one_argument( argument, arg );
   if( !arg || arg[0] == '\0' )
   {
      act( AT_SOCIAL, social->char_no_arg, ch, NULL, victim, TO_CHAR );
      act( AT_SOCIAL, social->others_no_arg, ch, NULL, victim, TO_VICT );
      return true;
   }

   if( !( victim = ch->get_char_room( arg ) ) )
   {
      obj_data *obj; /* Object socials */
      if( ( ( obj = get_obj_list( ch, arg, ch->in_room->objects ) )
            || ( obj = get_obj_list( ch, arg, ch->carrying ) ) ) && !victim )
      {
         if( social->obj_self && social->obj_others )
         {
            act( AT_SOCIAL, social->obj_self, ch, NULL, obj, TO_CHAR );
            act( AT_SOCIAL, social->obj_others, ch, NULL, obj, TO_ROOM );
         }
         return true;
      }

      if( !victim )
         ch->print( "They aren't here.\r\n" );

      return true;
   }

   if( victim == ch )
   {
      act( AT_SOCIAL, social->others_auto, ch, NULL, victim, TO_ROOM );
      act( AT_SOCIAL, social->char_auto, ch, NULL, victim, TO_CHAR );
      return true;
   }

   act( AT_SOCIAL, social->others_found, ch, NULL, victim, TO_NOTVICT );
   act( AT_SOCIAL, social->char_found, ch, NULL, victim, TO_CHAR );
   act( AT_SOCIAL, social->vict_found, ch, NULL, victim, TO_VICT );

   if( !ch->isnpc(  ) && victim->isnpc(  ) && !victim->has_aflag( AFF_CHARM )
       && victim->IS_AWAKE(  ) && !HAS_PROG( victim->pIndexData, ACT_PROG ) )
   {
      switch ( number_bits( 4 ) )
      {
         default:
         case 0:
            if( ch->IS_EVIL(  ) || ch->IS_NEUTRAL(  ) )
            {
               act( AT_ACTION, "$n slaps $N.", victim, NULL, ch, TO_NOTVICT );
               act( AT_ACTION, "You slap $N.", victim, NULL, ch, TO_CHAR );
               act( AT_ACTION, "$n slaps you.", victim, NULL, ch, TO_VICT );
            }
            else
            {
               act( AT_ACTION, "$n acts like $N doesn't even exist.", victim, NULL, ch, TO_NOTVICT );
               act( AT_ACTION, "You just ignore $N.", victim, NULL, ch, TO_CHAR );
               act( AT_ACTION, "$n appears to be ignoring you.", victim, NULL, ch, TO_VICT );
            }
            break;

         case 1:
         case 2:
         case 3:
         case 4:
         case 5:
         case 6:
         case 7:
         case 8:
            act( AT_SOCIAL, social->others_found, victim, NULL, ch, TO_NOTVICT );
            act( AT_SOCIAL, social->char_found, victim, NULL, ch, TO_CHAR );
            act( AT_SOCIAL, social->vict_found, victim, NULL, ch, TO_VICT );
            break;

         case 9:
         case 10:
         case 11:
         case 12:
            act( AT_ACTION, "$n slaps $N.", victim, NULL, ch, TO_NOTVICT );
            act( AT_ACTION, "You slap $N.", victim, NULL, ch, TO_CHAR );
            act( AT_ACTION, "$n slaps you.", victim, NULL, ch, TO_VICT );
            break;
      }
   }
   return true;
}


The check_social command came with some very questionable code for supporting the ignore functions the Smaugdevs created. These functions apparently required them to move people in and out of the room in order to make that work. However at some point during AFKMud's development, we altered the act() function to greatly enhance the ignore function to block anything sent through it from showing up to people you were ignoring. This had no affect on check_social for awhile, but at some point the movement in and out of rooms must have become a bit of a problem because NULL room messages began appearing with no apparent cause. And anytime you start seeing those, things can go horribly wrong fast.
       
Pages:<< prev 1 next >>