mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-09-07 06:20:42 +02:00
Fix bug in Lua API sim.neighbours() causing some particles to be missed out
Was excluding all particles with the same x or y as the centre instead of just the centre particle.
This commit is contained in:
@@ -1620,12 +1620,12 @@ int NeighboursClosure(lua_State * l)
|
|||||||
if(y>ry)
|
if(y>ry)
|
||||||
return 0;
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
i=luacon_sim->pmap[y+sx][x+sx];
|
i=luacon_sim->pmap[y+sx][x+sx];
|
||||||
} while(!i&0xFF);
|
} while(!(i&0xFF));
|
||||||
lua_pushnumber(l, x);
|
lua_pushnumber(l, x);
|
||||||
lua_replace(l, lua_upvalueindex(5));
|
lua_replace(l, lua_upvalueindex(5));
|
||||||
lua_pushnumber(l, y);
|
lua_pushnumber(l, y);
|
||||||
|
Reference in New Issue
Block a user