Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Development
Nov 28, 2018, 10:10 am
By Keirath
First Immortal
Oct 12, 2018, 12:02 pm
By GatewaySysop
Bug in do_climb( )
Jun 5, 2018, 5:31 pm
By joeyfogas
question on overland code
May 31, 2018, 10:03 am
By joeyfogas
KaVir's Protocol Snip
May 15, 2018, 7:57 pm
By joeyfogas
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, Bing

Members: 0
Guests: 19
Stats
Files
Topics
Posts
Members
Newest Member
481
3,740
19,397
640
KieraZajac
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » 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 3, 2018, 11:11 pm
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, 6:01 am   Last edited Jun 5, 2018, 7: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, 8: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, 5: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 >>