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

Members: 0
Guests: 6
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 » SmaugFUSS Bugfix List » [Bug] Dual wielding while alr...
Forum Rules | Mark all | Recent Posts

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

Pages:<< prev 1 next >>
Post is unread #1 Mar 5, 2005, 4:05 pm   Last edited May 11, 2005, 6:53 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.
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 || 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 ( tmpobj )
     {
  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 ( !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 ( 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;
            }
         }

         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;


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 :)

EDITED 11/14/04:

Apparently the fix here was incomplete. So after a few replies on the other thread, I went back and carefully checked this fix, and what is now posted above is in fact correct, and also now accounts for shields which had been skipped before. This should finally put this bug to rest :)
       
Pages:<< prev 1 next >>