Login
User Name:

Password:



Register

Forgot your password?
6Dragons mp3 sound pack
Author: Vladaar
Submitted by: Vladaar
AFKMud 2.2.3
Author: AFKMud Team
Submitted by: Samson
SWFOTEFUSS 1.5
Author: Various
Submitted by: Samson
SWRFUSS 1.4
Author: Various
Submitted by: Samson
SmaugFUSS 1.9.4
Author: Various
Submitted by: Samson
Users Online
DotBot, Bing, AhrefsBot

Members: 0
Guests: 12
Stats
Files
Topics
Posts
Members
Newest Member
487
3,788
19,630
595
Salan

Today's Birthdays
There are no member birthdays today.
» SmaugMuds » Codebases » SmaugFUSS » Bug in do_climb( )
Forum Rules | Mark all | Recent Posts

Bug in do_climb( )
< Newer Topic :: Older Topic > Forgot one of the climb flags...

Pages:<< prev 1 next >>
Post is unread #1 Jun 4, 2018 1:11 am   
Go to the top of the page
Go to the bottom of the page

GatewaySysop
Conjurer
GroupMembers
Posts413
JoinedMar 7, 2005

 
Another day, another long-standing but likely never noticed bug. I suspect this is a combination of confusion on the flag names and the fact that I have yet to see anyone actually use either EX_CLIMB or EX_xCLIMB.

Basically, only EX_xCLIMB was in place in the stock code. The result, embarrassingly, was that if climbing up was required to leave a room and you typed "climb up", say, you would get a message indicating that "you cannot climb there." :facepalm:

The observant may point that, yes, simply typing "up" will work and employ the climb skill (assuming you have it) but obviously it should still work to type "climb up" instead. To my understanding, EX_CLIMB means you must climb (or fly) in that exit direction, whereas EX_xCLIMB means you can use the climb command, but it is not necessary, nor is the climbing skill.

In any case, find this in act_move.c:

void do_climb( CHAR_DATA* ch, const char* argument)
{
   EXIT_DATA *pexit;

   if( argument[0] == '\0' )
   {
      for( pexit = ch->in_room->first_exit; pexit; pexit = pexit->next )
         if( IS_SET( pexit->exit_info, EX_xCLIMB ) )
         {
            move_char( ch, pexit, 0 );
            return;
         }
      send_to_char( "You cannot climb here.\r\n", ch );
      return;
   }

   if( ( pexit = find_door( ch, argument, TRUE ) ) != NULL && IS_SET( pexit->exit_info, EX_xCLIMB ) )
   {
      move_char( ch, pexit, 0 );
      return;
   }
   send_to_char( "You cannot climb there.\r\n", ch );
   return;
}


The fix is probably fairly obvious, just add the second climb flag into the mix:

void do_climb( CHAR_DATA* ch, const char* argument)
{
   EXIT_DATA *pexit;

   if( argument[0] == '\0' )
   {
      for( pexit = ch->in_room->first_exit; pexit; pexit = pexit->next )
         if( IS_SET( pexit->exit_info, EX_xCLIMB ) || IS_SET( pexit->exit_info, EX_CLIMB ) )
         {
            move_char( ch, pexit, 0 );
            return;
         }
      send_to_char( "You cannot climb here.\r\n", ch );
      return;
   }

   if ( (pexit = find_door( ch, argument, TRUE )) != NULL 
    && ( IS_SET( pexit->exit_info, EX_xCLIMB ) || IS_SET( pexit->exit_info, EX_CLIMB ) ) )
   {
      move_char( ch, pexit, 0 );
      return;
   }
   send_to_char( "You cannot climb there.\r\n", ch );
   return;
}


And that's that. :imp:

Post is unread #2 Jun 5, 2018 8:01 am   Last edited Jun 5, 2018 9:51 am by joeyfogas
Go to the top of the page
Go to the bottom of the page

joeyfogas
Apprentice
GroupMembers
Posts78
JoinedAug 28, 2016

 
Nice eye. I'd like to add if they are climbing, and there is a climb skill... they should learn something. so I fixed mine with adding this...

void do_climb( CHAR_DATA* ch, const char* argument)
{
   EXIT_DATA *pexit;

   if( argument[0] == '\0' )
   {
      for( pexit = ch->in_room->first_exit; pexit; pexit = pexit->next )
         if( IS_SET( pexit->exit_info, EX_xCLIMB ) || IS_SET( pexit->exit_info, EX_CLIMB ) )
         {
            send_to_char( "You begin to climb.\r\n", ch);
            learn_from_success( ch, gsn_climb );
            move_char( ch, pexit, 0 );
            return;
         }
      send_to_char( "You cannot climb here.\r\n", ch );
      return;
   }

   if( ( pexit = find_door( ch, argument, TRUE ) ) != NULL 
    && ( IS_SET( pexit->exit_info, EX_xCLIMB ) || IS_SET( pexit->exit_info, EX_CLIMB ) ) )
   {
            send_to_char( "You begin to climb.\r\n", ch);
            learn_from_success( ch, gsn_climb );
            move_char( ch, pexit, 0 );
            return;
   }
   send_to_char( "You cannot climb there.\r\n", ch );
   return;
}

Post is unread #3 Jun 5, 2018 10:56 am   
Go to the top of the page
Go to the bottom of the page

GatewaySysop
Conjurer
GroupMembers
Posts413
JoinedMar 7, 2005

 
Believe that's already accounted for in move_char( ), and they shouldn't be learning climbing skill just because they climbed where it was not strictly necessary (EX_xCLIMB), but to each his own. Just make sure you're not double whammying them and doing learn_from_success( ) twice due to move_char( ) picking up on it. I assumed that's why the Devs left it out of this function to begin with. :biggrin:

Post is unread #4 Jun 5, 2018 7:31 pm   
Go to the top of the page
Go to the bottom of the page

joeyfogas
Apprentice
GroupMembers
Posts78
JoinedAug 28, 2016

 
actually I forgot I had modified how gain_from works on my base over stock... so yeah... don't do what I did :)

Pages:<< prev 1 next >>