diff options
| author | jacksonmj <mj-pt@jacksonmj.co.uk> | 2011-06-24 20:54:59 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-06-25 14:52:52 (GMT) |
| commit | c18009dd9c87343178e808565d815b454bd2b585 (patch) | |
| tree | 0802e521b44b7adecbe38518a343a9df882ebc20 /src/luaconsole.c | |
| parent | 36e2a07a5b5e0eb07bd9fcea48004dd8b5890322 (diff) | |
| download | powder-c18009dd9c87343178e808565d815b454bd2b585.zip powder-c18009dd9c87343178e808565d815b454bd2b585.tar.gz | |
Check particle exists in tpt.set_property, and sdl_scale mouse coords for Lua step
Diffstat (limited to 'src/luaconsole.c')
| -rw-r--r-- | src/luaconsole.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/luaconsole.c b/src/luaconsole.c index 714800b..93cd407 100644 --- a/src/luaconsole.c +++ b/src/luaconsole.c @@ -436,7 +436,7 @@ int luatpt_set_property(lua_State* l) for (nx = x; nx<x+w; nx++) for (ny = y; ny<y+h; ny++){ i = pmap[ny][nx]>>8; - if (i < 0 || i >= NPART || (partsel && partsel != parts[i].type)) + if (!(pmap[ny][nx]&0xFF) || i < 0 || i >= NPART || (partsel && partsel != parts[i].type)) continue; if(format==2){ *((float*)(((void*)&parts[i])+offset)) = f; @@ -455,6 +455,8 @@ int luatpt_set_property(lua_State* l) } if (i < 0 || i >= NPART) return luaL_error(l, "Invalid particle ID '%d'", i); + if (!parts[i].type) + return 0; if (partsel && partsel != parts[i].type) return 0; if(format==2){ |
