/* * Page to one char, new colour version, by Lope. */ void page_to_char( const char *txt, CHAR_DATA *ch ) { const char *point; char *point2; char buf[ MAX_STRING_LENGTH * 4 ]; int skip = 0; #if defined(macintosh) send_to_char( txt, ch ); #else buf[0] = '\0'; point2 = buf; if( txt && ch->desc ) { if( IS_SET( ch->act, PLR_COLOUR ) ) { for( point = txt ; *point ; point++ ) { if( *point == '{' ) { point++; skip = colour( *point, ch, point2 ); while( skip-- > 0 ) ++point2; continue; } *point2 = *point; *++point2 = '\0'; } *point2 = '\0'; ch->desc->showstr_head = alloc_mem( strlen( buf ) + 1 ); strcpy( ch->desc->showstr_head, buf ); ch->desc->showstr_point = ch->desc->showstr_head; show_string( ch->desc, "" ); } else { for( point = txt ; *point ; point++ ) { if( *point == '{' ) { point++; continue; } *point2 = *point; *++point2 = '\0'; } *point2 = '\0'; ch->desc->showstr_head = alloc_mem( strlen_color( buf ) + 1 ); strcpy( ch->desc->showstr_head, buf ); ch->desc->showstr_point = ch->desc->showstr_head; show_string( ch->desc, "" ); } } #endif return; }
int MVD_ClockList_GetLongestName(void) { int i, current, longest = 0; int items[] = { IT_AXE, IT_SHOTGUN, IT_SUPER_SHOTGUN, IT_NAILGUN, IT_SUPER_NAILGUN, IT_GRENADE_LAUNCHER, IT_ROCKET_LAUNCHER, IT_LIGHTNING, IT_INVISIBILITY, IT_QUAD, IT_INVULNERABILITY, IT_ARMOR1, IT_ARMOR2, IT_ARMOR3, IT_SUPERHEALTH }; for (i = 0; i < (sizeof(items)/sizeof(*items)); i++){ current = strlen_color(TP_ItemName(items[i])); if (longest < current) longest = current; } return longest; }
char *align_news( char *argument ) { char buf[MAX_NEWS_LENGTH]; char arg[MAX_NEWS_LENGTH]; char *return_buf; int num = 0; int count = 0; int date_len = 10; int spacer = 2; int total = ( date_len + spacer ); strcpy( buf, "" ); if ( argument == NULL || argument[0] == '\0' ) return ( char * ) ""; for ( ;; ) { int i = 0; int length = 0; int longlen = 0; argument = news_argument( argument, arg ); // We use the length without the color spaces for wrapping length = strlen_color( arg ); if ( ( total + length ) >= 79 ) { int index; buf[num] = '\n'; num++; buf[num] = '\r'; num++; for ( index = 0; index < ( date_len + spacer ); index++ ) { buf[num] = ' '; num++; } total = ( date_len + spacer ); } // We use the length with the color spaces for substitution longlen = strlen( arg ); for ( i = 0; i < longlen; i++ ) { if ( arg[count] == '&' || arg[count] == '^' ) { if ( arg[count + 1] == '\0' ) { arg[count] = '\0'; } else if ( ( arg[count] == '&' && arg[count + 1] == '&' ) || ( arg[count] == '^' && arg[count + 1] == '^' ) ) { buf[num] = arg[count]; num++; count++; i++; buf[num] = arg[count]; num++; count++; total++; } else { count += 2; i++; } } else { buf[num] = arg[count]; total++; num++; count++; } } if ( argument != NULL && argument[0] != '\0' ) { buf[num] = ' '; num++; total++; count = 0; } else { buf[num] = '\0'; break; } } return_buf = STRALLOC( buf ); return return_buf; }
int VX_OwnFragTextLen(void) { return (int) strlen_color(ownfragtext.text); }