From df715e90671b3ea25ce8e79ebb9f7afc86b42bd0 Mon Sep 17 00:00:00 2001 From: divverent Date: Sat, 25 Sep 2010 08:39:33 +0000 Subject: [PATCH] loadfont now prints a warning if it gets more than MAX_FONT_SIZES sizes and skips duplicated sizes Signed-off-by: terencehill git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10493 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_draw.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gl_draw.c b/gl_draw.c index 6697db42..dc25bd0d 100644 --- a/gl_draw.c +++ b/gl_draw.c @@ -888,10 +888,28 @@ static void LoadFont_f(void) voffset = atof(Cmd_Argv(i)); continue; } + + if (sizes == -1) + continue; // no slot for other sizes + // parse one of sizes sz = atof(Cmd_Argv(i)); if (sz > 0.001f && sz < 1000.0f) // do not use crap sizes { + // search for duplicated sizes + int j; + for (j=0; jreq_sizes[j] == sz) + break; + if (j != sizes) + continue; // sz already in req_sizes, don't add it again + + if (sizes == MAX_FONT_SIZES) + { + Con_Printf("Warning: specified more than %i different font sizes, exceding ones are ignored\n", MAX_FONT_SIZES); + sizes = -1; + continue; + } f->req_sizes[sizes] = sz; sizes++; } -- 2.39.2