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

Members: 0
Guests: 11
Stats
Files
Topics
Posts
Members
Newest Member
481
3,735
19,370
618
Micheal64X
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » AFKMud Bugfix List » AFKMud Bug Archive » [Bug] Dual wielding while alr...
Forum Rules | Mark all | Recent Posts

[Bug] Dual wielding while already wielding a missile weapon causes crash
< Newer Topic :: Older Topic > AFKMud 1.63

Pages:<< prev 1 next >>
Post is unread #1 Oct 2, 2004, 5:04 pm   Last edited Nov 13, 2005, 12:12 pm by Samson
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,643
JoinedJan 1, 2002

Bug: Dual wielding while already wielding a missile weapon crashes the game.
Discovered in: AFKMud 1.63
Danger: High - Crash bug
Found by: Zeno
Fixed by: Gatewaysysop and Samson

act_obj.c, wear_obj

Locate:
	case ITEM_MISSILE_WIELD:
	case ITEM_WIELD:
     if ( !could_dual(ch) )
     {
  if ( !remove_obj( ch, WEAR_MISSILE_WIELD, fReplace ) )
      return;
  if ( !remove_obj(ch, WEAR_WIELD, fReplace) )
      return;
  tmpobj = NULL;
     }
     else
     {
  	OBJ_DATA *mw, *dw, *hd;
 
  	tmpobj = get_eq_char(ch, WEAR_WIELD);
  	mw = get_eq_char(ch, WEAR_MISSILE_WIELD);
  	dw = get_eq_char(ch, WEAR_DUAL_WIELD);

       if ( tmpobj || mw )
     {
  if ( can_dual(ch) )
  {
      if ( get_obj_weight(obj) + get_obj_weight(tmpobj) > str_app[get_curr_str(ch)].wield )
      {
  	send_to_char( "It is too heavy for you to wield.\n\r", ch );
  	return;
            }
  	if( ( tmpobj && IS_OBJ_FLAG( tmpobj, ITEM_TWOHAND ) ) 
      || ( mw && IS_OBJ_FLAG( mw, ITEM_TWOHAND ) ) )
  	{
      send_to_char( "You are already wielding a two-handed weapon.\n\r", ch );
      return;
  	}
                    if ( !oprog_use_trigger( ch, obj, NULL, NULL, NULL ) )
                    {
  	act( AT_ACTION, "$n dual-wields $p.", ch, obj, NULL, TO_ROOM );
  	act( AT_ACTION, "You dual-wield $p.", ch, obj, NULL, TO_CHAR );
                    }
      if ( 1 << bit == ITEM_MISSILE_WIELD )
  	equip_char( ch, obj, WEAR_MISSILE_WIELD );
      else
  	equip_char( ch, obj, WEAR_DUAL_WIELD );
      oprog_wear_trigger( ch, obj );
  }
         return;
     }

  	if ( tmpobj && (mw || dw) )
  {
     send_to_char( "You're already wielding two weapons.\n\r", ch );
     return;
  }
  	hd = get_eq_char(ch, WEAR_HOLD);
  	if ( (mw && hd) || (tmpobj && hd) )
  	{
       send_to_char( "You're already wielding a weapon AND holding something.\n\r", ch );
       return;
  	}
     }

     if ( get_obj_weight(obj) > str_app[get_curr_str(ch)].wield )
     {
  send_to_char( "It is too heavy for you to wield.\n\r", ch );
  return;
     }

            if ( !oprog_use_trigger( ch, obj, NULL, NULL, NULL ) )
            {
  act( AT_ACTION, "$n wields $p.", ch, obj, NULL, TO_ROOM );
  act( AT_ACTION, "You wield $p.", ch, obj, NULL, TO_CHAR );
            }
     if ( 1 << bit == ITEM_MISSILE_WIELD )
  equip_char( ch, obj, WEAR_MISSILE_WIELD );
     else
  equip_char( ch, obj, WEAR_WIELD );
     oprog_wear_trigger( ch, obj );
     return;
    }


Replace with:
       case ITEM_MISSILE_WIELD:
       case ITEM_WIELD:
         if( !could_dual(ch) )
         {
            if( !remove_obj( ch, WEAR_MISSILE_WIELD, fReplace ) )
               return;
            if( !remove_obj( ch, WEAR_WIELD, fReplace ) )
               return;
            tmpobj = NULL;
         }

         else
         {            
            OBJ_DATA *mw, *dw, *hd, *sd;
            tmpobj = get_eq_char( ch, WEAR_WIELD );
            mw = get_eq_char( ch, WEAR_MISSILE_WIELD );
            dw = get_eq_char( ch, WEAR_DUAL_WIELD );
            hd = get_eq_char( ch, WEAR_HOLD );
            sd = get_eq_char( ch, WEAR_SHIELD );

            if( tmpobj )
            {
               if( !can_dual( ch ) )
                  return;

               if( get_obj_weight(obj) + get_obj_weight(tmpobj) > str_app[get_curr_str(ch)].wield )
               {
                  send_to_char( "It is too heavy for you to wield.\n\r", ch );
                  return;
               }

               if( mw || dw )
               {
                  send_to_char( "You're already wielding two weapons.\n\r", ch );
                  return;
               }

               if( hd || sd )
               {
                  send_to_char( "You're already wielding a weapon AND holding something.\n\r", ch );
                  return;
               }

               if( !oprog_use_trigger( ch, obj, NULL, NULL, NULL ) )
               {
                  act( AT_ACTION, "$n dual-wields $p.", ch, obj, NULL, TO_ROOM );
                  act( AT_ACTION, "You dual-wield $p.", ch, obj, NULL, TO_CHAR );
               }
               if( 1 << bit == ITEM_MISSILE_WIELD )
                  equip_char( ch, obj, WEAR_MISSILE_WIELD );
               else
                  equip_char( ch, obj, WEAR_DUAL_WIELD );
               oprog_wear_trigger( ch, obj );
               return;
            }

            if( mw )
            {
               if( !can_dual( ch ) )
                  return;

               if( 1 << bit == ITEM_MISSILE_WIELD )
               {
                  send_to_char( "You're already wielding a missile weapon.\n\r", ch );
                  return;
               }

               if( get_obj_weight(obj) + get_obj_weight(mw) > str_app[get_curr_str(ch)].wield )
               {
                  send_to_char( "It is too heavy for you to wield.\n\r", ch );
                  return;
               }

               if( tmpobj || dw )
               {
                  send_to_char( "You're already wielding two weapons.\n\r", ch );
                  return;
               }

               if( hd || sd )
               {
                  send_to_char( "You're already wielding a weapon AND holding something.\n\r", ch );
                  return;
               }

               if( !oprog_use_trigger( ch, obj, NULL, NULL, NULL ) )
               {
                  act( AT_ACTION, "$n wields $p.", ch, obj, NULL, TO_ROOM );
                  act( AT_ACTION, "You wield $p.", ch, obj, NULL, TO_CHAR );
               }
               equip_char( ch, obj, WEAR_WIELD );
               oprog_wear_trigger( ch, obj );
               return;
            }
         }


This is an apparently long-standing bug which hasn't been picked up on before and appears to have been the result of what should have been a bugfix for Smaug to fix problems with dual-wielding not working properly. This fix should satisfy both intentions and make things work the way they should, without crashing the game :)
       
Pages:<< prev 1 next >>