Skip to content

Commit

Permalink
Fix bug in Lua API sim.neighbours() causing some particles to be miss…
Browse files Browse the repository at this point in the history
…ed out

Was excluding all particles with the same x or y as the centre instead of just the centre particle.
  • Loading branch information
jacksonmj committed Mar 3, 2014
1 parent 224b25f commit 64e1602
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lua/LuaScriptInterface.cpp
Expand Up @@ -1620,12 +1620,12 @@ int NeighboursClosure(lua_State * l)
if(y>ry)
return 0;
}
if(!(x && y) || sx+x<0 || sy+y<0 || sx+x>=XRES*CELL || sy+y>=YRES*CELL)
if(!(x || y) || sx+x<0 || sy+y<0 || sx+x>=XRES*CELL || sy+y>=YRES*CELL)
{
continue;
}
i=luacon_sim->pmap[y+sx][x+sx];
} while(!i&0xFF);
} while(!(i&0xFF));
lua_pushnumber(l, x);
lua_replace(l, lua_upvalueindex(5));
lua_pushnumber(l, y);
Expand Down

0 comments on commit 64e1602

Please sign in to comment.