diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-20 13:24:19 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-20 13:24:19 (GMT) |
| commit | 5ea1889e819e270d68a99d6d8179f8a42e9e5dfc (patch) | |
| tree | dac607c086a287864b678233a554b485639d4dc5 /src/cat/LuaScriptInterface.cpp | |
| parent | fb02d57aca25427976f3ec35ead02d25cab7e7ae (diff) | |
| download | powder-5ea1889e819e270d68a99d6d8179f8a42e9e5dfc.zip powder-5ea1889e819e270d68a99d6d8179f8a42e9e5dfc.tar.gz | |
TPT: fix set_property not checking stacked particles when specifying range, add dcolor property setting/getting
Diffstat (limited to 'src/cat/LuaScriptInterface.cpp')
| -rw-r--r-- | src/cat/LuaScriptInterface.cpp | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/cat/LuaScriptInterface.cpp b/src/cat/LuaScriptInterface.cpp index bcf2009..aa534f3 100644 --- a/src/cat/LuaScriptInterface.cpp +++ b/src/cat/LuaScriptInterface.cpp @@ -1306,22 +1306,24 @@ int luatpt_set_property(lua_State* l) w = XRES-x; if(y+h > YRES) h = YRES-y; - for (nx = x; nx<x+w; nx++) - for (ny = y; ny<y+h; ny++){ - r = luacon_sim->pmap[ny][nx]; - if (!r || (partsel && partsel != luacon_sim->parts[r>>8].type)) + Particle * parts = luacon_sim->parts; + for (i = 0; i < NPART; i++) + { + if (parts[i].type) + { + nx = (int)(parts[i].x + .5f); + ny = (int)(parts[i].y + .5f); + if (nx >= x && nx < x+w && ny >= y && ny < y+h && (!partsel || partsel == parts[i].type)) { - r = luacon_sim->photons[ny][nx]; - if (!r || (partsel && partsel != luacon_sim->parts[r>>8].type)) - continue; - } - i = r>>8; - if(format == CommandInterface::FormatFloat){ - *((float*)(((unsigned char*)&luacon_sim->parts[i])+offset)) = f; - } else { - *((int*)(((unsigned char*)&luacon_sim->parts[i])+offset)) = t; + if(format == CommandInterface::FormatFloat){ + *((float*)(((unsigned char*)&luacon_sim->parts[i])+offset)) = f; + } else { + *((int*)(((unsigned char*)&luacon_sim->parts[i])+offset)) = t; + } } } + } + } else { // Got coords or particle index if(i != -1 && y != -1){ @@ -1535,6 +1537,10 @@ int luatpt_get_property(lua_State* l) lua_pushinteger(l, luacon_sim->parts[i].dcolour); return 1; } + if (strcmp(prop,"dcolor")==0){ + lua_pushinteger(l, luacon_sim->parts[i].dcolour); + return 1; + } if (strcmp(prop,"id")==0){ lua_pushnumber(l, i); return 1; |
