summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacksonmj <mj-pt@jacksonmj.co.uk>2012-01-25 17:20:14 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-01-26 14:15:56 (GMT)
commiteaf2af6d405f715c60ab28b8725d44b4e4a68539 (patch)
tree3ba164612f894828a5bb1765084bcab6eedd96bf
parented2132b7d8aa707eec346eb91ef2f5d067538550 (diff)
downloadpowder-eaf2af6d405f715c60ab28b8725d44b4e4a68539.zip
powder-eaf2af6d405f715c60ab28b8725d44b4e4a68539.tar.gz
Another change to the eval_move check in create_part
Creating a particle where there was a wall but no existing particle was broken, since eval_move returns 1 for moving into empty space.
-rw-r--r--src/powder.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/powder.c b/src/powder.c
index 00b558a..ac710f6 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -798,7 +798,11 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a
return -1;
if (p==-1)//creating from anything but brush
{
- if ((pmap[y][x] || bmap[y/CELL][x/CELL]) && eval_move(t, x, y, NULL)!=2)
+ // If there is a particle, only allow creation if the new particle can occupy the same space as the existing particle
+ // If there isn't a particle but there is a wall, check whether the new particle is allowed to be in it
+ // (not "!=2" for wall check because eval_move returns 1 for moving into empty space)
+ // If there's no particle and no wall, assume creation is allowed
+ if (pmap[y][x] ? (eval_move(t, x, y, NULL)!=2) : (bmap[y/CELL][x/CELL] && eval_move(t, x, y, NULL)==0))
{
if ((pmap[y][x]&0xFF)!=PT_SPAWN&&(pmap[y][x]&0xFF)!=PT_SPAWN2)
{