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, Sogou, Bing, Yandex

Members: 0
Guests: 1
Stats
Files
Topics
Posts
Members
Newest Member
481
3,733
19,363
618
Micheal64X
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » AFKMud Support & Development » mapper.cpp: Room descriptions...
Forum Rules | Mark all | Recent Posts

mapper.cpp: Room descriptions with automap break color usage
< Newer Topic :: Older Topic >

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

Samson
Black Hand
GroupAdministrators
Posts3,643
JoinedJan 1, 2002

With the automapper display enabled, color changes in the room description which should flow through to the next line of text before being closed off are in fact being terminated when each new line of text is displayed.

The problem code is in mapper.cpp, function show_map:
/* 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 );
         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 );
   }

   /* Finish off map area */
   mudstrlcat( buf, "&z+-----------+&D ", 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;
         mudstrlcat( buf, "\r\n", MSL*2 );
      }
      else
      {
         mudstrlcat( buf, ch->color_str( AT_RMDESC ), MSL*2 );
         mudstrlcat( buf, p, MSL*2 );
         alldesc = true;
      }
   }

   /* Deal with any leftover text */
   if( !alldesc )
   {
      do
      {
         /* Note the number - no map to detract from width */
         pos = get_line( p, 78 );
         if( pos > 0 )
         {
            mudstrlcat( buf, ch->color_str( AT_RMDESC ), MSL*2 );
            strncat( buf, p, pos );
            p += pos;
            mudstrlcat( buf, "\r\n", MSL*2 );
         }
         else
         {
            mudstrlcat( buf, ch->color_str( AT_RMDESC ), MSL*2 );
            mudstrlcat( buf, p, MSL*2 );
            alldesc = true;
         }
      }
      while( !alldesc );
   }
   mudstrlcat( buf, "&D\r\n", MSL*2 );
   ch->print( buf );
}


Fixing this is going to require some string parsing and remembering color state changes in the room description text, and I'm at a loss as to how to accomplish that. So if anyone wants to take a crack at this, it would be appreciated. Otherwise if it's left to me to fix, it won't get fixed.
       
Post is unread #2 Jan 3, 2007, 8:59 pm
Go to the top of the page
Go to the bottom of the page

Lazerous

GroupMembers
Posts79
JoinedAug 10, 2005

K well sadly this is past my talents....
       
Pages:<< prev 1 next >>