Login
User Name:

Password:



Register

Forgot your password?
Hi - Clean SmaugFuss map/description issue..
Dec 15, 2024 7:29 pm
By Samson
AFKMud 2.2.4
Dec 10, 2024 4:09 pm
By Samson
I3 and IMC
Dec 8, 2024 6:35 pm
By Remcon
Ubuntu 22.04.5 LTS
Dec 5, 2024 5:10 pm
By Remcon
SmaugFUSS 1.8/1.9
Nov 29, 2024 11:46 am
By Remcon
SWFOTEFUSS 1.5.1
Author: Various
Submitted by: Samson
SWRFUSS 1.4.1
Author: Various
Submitted by: Samson
SmaugFUSS 1.9.5
Author: Various
Submitted by: Samson
AFKMud 2.2.4
Author: AFKMud Team
Submitted by: Samson
LOP 1.5
Author: Remcon
Submitted by: Remcon
Users Online
AhrefsBot, Bing

Members: 0
Guests: 46
Stats
Files
Topics
Posts
Members
Newest Member
494
3,808
19,707
588
Mortrex

Today's Birthdays
There are no member birthdays today.
» SmaugMuds » Codebases » SWR FUSS » move_char bug with positions
Forum Rules | Mark all | Recent Posts

move_char bug with positions
< Newer Topic :: Older Topic >

Pages:<< prev 1, 2 next >>
Post is unread #1 Jul 11, 2010 2:45 pm   Last edited Jul 11, 2010 2:46 pm by Banner
Go to the top of the page
Go to the bottom of the page

Banner
Magician
GroupMembers
Posts169
JoinedNov 29, 2005

 
It's possible to go through a flagged AUTO/HIDDEN exit while stunned, fighting, incapitated, resting, or sitting. This is possible as positions are checked in the direction commands, but not in the actual function move_char(). This bug exists in both smaugfuss and swrfuss.

act_move.cpp, move_char():
Somewhere with these ifchecks:
   }   

   if( IS_SET( pexit->exit_info, EX_NOMOB ) && IS_NPC( ch ) )
   {                
      act( AT_PLAIN, "Mobs can't enter there.", ch, NULL, NULL, TO_CHAR );      
      return rNONE;
   }

   if( IS_SET( to_room->room_flags, ROOM_NO_MOB ) && IS_NPC( ch ) )
   {                  
      act( AT_PLAIN, "Mobs can't enter there.", ch, NULL, NULL, TO_CHAR );
      return rNONE;
   } 




Add:
  if( ch->position ==  POS_INCAP || ch->position == POS_STUNNED )
  {
     send_to_char( "&RNo way, you're too stunned for that!\r\n", ch );
     return rNONE;
  }
  if( ch->position == POS_SLEEPING )
  {
      send_to_char( "In your dreams, or what?\r\n", ch );
      return rNONE;
  }
  if( ch->position == POS_SITTING || ch->position == POS_RESTING )
  {
     send_to_char( "You can't do that sitting down.\r\n", ch );
     return rNONE;
  }
  if( ch->position == POS_FIGHTING )
  {
     send_to_char( "&RNo wait, you're still fighting!\r\n", ch );
     return rNONE;
  }     

Post is unread #2 Jul 11, 2010 4:40 pm   
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,697
JoinedJan 1, 2002

 
Looks like a good catch. Almost makes me want to break the various things that can stop movement into a can_go() function and have move_char() call that, so that can_go() can be fixed/tweaked as needed without disturbing the rest. Also looks cleaner, but hardly necessary for fixing the actual problem.

Post is unread #3 Jul 11, 2010 5:52 pm   Last edited Jul 11, 2010 5:58 pm by Banner
Go to the top of the page
Go to the bottom of the page

Banner
Magician
GroupMembers
Posts169
JoinedNov 29, 2005

 
Yeah, it's kind of funny being able to go through those exits while in the middle of a fight or sleeping. Indeed, move_char() could do with a bit of cleanup and house cleaning. I don't particularly like those large stock functions that could be broken down, like nanny(), for instance.

Post is unread #4 Jul 12, 2010 4:03 pm   Last edited Jul 12, 2010 4:03 pm by ayuri
Go to the top of the page
Go to the bottom of the page

ayuri
Magician
GroupMembers
Posts239
JoinedJun 13, 2008

 
Stupid question but here it goes since I don't have access to any of the source at the moment, I can't look this up myself. Will this updated code with the POS_INCAP prevent someone from dragging someone if they are knocked out?

ayuri

Post is unread #5 Jul 12, 2010 4:11 pm   Last edited Jul 12, 2010 4:13 pm by Banner
Go to the top of the page
Go to the bottom of the page

Banner
Magician
GroupMembers
Posts169
JoinedNov 29, 2005

 
ayuri said:

Stupid question but here it goes since I don't have access to any of the source at the moment, I can't look this up myself. Will this updated code with the POS_INCAP prevent someone from dragging someone if they are knocked out?

ayuri

It shouldn't. The position is changed to POS_DRAG while they are moved and then switched back to stunned/incapacitated afterwards.

EDIT: This would affect fleeing, however, a position could be added and modified with flee the same way drag does it.

Post is unread #6 Jul 12, 2010 6:55 pm   Last edited Jul 12, 2010 6:58 pm by ayuri
Go to the top of the page
Go to the bottom of the page

ayuri
Magician
GroupMembers
Posts239
JoinedJun 13, 2008

 
Ahh, didn't think about fleeing. Good catch on that one.

ayuri

Post is unread #7 Jul 12, 2010 7:23 pm   
Go to the top of the page
Go to the bottom of the page

InfiniteAxis
Off the Edge of the Map
GroupAdministrators
Posts1,200
JoinedMar 21, 2006

 
Just started a new job, so I'm a little behind, I'll poke at this when I have time. Which should be this weekend. Hopefully.

Post is unread #8 Jul 12, 2010 8:53 pm   
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

 
Banner said:

EDIT: This would affect fleeing

You know, that was my first thought when I saw this thread initially too, but I didn't say anything because Samson had essentially endorsed the proposed fix so I thought I must've been mistaken. Guess it just goes to show that you really shouldn't go second guessing yourself. :lol:

Post is unread #9 Jul 12, 2010 8:54 pm   
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,697
JoinedJan 1, 2002

 
Or assume that just because I said it was a good fix meant I had taken everything into consideration. Fleeing wasn't even on my mind when I first looked at it.

Post is unread #10 Jul 13, 2010 8:50 pm   
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

 
I suppose there is that aspect to consider too. I think this was a case of my believing "better coders than I have already approved it so who am I to question it". :shrug:

Post is unread #11 Jul 14, 2010 9:01 am   
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

 
You know the game 'Simon Says'? How about we play 'Samson Says' instead. :biggrin:

Post is unread #12 Jul 18, 2010 8:57 pm   
Go to the top of the page
Go to the bottom of the page

InfiniteAxis
Off the Edge of the Map
GroupAdministrators
Posts1,200
JoinedMar 21, 2006

 
Due to my forgetting about the baby shower this weekend, I didn't have time to look into this yet. However, I should have time tomorrow after work to look into this.

Post is unread #13 Jul 19, 2010 8:24 pm   Last edited Jul 19, 2010 9:03 pm by Kayle
Go to the top of the page
Go to the bottom of the page

InfiniteAxis
Off the Edge of the Map
GroupAdministrators
Posts1,200
JoinedMar 21, 2006

 
Had a chance to look this over, and wouldn't adding a call to check_pos() in the interpreter section for auto exits fix this without disrupting flee?

Something like:
   /*
    * Look for command in skill and socials table.
    */
   if( !found )
   {
      if( !check_skill( ch, command, argument ) && !check_ability( ch, command, argument )   // Racial Abilities Support - Kayle 7-8-07
          && !rprog_command_trigger( ch, origarg )
          && !mprog_command_trigger( ch, origarg )
          && !oprog_command_trigger( ch, origarg )
          && !check_social( ch, command, argument ) && !news_cmd_hook( ch, command, argument )
#ifdef IMC
          && !imc_command_hook( ch, command, argument )
#endif
          )
      {
         EXIT_DATA *pexit;

         /*
          * check for an auto-matic exit command 
          */
         if( ( pexit = find_door( ch, command, TRUE ) ) != NULL && IS_SET( pexit->exit_info, EX_xAUTO ) && check_pos( ch, POS_STANDING )
         {
            if( IS_SET( pexit->exit_info, EX_CLOSED )
                && ( !IS_AFFECTED( ch, AFF_PASS_DOOR ) || IS_SET( pexit->exit_info, EX_NOPASSDOOR ) ) )
            {
               if( !IS_SET( pexit->exit_info, EX_SECRET ) )
                  act( AT_PLAIN, "The $d is closed.", ch, NULL, pexit->keyword, TO_CHAR );
               else
                  send_to_char( "You cannot do that here.\r\n", ch );
               return;
            }
            move_char( ch, pexit, 0 );
            return;
         }
         send_to_char( "Huh?\r\n", ch );
      }
      return;
   }


[Edit:] Someone try this for me while I'm working and let me know if it works. (working 40 hours a week really takes a lot out of your day...)

Post is unread #14 Jul 20, 2010 3:51 pm   
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

 
(working 40 hours a week really takes a lot out of your day...)

Tell me about it :wink:

Post is unread #15 Jul 20, 2010 9:08 pm   
Go to the top of the page
Go to the bottom of the page

InfiniteAxis
Off the Edge of the Map
GroupAdministrators
Posts1,200
JoinedMar 21, 2006

 
DavidHaley said:


Tell me about it :wink:


You can at least get on MUDs from work. :P

Post is unread #16 Jul 23, 2010 12:11 am   
Go to the top of the page
Go to the bottom of the page

Keirath
Magician
GroupMembers
Posts148
JoinedJan 24, 2008

 
Ha, be thankful for work. I lost my job so I've got nothing to do BUT MUD.

Post is unread #17 Jul 24, 2010 8:45 am   
Go to the top of the page
Go to the bottom of the page

InfiniteAxis
Off the Edge of the Map
GroupAdministrators
Posts1,200
JoinedMar 21, 2006

 
I'd like to go back to the days where I could just do nothing but MUD. But I do like the influx of cash. So.. Maybe I'll just deal with this whole working thing.

Anyway, has anyone tested my solution, or have an easy way for me to test the solution on my own?

Post is unread #18 Aug 1, 2010 8:51 am   
Go to the top of the page
Go to the bottom of the page

InfiniteAxis
Off the Edge of the Map
GroupAdministrators
Posts1,200
JoinedMar 21, 2006

 
I'd like to get this taken care of, but I don't have an easy way to test if this works if no one volunteers any information on a way to test it by my lonesome.

Post is unread #19 Aug 1, 2010 6:34 pm   
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

 
Sorry, Kayle, I'm pretty much in the same boat over here. If I put it in, I've still got to try to test it somehow by my lonesome too. My mud's not exactly been crowded to capacity since my move to the country that mandated switching to this damn laggy satellite feed. :(

Post is unread #20 Aug 1, 2010 8:53 pm   
Go to the top of the page
Go to the bottom of the page

Sharmair
Fledgling
GroupMembers
Posts7
JoinedApr 19, 2010

 
Looking at my code from just before I changed how positions work, I see that I fixed this by putting
some checks in the auto-exit handling section of the interpret() function in interp.cpp (probably .c in
most SMAUGs though):
            if((pexit = find_door(ch, command, TRUE)) != NULL && IS_SET(pexit->exit_info, EX_xAUTO)){
                if(IS_SET(pexit->exit_info, EX_CLOSED) && (!IS_AFFECTED(ch, AFF_PASS_DOOR) || IS_SET(pexit->exit_info, EX_NOPASSDOOR))){
                    if(!IS_SET(pexit->exit_info, EX_SECRET) && IS_AWAKE(ch))
                        act(AT_PLAIN, "The $d is closed.", ch, NULL, NULL, TO_CHAR, pexit->keyword);
                    else
                        send_to_char("Huh?\r\n", ch);//WAS "You cannot do that here." but did not want to give a hint to secret
                    return;
                }
                if(check_pos(ch, POS_STANDING))
                    move_char(ch, pexit, 0);
                return;
            }
            send_to_char("Huh?\r\n", ch);

I put the position check right before the actual move as that is what is actually affected
by the position. I also added a check to see if you are awake in the closed door section.
The idea there was if the character was awake, they could see the door was closed even
if in a position that they could not move to it (note that since this code, I have added extra
support for blindness and dark rooms in this visibility check). As a note if someone tries
to use this code: I had fully hardened the act() function for any format string and function
input. I moved the string based inputs to two defaulted arguments at the end of the input
list, so to use in a more stock system, the last argument should be moved to where the
2nd NULL is now.

It would seem if you put the position check in the if that is checking for the auto-exit, you
would get the bad position message from check_pos() and then get the huh? from the fall
through. This though is still much better then putting the checks in move_char(), which
is conceptually wrong.

Pages:<< prev 1, 2 next >>