Login
User Name:

Password:



Register

Forgot your password?
Dusting off the old code...
Jul 15, 2019 10:53 pm
By InfiniteAxis
Forum Search/User Post History
May 13, 2019 12:43 pm
By Keirath
AFKMud 2.2.2
Mar 3, 2019 5:35 pm
By Samson
Development
Nov 28, 2018 12:10 pm
By Keirath
First Immortal
Oct 12, 2018 2:02 pm
By GatewaySysop
SmaugFUSS 1.9.3
Author: Various
Submitted by: Samson
AFKMud 2.2.2
Author: AFKMud Team
Submitted by: Samson
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
Users Online
CommonCrawl

Members: 0
Guests: 0
Stats
Files
Topics
Posts
Members
Newest Member
482
3,748
19,405
575
zoinks

Today's Birthdays
Rane (43)
» 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
Posts396
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
Posts77
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
Posts396
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
Posts77
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 >>