
Pages:<< prev 1 next >>

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:
to:
Color.h
Add:
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.
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 >>