From 5ded009ffd168b5e56ba559af27aecaed9aa2549 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Sat, 1 Oct 2011 20:11:27 +0100 Subject: [PATCH] Fix bug with drawing rectangles outside the game region --- src/luaconsole.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/luaconsole.c b/src/luaconsole.c index 1e03919c8..9a7613e24 100644 --- a/src/luaconsole.c +++ b/src/luaconsole.c @@ -688,9 +688,9 @@ int luatpt_drawrect(lua_State* l) if (x<0 || y<0 || x>=XRES+BARSIZE || y>=YRES+MENUSIZE) return luaL_error(l, "Screen coordinates out of range (%d,%d)", x, y); - if(x+w > XRES) + if(x+w > XRES+BARSIZE) w = XRES-x; - if(y+h > YRES) + if(y+h > YRES+MENUSIZE) h = YRES-y; if (r<0) r = 0; if (r>255) r = 255;