Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Yandex, Bing, Sogou

Members: 0
Guests: 9
Stats
Files
Topics
Posts
Members
Newest Member
477
3,706
19,240
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SWR FUSS » do_exits doesn't check for da...
Forum Rules | Mark all | Recent Posts

do_exits doesn't check for dark rooms
< Newer Topic :: Older Topic > act_info.c

Pages:<< prev 1 next >>
Post is unread #1 Aug 9, 2006, 5:43 am
Go to the top of the page
Go to the bottom of the page

Banner
Magician
GroupMembers
Posts169
JoinedNov 29, 2005

While not a bug, just slightly exploitable. In a dark room, you can't use LOOK if your character cannot see. You are supplied with the message "It is pitch black..." Without this fix, you can use EXITS and be able to see which direction to go, bypassing the check in look. Just copy and paste the code right from do_look!
In do_exits, under 

   if( !check_blind( ch ) )
      return;

add:
        if( !IS_NPC( ch )
       && !IS_SET( ch->act, PLR_HOLYLIGHT ) 
       && !IS_AFFECTED( ch, AFF_TRUESIGHT ) 
       && room_is_dark( ch->in_room ) )
   {
      set_char_color( AT_DGREY, ch );
      send_to_char( "It is pitch black ... \n\r", ch );
      show_char_to_char( ch->in_room->first_person, ch );
      return;
   }
       
Post is unread #2 Aug 9, 2006, 11:30 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

Seems this also applys to SmaugFUSS.
I wouldn't put this in do_exits though.
      show_char_to_char( ch->in_room->first_person, ch );

Nice find though :)
       
Post is unread #3 Aug 9, 2006, 1:21 pm
Go to the top of the page
Go to the bottom of the page

Banner
Magician
GroupMembers
Posts169
JoinedNov 29, 2005

Heh, wow. Didn't notice that. Yeah, it'll be better off without that ;) And thanks.
       
Post is unread #4 Aug 9, 2006, 8:28 pm
Go to the top of the page
Go to the bottom of the page

GatewaySysop
Conjurer
GroupMembers
Posts367
JoinedMar 7, 2005

Minor thing, but aren't we using \r\n now instead of \n\r? I almost c&p'ed this without noticing, so I figured I'd mention it for anyone else that was doing the same. :cyclops:

       
Post is unread #5 Aug 9, 2006, 9:01 pm
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

Nice catch, Gateway.. I'd missed it when I threw this in. *L*
       
Post is unread #6 Aug 10, 2006, 9:21 am
Go to the top of the page
Go to the bottom of the page

mordecai

GroupMembers
Posts99
JoinedNov 17, 2005

If the adjacent room is light though....I think that should be visible.
       
Post is unread #7 Aug 10, 2006, 9:40 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

That's able to be a valid point to and might very well be why do_exits never checked if the room they are in was dark or not.
       
Post is unread #8 Aug 10, 2006, 9:54 am
Go to the top of the page
Go to the bottom of the page

mordecai

GroupMembers
Posts99
JoinedNov 17, 2005

Okay, I made my little patch for the behavior I think is appropriate. I'm going to put it through my usual testing and then I'll post it here.
       
Post is unread #9 Aug 10, 2006, 9:58 am   Last edited Aug 10, 2006, 10:38 am by mordecai
Go to the top of the page
Go to the bottom of the page

mordecai

GroupMembers
Posts99
JoinedNov 17, 2005

WHAT THIS DOES: do_exits() should show exits in a dark room only if those exits are not dark themselves. (light shining in from them is visible AND if your room is lighted, you can see dark exits from the light in your room)

Okay, here's my diff file. (I know, I'm lazy)

Index: trunk/src/act_info.c
===================================================================
--- trunk/src/act_info.c (revision 92)
+++ trunk/src/act_info.c (revision 120)
@@ -1803,4 +1803,5 @@
    bool found;
    bool fAuto;
+   bool roomIsDark=room_is_dark( ch->in_room ), exitIsDark;
 
    set_char_color( AT_EXITS, ch );
@@ -1818,6 +1819,7 @@
       if( pexit->to_room
           && !IS_SET( pexit->exit_info, EX_CLOSED )
-          && ( !IS_SET( pexit->exit_info, EX_WINDOW )
-               || IS_SET( pexit->exit_info, EX_ISDOOR ) ) && !IS_SET( pexit->exit_info, EX_HIDDEN ) )
+          && ( !IS_SET( pexit->exit_info, EX_WINDOW ) || IS_SET( pexit->exit_info, EX_ISDOOR ) )
+          && !IS_SET( pexit->exit_info, EX_HIDDEN )
+          && ( !( exitIsDark=room_is_dark( pexit->to_room ) ) || !roomIsDark || IS_PLR_FLAG(ch, PLR_HOLYLIGHT ) || IS_AFFECTED( ch, AFF_TRUESIGHT ) ) )
       {
          found = TRUE;
@@ -1831,5 +1833,5 @@
             snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH - strlen( buf ) ), "%-5s - %s\r\n",
                       capitalize( dir_name[pexit->vdir] ),
-                      room_is_dark( pexit->to_room ) ? "Too dark to tell" : pexit->to_room->name );
+                      exitIsDark ? "Too dark to tell" : pexit->to_room->name );
          }
       }


You might notice my use of local bools, as to not call room_is_dark more than necessary. :)
       
Post is unread #10 Aug 10, 2006, 10:21 am
Go to the top of the page
Go to the bottom of the page

kiasyn
Magician
GroupMembers
Posts121
JoinedJun 30, 2006

you dont check if they're a PC before checking for holylight
       
Post is unread #11 Aug 10, 2006, 10:25 am   Last edited Aug 10, 2006, 10:38 am by mordecai
Go to the top of the page
Go to the bottom of the page

mordecai

GroupMembers
Posts99
JoinedNov 17, 2005

kiasyn said:

you dont check if they're a PC before checking for holylight

Hehe, opsie :P
Fixed in the changelog; IS_PLR_FLAG() should take care of that :)
       
Post is unread #12 Aug 10, 2006, 10:45 am
Go to the top of the page
Go to the bottom of the page

mordecai

GroupMembers
Posts99
JoinedNov 17, 2005

Hrm, just realized that macro isn't standard.

Here it is, if you want to add it, or just replace it with the code directly:
#define IS_PLR_FLAG(var, bit)          ( !IS_NPC(var) && xIS_SET((var)->act, (bit)) )
       
Pages:<< prev 1 next >>