From 5ded009ffd168b5e56ba559af27aecaed9aa2549 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Sat, 1 Oct 2011 20:11:27 +0100 Subject: Fix bug with drawing rectangles outside the game region diff --git a/src/luaconsole.c b/src/luaconsole.c index 1e03919..9a7613e 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; -- cgit v0.9.2-21-gd62e