Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
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
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
Bug in do_drag( )
Oct 8, 2017, 12:40 am
By GatewaySysop
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
Beastmaster 6D sound files
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, DotBot, Yahoo!

Members: 0
Guests: 8
Stats
Files
Topics
Posts
Members
Newest Member
476
3,704
19,231
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » AFKMud Bugfix List » [Bug] Room description color ...
Forum Rules | Mark all | Recent Posts

[Bug] Room description color does not carry over in mini-map display
< Newer Topic :: Older Topic > AFKMud 2.0

Pages:<< prev 1 next >>
Post is unread #1 Oct 14, 2007, 10:07 am
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Bug: Room description color does not carry over in mini-map display
Danger: Low - Annoyance
Discovered in: AFKMud 2.0
Found by: Lazerous
Fixed by: Samson/Davion

---

mapper.cpp, show_map

Locate and replace the show_map function with:
char *whatColor( char *str, char *pos )
{
   static char col[2];

   col[0] = '\0';
   while( str != pos )
   {
      if( *str == '&' || *str == '{' || *str == '}' )
      {
         col[0] = *str;

         ++str;
         if( !str )
         {
            col[1] = '\0';
            break;
         }
         col[1] = *str;
      }
      ++str;
   }
   return col;
}

/* Display the map to the player */
void show_map( char_data *ch, char *text )
{
   char buf[MSL * 2];
   int x, y, pos;
   char *p;
   bool alldesc = false; /* Has desc been fully displayed? */

   if( !text )
      alldesc = true;

   pos = 0;
   p = text;
   buf[0] = '\0';

   /* Show exits */
   if( ch->has_pcflag( PCFLAG_AUTOEXIT ) )
      snprintf( buf, MSL*2, "%s%s", ch->color_str( AT_EXITS ), get_exits(ch) );
   else
      mudstrlcpy( buf, "", MSL*2 );

   /* Top of map frame */
   mudstrlcat( buf, "&z+-----------+&w ", MSL*2 );
   if( !alldesc )
   {
      pos = get_line( p, 63 );
      if( pos > 0 )
      {
         mudstrlcat( buf, ch->color_str( AT_RMDESC ), MSL*2 );
         strncat( buf, p, pos );
         p += pos;
      }
      else
      {
         mudstrlcat( buf, ch->color_str( AT_RMDESC ), MSL*2 );
         mudstrlcat( buf, p, MSL*2 );
         alldesc = true;
      }
   }
   mudstrlcat( buf, "\r\n", MSL*2 );

   /* Write out the main map area with text */
   for( y = 0; y <= MAPY; ++y )
   {
      mudstrlcat( buf, "&z|&D", MSL*2 );

      for( x = 0; x <= MAPX; ++x )
      {
         int sect = dmap[x][y].sector;

         if( sect < 0 )
         {
            switch( dmap[x][y].tegn )
            {
               case '-':
               case '|':
               case '\\':
               case '/':
                  snprintf( buf + strlen(buf), (MSL*2)-strlen(buf), "&O%c&d", dmap[x][y].tegn );
                  break;

               case '@': // Character is standing here
                  snprintf( buf + strlen(buf), (MSL*2)-strlen(buf), "&R%c&d", dmap[x][y].tegn );
                  break;

               case 'O': // Indoors
                  snprintf( buf + strlen(buf), (MSL*2)-strlen(buf), "&w%c&d", dmap[x][y].tegn );
                  break;

               default: // Empty space
                  snprintf( buf + strlen(buf), (MSL*2)-strlen(buf), "%c", dmap[x][y].tegn );
                  break;
            }
         }
         else
         {
            snprintf( buf + strlen(buf), (MSL*2)-strlen(buf), "%s%s&d", sect_show[sect].color, sect_show[sect].symbol );
         }
      }
      mudstrlcat( buf, "&z|&D ", MSL*2 );

      /* Add the text, if necessary */
      if( !alldesc )
      {
         pos = get_line( p, 63 );
         char col[10], c[2];

         strcpy( c, whatColor( text, p ) );
         if( c[0] == '\0' )
            mudstrlcpy( col, ch->color_str( AT_RMDESC ), 10 );
         else
            snprintf( col, 10, "%s", c );

         if( pos > 0 )
         {
             mudstrlcat( buf, col, MSL*2 );
             strncat( buf, p, pos );
             p += pos;
         }
         else
         {
             mudstrlcat( buf, col, MSL*2 );
             mudstrlcat( buf, p, MSL*2 );
             alldesc = true;
         }
      } 
      mudstrlcat( buf, "\r\n", MSL*2 );
   }

   /* Finish off map area */
   mudstrlcat( buf, "&z+-----------+&D ", MSL*2 );
   if( !alldesc )
   {
      char col[10], c[2];
      pos = get_line( p, 63 );

      strcpy( c, whatColor( text, p ) );
      if( c[0] == '\0' )
         mudstrlcpy( col, ch->color_str( AT_RMDESC ), 10 );
      else
         snprintf( col, 10, "%s", c );

      if( pos > 0 )
      {
         mudstrlcat( buf, col, MSL*2 );
         strncat( buf, p, pos );
         p += pos;
         mudstrlcat( buf, "\r\n", MSL*2 );
      }
      else
      {
         mudstrlcat( buf, col, MSL*2 );
         mudstrlcat( buf, p, MSL*2 );
         alldesc = true;
      }
   }

   /* Deal with any leftover text */
   if( !alldesc )
   {
      char col[10], c[2];

      do
      {
         /* Note the number - no map to detract from width */
         pos = get_line( p, 78 );

         strcpy( c, whatColor( text, p ) );
         if( c[0] == '\0' )
            mudstrlcpy( col, ch->color_str( AT_RMDESC ), 10 );
         else
            snprintf( col, 10, "%s", c );

         if( pos > 0 )
         {
            mudstrlcat( buf, col, MSL*2 );
            strncat( buf, p, pos );
            p += pos;
            mudstrlcat( buf, "\r\n", MSL*2 );
         }
         else
         {
            mudstrlcat( buf, col, MSL*2 );
            mudstrlcat( buf, p, MSL*2 );
            alldesc = true;
         }
      }
      while( !alldesc );
   }
   mudstrlcat( buf, "&D\r\n", MSL*2 );
   ch->print( buf );
}


During the display construction for the mini-map, the room description is broken up and copied line by line back onto the display so it shows next to the map. When this happened, any color changes within the description did not carry over the way they should. So with Davion's help, there is now a support function to scan each line for color codes and add the appropriate one to the beginning of the line to allow them to carry through properly.
       
Pages:<< prev 1 next >>