From 938b76b8bef3c1b15ebbe6ce0df03567fe48ef43 Mon Sep 17 00:00:00 2001 From: Allanis <allanis@saracraft.net> Date: Sun, 10 Mar 2013 19:19:14 +0000 Subject: [PATCH] [Add] Boundary checking for starmap names. --- src/map.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/map.c b/src/map.c index ed65a8e..84deca4 100644 --- a/src/map.c +++ b/src/map.c @@ -160,10 +160,12 @@ static void map_render(double bx, double by, double w, double h) { r, bx, by, w, h); // Draw the system name. - if(map_zoom >= 1.) // Can't be tiny. - gl_printMax(&gl_smallFont, (bx+w)-(x+7. + sys->pos.x * map_zoom), - x + 7. + sys->pos.x * map_zoom + gl_screen.w/2., - y - 5. + sys->pos.y * map_zoom + gl_screen.h/2., + tx = x + 7. + sys->pos.x * map_zoom; + ty = y - 5. + sys->pos.y * map_zoom; + if((map_zoom >= 1.) && // Can't be tiny. + ((tx > bx) && (ty > by) && (ty < by+h-6.))) // Width checking. + gl_printMax(&gl_smallFont, (bx+w)-(tx), + tx + gl_screen.w/2., ty + gl_screen.h/2., &cWhite, sys->name); // Draw the hyperspace paths.