Skip to content

Commit

Permalink
Actually use .Properties instead of .Falldown for wall blocking
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed Dec 31, 2015
1 parent 8630b0a commit adf0fa7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/client/GameSave.cpp
Expand Up @@ -791,7 +791,7 @@ void GameSave::readOPS(char * data, int dataLength)
if (blockMap[y][x]==O_WL_ALLOWAIR)
blockMap[y][x]=WL_ALLOWAIR;
if (blockMap[y][x]==O_WL_ALLOWSOLID)
blockMap[y][x]=WL_ALLOWSOLID;
blockMap[y][x]=WL_ALLOWPOWDER;
if (blockMap[y][x]==O_WL_ALLOWALLELEC)
blockMap[y][x]=WL_ALLOWALLELEC;
if (blockMap[y][x]==O_WL_EHOLE)
Expand Down Expand Up @@ -1312,7 +1312,7 @@ void GameSave::readPSv(char * data, int dataLength)
else if (blockMap[y][x]==9)
blockMap[y][x]=WL_ALLOWAIR;
else if (blockMap[y][x]==10)
blockMap[y][x]=WL_ALLOWSOLID;
blockMap[y][x]=WL_ALLOWPOWDER;
else if (blockMap[y][x]==11)
blockMap[y][x]=WL_ALLOWALLELEC;
else if (blockMap[y][x]==12)
Expand Down Expand Up @@ -1346,7 +1346,7 @@ void GameSave::readPSv(char * data, int dataLength)
else if (blockMap[y][x]==O_WL_ALLOWAIR)
blockMap[y][x]=WL_ALLOWAIR;
else if (blockMap[y][x]==O_WL_ALLOWSOLID)
blockMap[y][x]=WL_ALLOWSOLID;
blockMap[y][x]=WL_ALLOWPOWDER;
else if (blockMap[y][x]==O_WL_ALLOWALLELEC)
blockMap[y][x]=WL_ALLOWALLELEC;
else if (blockMap[y][x]==O_WL_EHOLE)
Expand Down
18 changes: 4 additions & 14 deletions src/simulation/Simulation.cpp
Expand Up @@ -1943,7 +1943,7 @@ bool Simulation::IsWallBlocking(int x, int y, int type)
return true;
else if (wall == WL_ALLOWLIQUID && !(elements[type].Properties&TYPE_LIQUID))
return true;
else if (wall == WL_ALLOWSOLID && !(elements[type].Properties&TYPE_PART))
else if (wall == WL_ALLOWPOWDER && !(elements[type].Properties&TYPE_PART))
return true;
else if (wall == WL_ALLOWAIR || wall == WL_WALL || wall == WL_WALLELEC)
return true;
Expand Down Expand Up @@ -2154,17 +2154,7 @@ int Simulation::eval_move(int pt, int nx, int ny, unsigned *rr)
}
if (bmap[ny/CELL][nx/CELL])
{
if (bmap[ny/CELL][nx/CELL]==WL_ALLOWGAS && !(elements[pt].Properties&TYPE_GAS))// && elements[pt].Falldown!=0 && pt!=PT_FIRE && pt!=PT_SMKE)
return 0;
if (bmap[ny/CELL][nx/CELL]==WL_ALLOWENERGY && !(elements[pt].Properties&TYPE_ENERGY))// && elements[pt].Falldown!=0 && pt!=PT_FIRE && pt!=PT_SMKE)
return 0;
if (bmap[ny/CELL][nx/CELL]==WL_ALLOWLIQUID && elements[pt].Falldown!=2)
return 0;
if (bmap[ny/CELL][nx/CELL]==WL_ALLOWSOLID && elements[pt].Falldown!=1)
return 0;
if (bmap[ny/CELL][nx/CELL]==WL_ALLOWAIR || bmap[ny/CELL][nx/CELL]==WL_WALL || bmap[ny/CELL][nx/CELL]==WL_WALLELEC)
return 0;
if (bmap[ny/CELL][nx/CELL]==WL_EWALL && !emap[ny/CELL][nx/CELL])
if (IsWallBlocking(nx, ny, pt))
return 0;
if (bmap[ny/CELL][nx/CELL]==WL_EHOLE && !emap[ny/CELL][nx/CELL] && !(elements[pt].Properties&TYPE_SOLID) && !(elements[r&0xFF].Properties&TYPE_SOLID))
return 2;
Expand Down Expand Up @@ -3416,8 +3406,8 @@ void Simulation::UpdateParticles(int start, int end)
bmap[y/CELL][x/CELL]==WL_WALLELEC ||
bmap[y/CELL][x/CELL]==WL_ALLOWAIR ||
(bmap[y/CELL][x/CELL]==WL_DESTROYALL) ||
(bmap[y/CELL][x/CELL]==WL_ALLOWLIQUID && elements[t].Falldown!=2) ||
(bmap[y/CELL][x/CELL]==WL_ALLOWSOLID && elements[t].Falldown!=1) ||
(bmap[y/CELL][x/CELL]==WL_ALLOWLIQUID && !(elements[t].Properties&TYPE_LIQUID)) ||
(bmap[y/CELL][x/CELL]==WL_ALLOWPOWDER && !(elements[t].Properties&TYPE_PART)) ||
(bmap[y/CELL][x/CELL]==WL_ALLOWGAS && !(elements[t].Properties&TYPE_GAS)) || //&& elements[t].Falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE && parts[i].type!=PT_CFLM) ||
(bmap[y/CELL][x/CELL]==WL_ALLOWENERGY && !(elements[t].Properties&TYPE_ENERGY)) ||
(bmap[y/CELL][x/CELL]==WL_DETECT && (t==PT_METL || t==PT_SPRK)) ||
Expand Down
2 changes: 1 addition & 1 deletion src/simulation/SimulationData.h
Expand Up @@ -48,7 +48,7 @@
#define WL_DESTROYALL 7
#define WL_WALL 8
#define WL_ALLOWAIR 9
#define WL_ALLOWSOLID 10
#define WL_ALLOWPOWDER 10
#define WL_ALLOWALLELEC 11
#define WL_EHOLE 12
#define WL_ALLOWGAS 13
Expand Down

0 comments on commit adf0fa7

Please sign in to comment.