From fbf1c1f41370f8e036a906064cbe88fee66528c6 Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 20 Jul 2014 17:16:02 +0000 Subject: [PATCH] Throw on too many fonts open --- similar/2d/font.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/similar/2d/font.cpp b/similar/2d/font.cpp index 1530bef13..608d0fd65 100644 --- a/similar/2d/font.cpp +++ b/similar/2d/font.cpp @@ -24,6 +24,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ #include +#include #include #include #include @@ -1020,7 +1021,6 @@ static void grs_font_read(grs_font *gf, PHYSFS_file *fp) grs_font_ptr gr_init_font( const char * fontname ) { - int i,fontnum; unsigned char * ptr; int nchars; PHYSFS_file *fontfile; @@ -1028,10 +1028,13 @@ grs_font_ptr gr_init_font( const char * fontname ) int datasize; //size up to (but not including) palette //find free font slot - for (fontnum=0;fontnumft_data; - for (i=0; i< nchars; i++ ) { + for (int i=0; i < nchars; i++ ) { font->ft_widths[i] = INTEL_SHORT(font->ft_widths[i]); font->ft_chars[i] = ptr; if (font->ft_flags & FT_COLOR) @@ -1112,8 +1115,8 @@ grs_font_ptr gr_init_font( const char * fontname ) ogl_init_font(font.get()); #endif - open_font[fontnum].ptr = font.get(); - open_font[fontnum].dataptr = move(font_data); + f.ptr = font.get(); + f.dataptr = move(font_data); return grs_font_ptr(font.release()); }