Login
User Name:

Password:



Register
Forgot your password?
LOP 1.39r1
Author: Remcon
Submitted by: Remcon
Yaeger areas
Author: Yaeger
Submitted by: Cyberthrope
The City of Anon
Author: Yaeger
Submitted by: Cyberthrope
The Walls of Anon - Smaug
Author: Yaeger
Submitted by: Cyberthrope
LOP 1.39
Author: Remcon
Submitted by: Remcon
CommonCrawl, Yandex, Yahoo!, Google, Daygon

Members: 1
Guests: 1
Stats
Files
Topics
Posts
Members
Newest Member
375
3,323
16,510
561
Aurin
Affiliates
Smaug Building Institute Arthmoor
» SmaugMuds.org » 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, 12:45 pm   Last edited Jul 11, 2010, 12:46 pm by Banner
Go to the bottom of the page Go to the top of the page


Banner
Magician
GroupMembers
Posts164
JoinedNov 29, 2005
WWW AIM Yahoo MSN Skype

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;
  }     
.........................
Lead Developer,
Star Wars: Galactic Insights
http://www.swgi.org


sudo apt-get sandwich
       
Post is unread #2 Jul 11, 2010, 2:40 pm
Go to the bottom of the page Go to the top of the page


Samson
Scaly but Handsome
GroupAdministrators
Posts3,433
JoinedJan 1, 2002
WWW

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. .........................
PDNS-Admin | Sandbox | Arthmoor MUD Hosting Services | The Truth About Medievia: A Saga of Code Theft.

"The past was erased, the erasure was forgotten, the lie became truth." -- George Orwell, 1984
       
Post is unread #3 Jul 11, 2010, 3:52 pm   Last edited Jul 11, 2010, 3:58 pm by Banner
Go to the bottom of the page Go to the top of the page


Banner
Magician
GroupMembers
Posts164
JoinedNov 29, 2005
WWW AIM Yahoo MSN Skype

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. .........................
Lead Developer,
Star Wars: Galactic Insights
http://www.swgi.org


sudo apt-get sandwich
       
Post is unread #4 Jul 12, 2010, 2:03 pm   Last edited Jul 12, 2010, 2:03 pm by ayuri
Go to the bottom of the page Go to the top of the page
ayuri
Magician
GroupMembers
Posts148
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
.........................
"There is a lesson here for ambitious system architects: the most dangerous enemy of a better solution is an existing codebase that is just good enough."
-- Eric S. Raymond: The Art of Unix Programming
       
Post is unread #5 Jul 12, 2010, 2:11 pm   Last edited Jul 12, 2010, 2:13 pm by Banner
Go to the bottom of the page Go to the top of the page


Banner
Magician
GroupMembers
Posts164
JoinedNov 29, 2005
WWW AIM Yahoo MSN Skype

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. .........................
Lead Developer,
Star Wars: Galactic Insights
http://www.swgi.org


sudo apt-get sandwich
       
Post is unread #6 Jul 12, 2010, 4:55 pm   Last edited Jul 12, 2010, 4:58 pm by ayuri
Go to the bottom of the page Go to the top of the page
ayuri
Magician
GroupMembers
Posts148
JoinedJun 13, 2008

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

ayuri .........................
"There is a lesson here for ambitious system architects: the most dangerous enemy of a better solution is an existing codebase that is just good enough."
-- Eric S. Raymond: The Art of Unix Programming
       
Post is unread #7 Jul 12, 2010, 5:23 pm
Go to the bottom of the page Go to the top of the page


Kayle
Nibelungen
GroupAdministrators
Posts1,040
JoinedMar 21, 2006
WWW

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. .........................
Owner/Coder -- Malevolent Whispers -- Development Phase - Not accepting players
Coder -- Star Wars: The Sith Wars -- Open Alpha - Players Welcome - Full System Re-writes Imminent.

I3 Contact: Kayle@SithWars
       
Post is unread #8 Jul 12, 2010, 6:53 pm
Go to the bottom of the page Go to the top of the page


Conner
Sorcerer
GroupMembers
Posts833
JoinedMay 8, 2005
WWW ICQ AIM Yahoo MSN GT

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: .........................
-=Conner=-

Administrator/Coder Primary SysOp
Land of Legends The Castle's Dungeon BBS

telnet://tcdbbs.zapto.org:4000 telnet://tcdbbs.zapto.org:23
       
Post is unread #9 Jul 12, 2010, 6:54 pm
Go to the bottom of the page Go to the top of the page


Samson
Scaly but Handsome
GroupAdministrators
Posts3,433
JoinedJan 1, 2002
WWW

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. .........................
PDNS-Admin | Sandbox | Arthmoor MUD Hosting Services | The Truth About Medievia: A Saga of Code Theft.

"The past was erased, the erasure was forgotten, the lie became truth." -- George Orwell, 1984
       
Post is unread #10 Jul 13, 2010, 6:50 pm
Go to the bottom of the page Go to the top of the page


Conner
Sorcerer
GroupMembers
Posts833
JoinedMay 8, 2005
WWW ICQ AIM Yahoo MSN GT

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: .........................
-=Conner=-

Administrator/Coder Primary SysOp
Land of Legends The Castle's Dungeon BBS

telnet://tcdbbs.zapto.org:4000 telnet://tcdbbs.zapto.org:23
       
Post is unread #11 Jul 14, 2010, 7:01 am
Go to the bottom of the page Go to the top of the page


David Haley
Sorcerer
GroupMembers
Posts902
JoinedJan 29, 2007
WWW

You know the game 'Simon Says'? How about we play 'Samson Says' instead. :biggrin: .........................
David Haley
Head Coder, Legends of the Darkstone
BabbleMUD Project
http://david.the-haleys.org
       
Post is unread #12 Jul 18, 2010, 6:57 pm
Go to the bottom of the page Go to the top of the page


Kayle
Nibelungen
GroupAdministrators
Posts1,040
JoinedMar 21, 2006
WWW

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. .........................
Owner/Coder -- Malevolent Whispers -- Development Phase - Not accepting players
Coder -- Star Wars: The Sith Wars -- Open Alpha - Players Welcome - Full System Re-writes Imminent.

I3 Contact: Kayle@SithWars
       
Post is unread #13 Jul 19, 2010, 6:24 pm   Last edited Jul 19, 2010, 7:03 pm by Kayle
Go to the bottom of the page Go to the top of the page


Kayle
Nibelungen
GroupAdministrators
Posts1,040
JoinedMar 21, 2006
WWW

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...) .........................
Owner/Coder -- Malevolent Whispers -- Development Phase - Not accepting players
Coder -- Star Wars: The Sith Wars -- Open Alpha - Players Welcome - Full System Re-writes Imminent.

I3 Contact: Kayle@SithWars
       
Post is unread #14 Jul 20, 2010, 1:51 pm
Go to the bottom of the page Go to the top of the page


David Haley
Sorcerer
GroupMembers
Posts902
JoinedJan 29, 2007
WWW

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

Tell me about it :wink: .........................
David Haley
Head Coder, Legends of the Darkstone
BabbleMUD Project
http://david.the-haleys.org
       
Post is unread #15 Jul 20, 2010, 7:08 pm
Go to the bottom of the page Go to the top of the page


Kayle
Nibelungen
GroupAdministrators
Posts1,040
JoinedMar 21, 2006
WWW

DavidHaley said:


Tell me about it :wink:


You can at least get on MUDs from work. :P .........................
Owner/Coder -- Malevolent Whispers -- Development Phase - Not accepting players
Coder -- Star Wars: The Sith Wars -- Open Alpha - Players Welcome - Full System Re-writes Imminent.

I3 Contact: Kayle@SithWars
       
Post is unread #16 Jul 22, 2010, 10:11 pm
Go to the bottom of the page Go to the top of the page
Keirath
Magician
GroupMembers
Posts125
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, 6:45 am
Go to the bottom of the page Go to the top of the page


Kayle
Nibelungen
GroupAdministrators
Posts1,040
JoinedMar 21, 2006
WWW

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? .........................
Owner/Coder -- Malevolent Whispers -- Development Phase - Not accepting players
Coder -- Star Wars: The Sith Wars -- Open Alpha - Players Welcome - Full System Re-writes Imminent.

I3 Contact: Kayle@SithWars
       
Post is unread #18 Aug 1, 2010, 6:51 am
Go to the bottom of the page Go to the top of the page


Kayle
Nibelungen
GroupAdministrators
Posts1,040
JoinedMar 21, 2006
WWW

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. .........................
Owner/Coder -- Malevolent Whispers -- Development Phase - Not accepting players
Coder -- Star Wars: The Sith Wars -- Open Alpha - Players Welcome - Full System Re-writes Imminent.

I3 Contact: Kayle@SithWars
       
Post is unread #19 Aug 1, 2010, 4:34 pm
Go to the bottom of the page Go to the top of the page


Conner
Sorcerer
GroupMembers
Posts833
JoinedMay 8, 2005
WWW ICQ AIM Yahoo MSN GT

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. :( .........................
-=Conner=-

Administrator/Coder Primary SysOp
Land of Legends The Castle's Dungeon BBS

telnet://tcdbbs.zapto.org:4000 telnet://tcdbbs.zapto.org:23
       
Post is unread #20 Aug 1, 2010, 6:53 pm
Go to the bottom of the page Go to the top of the page


Sharmair
Fledgling
GroupMembers
Posts6
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 >>

 
Contact Us