Login
User Name:

Password:



Register

Forgot your password?
void nanny_get_new_race -- comm.c
Mar 13, 2025 7:08 am
By Elwood
IPv6
Jan 25, 2025 10:45 pm
By Samson
mudstrlcpy and mudstrlcat
Jan 18, 2025 5:23 pm
By Samson
I3 and IMC
Jan 17, 2025 9:35 pm
By Samson
AFKMud 2.5.1
Jan 17, 2025 2:22 pm
By Samson
SWFotEFUSS 1.5.3
Author: Various
Submitted by: Samson
SWRFUSS 1.4.3
Author: Various
Submitted by: Samson
SmaugFUSS 1.9.8
Author: Various
Submitted by: Samson
AFKMud 2.5.2
Author: AFKMud Team
Submitted by: Samson
SmaugFUSS 1.9.7
Author: Various
Submitted by: Samson
Users Online
Anthropic, AhrefsBot, Sogou, Yandex, Bytespider

Members: 0
Guests: 8
Stats
Files
Topics
Posts
Members
Newest Member
507
3,812
19,722
591
TracySpencer

» SmaugMuds » Bugfix Lists » SmaugFUSS Bugfix List » [Bug] Automapper doesn't igno...
Forum Rules | Mark all | Recent Posts

[Bug] Automapper doesn't ignore colorcodes when wrapping descriptions
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Aug 27, 2008 5:04 pm   Last edited Aug 27, 2008 6:51 pm by Kayle
Go to the top of the page
Go to the bottom of the page

InfiniteAxis
Off the Edge of the Map
GroupAdministrators
Posts1,199
JoinedMar 21, 2006

 
Bug: Automapper doesn't ignore colorcodes when wrapping descriptions
Danger: Low - Room descriptions won't wrap around the map properly when colorcodes are used inside a description.
Found by: Kayle
Fixed by: Kayle

---

Mapper.c
Function: int get_line( char *desc, size_t max_len )
Change:
   /*
    * Calculate end point in string without color 
    */
   for( i = 0; i <= strlen( desc ); ++i )
   {
      /*
       * Here you need to skip your color sequences 
       */
      ++j;

      if( j > max_len )
         break;
   }


to:
    /*
    * Calculate end point in string without color 
    */
   for( i = 0; i <= strlen( desc ); ++i )
   {
      char dst[20];
      int vislen;

      switch ( desc[i] )
      {
         case '&':  /* NORMAL, Foreground colour */
         case '^':  /* BACKGROUND colour */
         case '}':  /* BLINK Foreground colour */
            *dst = '\0';
            vislen = 0;
            i += colorcode( &desc[i], dst, NULL, 20, &vislen ); /* Skip input token */
            j += vislen; /* Count output token length */
            break;   /* this was missing - if you have issues, remove it */

         default:   /* No conversion, just count */
            ++j;
            break;
      }
      
      if( j > max_len )
         break;
   }


Color.h
Add:
int colorcode( const char *src, char *dst, DESCRIPTOR_DATA * d, int dstlen, int *vislen );

with the other defines at the top of color.h.

Before if a room had color in the room description, such as to highlight a keyword or such, (or if someone had an excessive use of colorcodes in their room descriptions) the wrapped description would be choppy on the right side and wouldn't be as even as possible. Because the code wasn't skipping color codes properly and was counting things that wouldn't display normally.

[Edit:] Left off the Color.h part by mistake.

Pages:<< prev 1 next >>