Login
User Name:

Password:



Register

Forgot your password?
do_owhere recursive
Author: Khonsu
Submitted by: Khonsu
Changes list / Addchange
Author: Khonsu
Submitted by: Khonsu
6Dragons mp3 sound pack
Author: Vladaar
Submitted by: Vladaar
AFKMud 2.2.3
Author: AFKMud Team
Submitted by: Samson
SWFOTEFUSS 1.5
Author: Various
Submitted by: Samson
Users Online
AhrefsBot, Bing, Sogou

Members: 0
Guests: 31
Stats
Files
Topics
Posts
Members
Newest Member
489
3,791
19,644
596
Elwood

Today's Birthdays
There are no member birthdays today.
» 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,200
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 >>