| Message |
Hey all,
I spent a while last night going through the SML archives looking for a way to get closed exits to display on autoexits as [direction] as well as having them show up under the 'exits' comand output as "Direction - Closed". This is opposed to stock SMAUG where they are not shown in either case unless opened.
Below is what I came up with, 90% of which is drawn off something Xerves (I believe) posted on the SML as a response to someone elses query a long time back. I tweaked this using examples I found in a few places and I finally got it working right. I've tested this with exits that lead to dark rooms, hidden exits, etc. and it appears to work just fine.
I had the initial problem that closed doors leading to rooms flagged 'dark' would display as "Too dark to tell" rather than saying it was "Closed" in that direction. It is my thinking that you shouldn't be able to tell that it's too dark on the other side of a closed door, so I changed that. This way, no matter what's on the other side, if the door is closed it simply says "Closed - Direction".
Again, I take no credit here since this is really just a compilation of the work of others into a configuration that I found the most desirable.
In act_info.c , replace the stock do_exits with:
void do_exits( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
EXIT_DATA *pexit;
bool found;
bool fAuto;
set_char_color( AT_EXITS, ch );
buf[0] = '\0';
fAuto = !str_cmp( argument, "auto" );
if ( !check_blind(ch) )
return;
strcpy( buf, fAuto ? "Exits:" : "Obvious exits:\n\r" );
found = FALSE;
for ( pexit = ch->in_room->first_exit; pexit; pexit = pexit->next )
{
if ( pexit->to_room
&& (!IS_SET(pexit->exit_info, EX_WINDOW)
|| IS_SET(pexit->exit_info, EX_ISDOOR))
&& !IS_SET(pexit->exit_info, EX_HIDDEN) )
{
found = TRUE;
if ( fAuto )
{
strcat( buf, " " );
if (IS_SET(pexit->exit_info, EX_CLOSED))
strcat(buf, "[");
strcat( buf, dir_name[pexit->vdir] );
if (IS_SET(pexit->exit_info, EX_CLOSED))
strcat(buf, "]");
}
else
{
sprintf( buf + strlen(buf), "%-5s - %s\n\r",
capitalize( dir_name[pexit->vdir] ),
room_is_dark( pexit->to_room )
&& !IS_SET(pexit->exit_info, EX_CLOSED)
? "Too dark to tell"
: IS_SET(pexit->exit_info, EX_CLOSED)
? "Closed" : pexit->to_room->name);
}
}
}
if ( !found )
strcat( buf, fAuto ? " none.\n\r" : "None.\n\r" );
else
if ( fAuto )
strcat( buf, ".\n\r" );
send_to_char( buf, ch );
return;
}
|
"The world of men is dreaming, it has gone mad in its sleep, and a snake is strangling it, but it can't wake up." -D.H. Lawrence | top |
|