summaryrefslogtreecommitdiff
path: root/src/cat/LuaScriptInterface.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-06-12 18:45:19 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-06-12 18:45:19 (GMT)
commit3b020b315148e5b065071b5bb8a4caf1321c730c (patch)
treebbdd23639ae2c949d337efcb44e39b0c940d0346 /src/cat/LuaScriptInterface.cpp
parentb8f2a2dcd5dbc3e7d15cacf829cf8b43b4a35aa5 (diff)
downloadpowder-3b020b315148e5b065071b5bb8a4caf1321c730c.zip
powder-3b020b315148e5b065071b5bb8a4caf1321c730c.tar.gz
TPT: fix crash, spark reset set type without checking if it was a valid number
Diffstat (limited to 'src/cat/LuaScriptInterface.cpp')
-rw-r--r--src/cat/LuaScriptInterface.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/cat/LuaScriptInterface.cpp b/src/cat/LuaScriptInterface.cpp
index c7dc15d..48e7908 100644
--- a/src/cat/LuaScriptInterface.cpp
+++ b/src/cat/LuaScriptInterface.cpp
@@ -1128,8 +1128,13 @@ int luatpt_reset_spark(lua_State* l)
{
if (luacon_sim->parts[i].type==PT_SPRK)
{
- luacon_sim->parts[i].type = luacon_sim->parts[i].ctype;
- luacon_sim->parts[i].life = 4;
+ if (luacon_sim->parts[i].ctype >= 0 && luacon_sim->parts[i].ctype < PT_NUM)
+ {
+ luacon_sim->parts[i].type = luacon_sim->parts[i].ctype;
+ luacon_sim->parts[i].life = 0;
+ }
+ else
+ luacon_sim->kill_part(i);
}
}
return 0;