cleanup of unnecessarily convoluted function call
[rocksndiamonds.git] / src / libgame / text.c
index 9b9ad87f36f0d7a0b9f4b672d41301268240b000..1db4848f0170a0964414be29d4b64c784d13a3b3 100644 (file)
@@ -101,12 +101,13 @@ static int getFontCharPosition(int font_nr, char c)
 {
   int font_bitmap_id = gfx.select_font_function(font_nr);
   struct FontBitmapInfo *font = &gfx.font_bitmap_info[font_bitmap_id];
-  boolean default_font = (font->num_chars == DEFAULT_NUM_CHARS_PER_FONT);
   int font_pos = (unsigned char)c - 32;
 
   // map some special characters to their ascii values in default font
-  if (default_font)
+  if (font->num_chars == DEFAULT_NUM_CHARS_PER_FONT)
     font_pos = MAP_FONT_ASCII(c) - 32;
+  else if (font->num_chars == NUM_CHARS_PER_FONT_EXT)
+    font_pos = MAP_FONT_ASCII_EXT(c) - 32;
 
   // this allows dynamic special characters together with special font
   if (font_pos < 0 || font_pos >= font->num_chars)
@@ -588,8 +589,8 @@ static int DrawTextBufferExt(int x, int y, char *text_buffer, int base_font_nr,
     {
       if ((line[i] = *text_buffer++) == '\n')
       {
-       // in text areas, 'line_length' sized lines cause additional empty line
-       if (i == line_length && is_text_area)
+       // in text areas, do not skip newline after text ending at last column
+       if (i > 0 && i % line_length == 0 && is_text_area)
          text_buffer--;
 
        break;