From d8156afbb123a3493e2205b5f5b95ad8b98b172b Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Sat, 3 Oct 2009 12:47:02 +0000 Subject: * Fix ordinals in spawn queue to not display 11st, 12nd, 13rd etc. --- src/cgame/cg_draw.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 3423957a..4c18e4c4 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -2861,7 +2861,7 @@ static qboolean CG_DrawQueue( void ) { float w; vec4_t color; - int position, remainder; + int position; char *ordinal, buffer[ MAX_STRING_CHARS ]; if( !( cg.snap->ps.pm_flags & PMF_QUEUED ) ) @@ -2875,14 +2875,15 @@ static qboolean CG_DrawQueue( void ) position = cg.snap->ps.persistant[ PERS_QUEUEPOS ] + 1; if( position < 1 ) return qfalse; - remainder = position % 10; - ordinal = "th"; - if( remainder == 1 ) - ordinal = "st"; - else if( remainder == 2 ) - ordinal = "nd"; - else if( remainder == 3 ) - ordinal = "rd"; + + switch( position ) + { + case 1: ordinal = "st"; break; + case 2: ordinal = "nd"; break; + case 3: ordinal = "rd"; break; + default: ordinal = "th"; break; + } + Com_sprintf( buffer, MAX_STRING_CHARS, "You are %d%s in the spawn queue", position, ordinal ); -- cgit