From cf898541fdd764a182f3e180ce68cafcd28bbebc Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Mon, 20 Feb 2017 18:43:26 +0100 Subject: [PATCH] Simplify --- src/text.cpp | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/text.cpp b/src/text.cpp index 299d92e..b13bab4 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -88,30 +88,22 @@ Sint32 GetCharWidth (const char *&c, Sint32 font) */ void DrawText (CPixmap *pPixmap, POINT pos, const char *pText, Sint32 font) { - Sint32 rank; + Sint32 rank; - if (font == FONTLITTLE) + while (*pText != '\0') { - while (*pText != 0) - { - rank = GetOffset (pText); - pPixmap->DrawIcon (-1, CHLITTLE, rank, pos); + rank = GetOffset (pText); - pos.x += GetCharWidth (pText, font); - pText++; - } - } - else - { - while (*pText != 0) + if (font != FONTLITTLE) { - rank = GetOffset (pText); rank += 128 * font; pPixmap->DrawIcon (-1, CHTEXT, rank, pos); - - pos.x += GetCharWidth (pText, font); - pText++; } + else + pPixmap->DrawIcon (-1, CHLITTLE, rank, pos); + + pos.x += GetCharWidth (pText, font); + pText++; } }