diff options
| author | Jacob1 <jfu614@gmail.com> | 2012-05-24 15:26:25 (GMT) |
|---|---|---|
| committer | Jacob1 <jfu614@gmail.com> | 2012-05-24 15:26:25 (GMT) |
| commit | 82b60ba5ca7f83b6da677975b21d05247ac79134 (patch) | |
| tree | f131201b5254c495a6dd1d496abfe1ca95a58d68 /src | |
| parent | 6f3d87ad04529f5367bbb35caee5ab17eec19059 (diff) | |
| download | powder-82b60ba5ca7f83b6da677975b21d05247ac79134.zip powder-82b60ba5ca7f83b6da677975b21d05247ac79134.tar.gz | |
fix lua console freeze/bugs
Diffstat (limited to 'src')
| -rw-r--r-- | src/luaconsole.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/luaconsole.c b/src/luaconsole.c index 65320ce..5e6eebc 100644 --- a/src/luaconsole.c +++ b/src/luaconsole.c @@ -1476,9 +1476,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+BARSIZE) - w = XRES-x; + w = XRES+BARSIZE-x; if(y+h > YRES+MENUSIZE) - h = YRES-y; + h = YRES+MENUSIZE-y; if (r<0) r = 0; if (r>255) r = 255; if (g<0) g = 0; @@ -1510,9 +1510,9 @@ int luatpt_fillrect(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+BARSIZE) - w = XRES-x; + w = XRES+BARSIZE-x; if(y+h > YRES+MENUSIZE) - h = YRES-y; + h = YRES+MENUSIZE-y; if (r<0) r = 0; if (r>255) r = 255; if (g<0) g = 0; @@ -1907,6 +1907,8 @@ int luatpt_setdebug(lua_State* l) int luatpt_setfpscap(lua_State* l) { int fpscap = luaL_optint(l, 1, 0); + if (fpscap < 2) + return luaL_error(l, "fps cap too small"); limitFPS = fpscap; return 0; } |
