Login
User Name:

Password:



Register

Forgot your password?
void nanny_get_new_race -- comm.c
Mar 13, 2025 7:08 am
By Elwood
IPv6
Jan 25, 2025 10:45 pm
By Samson
mudstrlcpy and mudstrlcat
Jan 18, 2025 5:23 pm
By Samson
I3 and IMC
Jan 17, 2025 9:35 pm
By Samson
AFKMud 2.5.1
Jan 17, 2025 2:22 pm
By Samson
SWFotEFUSS 1.5.3
Author: Various
Submitted by: Samson
SWRFUSS 1.4.3
Author: Various
Submitted by: Samson
SmaugFUSS 1.9.8
Author: Various
Submitted by: Samson
AFKMud 2.5.2
Author: AFKMud Team
Submitted by: Samson
SmaugFUSS 1.9.7
Author: Various
Submitted by: Samson
Users Online
Anthropic, Amazonbot, AhrefsBot, Bing, DotBot, Bytespider

Members: 0
Guests: 11
Stats
Files
Topics
Posts
Members
Newest Member
507
3,812
19,722
592
ShariFrazi

» SmaugMuds » Codebases » AFKMud Support & Development » AFKMUD 2.14 oset issue
Forum Rules | Mark all | Recent Posts

AFKMUD 2.14 oset issue
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Mar 19, 2012 3:54 pm   Last edited Mar 20, 2012 8:01 pm by Samson
Go to the top of the page
Go to the bottom of the page

Sherm
Fledgling
GroupMembers
Posts33
JoinedDec 20, 2010

 
I recent was trying to add new affect and i noticed a bug in the code.
  if( !str_cmp( arg2, "affect" ) )
   {
      affect_data *paf;
      bitset < MAX_RIS_FLAG > risabit;
      short loc;
      bool found = false;

      risabit.reset(  );

       //argument = one_argument( argument, arg2 );
      argument = one_argument( argument, arg3 );
      arg4 = argument;
      //if( arg2.empty(  ) || argument.empty(  ) )
      if( arg3.empty(  ) || argument.empty(  ) )
      {
         ch->print( "Usage: oset <object> affect <field> <value>\r\n" );
         return;
      }
      //loc = get_atype( arg2 );
      loc = get_atype( arg3 );
      if( loc < 1 )
      {
         //ch->printf( "Unknown field: %s\r\n", arg2.c_str(  ) );
          ch->printf( "Unknown field: %s\r\n", arg3.c_str(  ) );
         return;
      }
      if( loc == APPLY_AFFECT )
      {
         argument = one_argument( argument, arg3 );
         if( loc == APPLY_AFFECT )
         {
            value = get_aflag( arg3 );

            if( value < 0 || value >= MAX_AFFECTED_BY )
               ch->printf( "Unknown affect: %s\r\n", arg3.c_str(  ) );
            else
               found = true;
         }
      }
      else if( loc == APPLY_RESISTANT || loc == APPLY_IMMUNE || loc == APPLY_SUSCEPTIBLE || loc == APPLY_ABSORB )
      {
         string flag;
         //while( !arg3.empty(  ) )
         while( !arg4.empty(  ) )
         {
            //arg3 = one_argument( arg3, flag );
             arg4 = one_argument( arg4, flag );
            value = get_risflag( flag );

            if( value < 0 || value >= MAX_RIS_FLAG )
               ch->printf( "Unknown flag: %s\r\n", flag.c_str(  ) );
            else
            {
               risabit.set( value );
               found = true;
            }
         }
      }
      else if( loc == APPLY_WEAPONSPELL
               || loc == APPLY_WEARSPELL || loc == APPLY_REMOVESPELL || loc == APPLY_STRIPSN || loc == APPLY_RECURRINGSPELL || loc == APPLY_EAT_SPELL )
      {
       
	//ch->printf( "Value of Arg3  check: %s\r\n", value  );
	argument = one_argument ( argument, arg3);
	//ch->printf( "Value of Arg3  check: %s\r\n", value  );
	value = skill_lookup( arg3 );
	//ch->printf( "Value of Arg3 after lookup check: %d\r\n", value  );
	 if( !IS_VALID_SN( value ) )
	 {
	   ch->printf( "Invalid spell: %s\r\n", arg3.c_str(  ) );
	   //ch->printf( "Invalid spell: %s\r\n", arg3.c_str(  ) );
	   //ch->printf( "Value of Value: %d\r\n", value  );
	 }
	  else
            found = true;
      }
      else
      {
         //value = atoi( arg3.c_str(  ) );
          value = atoi( arg4.c_str(  ) );
         found = true;
      }
      if( !found )
         return;

      paf = new affect_data;
      paf->type = -1;
      paf->duration = -1;
      paf->location = loc;
      paf->modifier = value;
      paf->rismod = risabit;
      paf->bit = 0;
      if( obj->extra_flags.test( ITEM_PROTOTYPE ) )
      {
         if( loc != APPLY_WEARSPELL && loc != APPLY_REMOVESPELL && loc != APPLY_STRIPSN && loc != APPLY_WEAPONSPELL )
         {
            list < char_data * >::iterator ich;
            list < obj_data * >::iterator iobj;

            for( ich = charlist.begin(  ); ich != charlist.end(  ); ++ich )
            {
               char_data *vch = *ich;

               for( iobj = vch->carrying.begin(  ); iobj != vch->carrying.end(  ); ++iobj )
               {
                  obj_data *eq = *iobj;

                  if( eq->pIndexData == obj->pIndexData && eq->wear_loc != WEAR_NONE )
                     vch->affect_modify( paf, true );
               }
            }
         }
         obj->pIndexData->affects.push_back( paf );
      }
      else
         obj->affects.push_back( paf );
      ++top_affect;
      ch->print( "Object affect added.\r\n" );
      return;
   }

Post is unread #2 Mar 19, 2012 8:38 pm   
Go to the top of the page
Go to the bottom of the page

Aurin
Magician
GroupMembers
Posts189
JoinedSep 5, 2010

 
You might want to point out what the bug is and why it's a bug. And whether or not you fixed the bug and/or looking for help.

Post is unread #3 Mar 20, 2012 7:01 am   
Go to the top of the page
Go to the bottom of the page

Sherm
Fledgling
GroupMembers
Posts33
JoinedDec 20, 2010

 
Sorry about that I did not think I posted this yet. I started last night then ended up working on another issue.

This bug never passes all the arguments through. They needed to be incremented by 1.

Pages:<< prev 1 next >>