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, Yandex, DotBot

Members: 0
Guests: 10
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 » 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, 3:04 pm   Last edited Aug 27, 2008, 4:51 pm by Kayle
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
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 >>