summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-06-12 18:40:07 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-06-12 18:40:07 (GMT)
commitb8f2a2dcd5dbc3e7d15cacf829cf8b43b4a35aa5 (patch)
tree33690acdbdad1629214bac3f9e9eba5f1d120513 /src
parentd68110c3512ced2874f6d60b32030e45a8779e22 (diff)
downloadpowder-b8f2a2dcd5dbc3e7d15cacf829cf8b43b4a35aa5.zip
powder-b8f2a2dcd5dbc3e7d15cacf829cf8b43b4a35aa5.tar.gz
TPT: fix lua console freeze/bugs
Diffstat (limited to 'src')
-rw-r--r--src/cat/LuaScriptInterface.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/cat/LuaScriptInterface.cpp b/src/cat/LuaScriptInterface.cpp
index cd29ba8..c7dc15d 100644
--- a/src/cat/LuaScriptInterface.cpp
+++ b/src/cat/LuaScriptInterface.cpp
@@ -1485,9 +1485,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;
@@ -1515,9 +1515,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;
@@ -1916,6 +1916,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");
ui::Engine::Ref().FpsLimit = fpscap;
return 0;
}