Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
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: 5
Stats
Files
Topics
Posts
Members
Newest Member
481
3,739
19,386
626
UnaMcGlinn
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » General » Smaug Snippets » The compass fix
Forum Rules | Mark all | Recent Posts

The compass fix
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Jan 20, 2007, 8:51 pm
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

Just wondering if what you posted as Kayle's fix will conflict with what Remcon helped me come up with as a solution to that same issue.

Here's my print_compass function:
void print_compass( CHAR_DATA * ch )
{
   EXIT_DATA *pexit, *pexit_next;
   int exit_info[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   static char *const exit_colors[] = { "&w", "&Y", "&C", "&b", "&w", "&R" };
   for( pexit = ch->in_room->first_exit; pexit; pexit = pexit_next )
   {
      pexit_next = pexit->next;
      if( !pexit->to_room || IS_SET( pexit->exit_info, EX_HIDDEN ) ||
          ( IS_SET( pexit->exit_info, EX_SECRET ) && IS_SET( pexit->exit_info, EX_CLOSED ) ) )
         continue;
      if( IS_SET( pexit->exit_info, EX_WINDOW ) )
         exit_info[pexit->vdir] = 2;
      else if( IS_SET( pexit->exit_info, EX_SECRET ) )
         exit_info[pexit->vdir] = 3;
      else if( IS_SET( pexit->exit_info, EX_CLOSED ) )
         exit_info[pexit->vdir] = 4;
      else if( IS_SET( pexit->exit_info, EX_LOCKED ) )
         exit_info[pexit->vdir] = 5;
      else
         exit_info[pexit->vdir] = 1;
   }
   set_char_color( AT_RMNAME, ch );
   ch_printf_color( ch, "\r\n%-50s\r\n                                                           %s%s    %s%s    %s%s\r\n",
                    ch->in_room->name,
                    exit_colors[exit_info[DIR_NORTHWEST]], exit_info[DIR_NORTHWEST] ? "NW" : "- ",
                    exit_colors[exit_info[DIR_NORTH]], exit_info[DIR_NORTH] ? "N" : "-",
                    exit_colors[exit_info[DIR_NORTHEAST]], exit_info[DIR_NORTHEAST] ? "NE" : " -" );
   if( IS_IMMORTAL( ch ) && xIS_SET( ch->act, PLR_ROOMVNUM ) )
      ch_printf_color( ch, "&w-<---- &YVnum: %6d &w----------------------------->-        ", ch->in_room->vnum );
   else
      send_to_char( "&w-<----------------------------------------------->-        ", ch );
   ch_printf_color( ch, "%s%s&w<-%s%s&w-&W(*)&w-%s%s&w->%s%s\r\n", exit_colors[exit_info[DIR_WEST]],
                    exit_info[DIR_WEST] ? "W" : "-", exit_colors[exit_info[DIR_UP]], exit_info[DIR_UP] ? "U" : "-",
                    exit_colors[exit_info[DIR_DOWN]], exit_info[DIR_DOWN] ? "D" : "-", exit_colors[exit_info[DIR_EAST]],
                    exit_info[DIR_EAST] ? "E" : "-" );
   ch_printf_color( ch, "                                                           %s%s    %s%s    %s%s\r\n\r\n",
                    exit_colors[exit_info[DIR_SOUTHWEST]], exit_info[DIR_SOUTHWEST] ? "SW" : "- ",
                    exit_colors[exit_info[DIR_SOUTH]], exit_info[DIR_SOUTH] ? "S" : "-",
                    exit_colors[exit_info[DIR_SOUTHEAST]], exit_info[DIR_SOUTHEAST] ? "SE" : " -" );
   return;
}
       
Post is unread #2 Jan 20, 2007, 8:54 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,643
JoinedJan 1, 2002

This is Kayle's complete compass fix:

Replace print_compass in act_info.c with this:
void print_compass( CHAR_DATA *ch )
{
   EXIT_DATA *pexit;
   int exit_info[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   static char * const exit_colors [] = { "&w", "&G", "&C", "&b", "&w", "&R" };
   for( pexit = ch->in_room->first_exit; pexit; pexit = pexit->next )
   {
      if( !pexit->to_room || IS_SET( pexit->exit_info, EX_HIDDEN ) ||
          ( IS_SET( pexit->exit_info, EX_SECRET ) && IS_SET( pexit->exit_info, EX_CLOSED ) ) )
         continue;
      if( IS_SET( pexit->exit_info, EX_WINDOW ) )
         exit_info[pexit->vdir] = 2;
      else if( IS_SET( pexit->exit_info, EX_SECRET ) )
         exit_info[pexit->vdir] = 3;
      else if( IS_SET( pexit->exit_info, EX_CLOSED ) )
         exit_info[pexit->vdir] = 4;
      else if( IS_SET( pexit->exit_info, EX_LOCKED ) )
         exit_info[pexit->vdir] = 5;
      else
         exit_info[pexit->vdir] = 1;
   }
   set_char_color( AT_RMNAME, ch );
   ch_printf_color( ch, "\r\n%-50s         %s%s    %s%s    %s%s\r\n",
      ch->in_room->name,
      exit_colors[exit_info[DIR_NORTHWEST]], exit_info[DIR_NORTHWEST] ? "NW" : "- ",
      exit_colors[exit_info[DIR_NORTH]], exit_info[DIR_NORTH] ? "N" : "-", exit_colors[exit_info[DIR_NORTHEAST]],
      exit_info[DIR_NORTHEAST] ? "NE" : " -" );
       send_to_char_color( "&w-<----------------------------------------------->-        ", ch );
   ch_printf_color( ch, "%s%s&w<-%s%s&w-&W(%s%s&W)&w-%s%s&w->%s%s\r\n", exit_colors[exit_info[DIR_WEST]], exit_info[DIR_WEST] ? "W" : "-",
      exit_colors[exit_info[DIR_UP]], exit_info[DIR_UP] ? "U" : "-", exit_colors[exit_info[DIR_SOMEWHERE]], exit_info[DIR_SOMEWHERE] ? "?" : "*", exit_colors[exit_info[DIR_DOWN]], exit_info[DIR_DOWN] ? "D" : "-",
      exit_colors[exit_info[DIR_EAST]], exit_info[DIR_EAST] ? "E" : "-" );
   ch_printf_color( ch, "                                                           %s%s    %s%s    %s%s\r\n\r\n",
      exit_colors[exit_info[DIR_SOUTHWEST]], exit_info[DIR_SOUTHWEST] ? "SW" : "- ", exit_colors[exit_info[DIR_SOUTH]],
      exit_info[DIR_SOUTH] ? "S" : "-", exit_colors[exit_info[DIR_SOUTHEAST]], exit_info[DIR_SOUTHEAST] ? "SE" : " -" );
   return;
}


I can't tell one way or the other if Remcon's fix does the same. But Remcon didn't fix the exit_info array so his is still technically open to crashing. I'm sure I don't need to mention I prefer simple, easy, short fixes over longer more involved fixes or full function replacements.
       
Post is unread #3 Jan 20, 2007, 8:58 pm
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

Well, ours doesn't crash on the rooms Kayle pointed out, nor other similar rooms, and I don't mind at all not having somewhere exits and portals showing up on the compass, so I was thinking of just adding that ,0 from your post rather than replacing the whole function, besides, Kayle's version doesn't include the immortal only extra info (room vnum) that mine does...
       
Post is unread #4 Jan 20, 2007, 9:13 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,643
JoinedJan 1, 2002

And that's exactly why I go for the minimalist approach. People change things. And asking them to throw it all away in the name of a simple bugfix is insane. So yes, you should be able to just toss on the extra 0 and avoid the possible problems.
       
Post is unread #5 Jan 20, 2007, 9:14 pm
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

Sounds great to me, thanks, Samson! :)
       
Pages:<< prev 1 next >>