From adf0fa72dfcb4c28b1db5918cef3a89c27099592 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Wed, 30 Dec 2015 23:45:05 -0500 Subject: [PATCH] Actually use .Properties instead of .Falldown for wall blocking --- src/client/GameSave.cpp | 6 +++--- src/simulation/Simulation.cpp | 18 ++++-------------- src/simulation/SimulationData.h | 2 +- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/src/client/GameSave.cpp b/src/client/GameSave.cpp index cd7f692d1..eb81aaad2 100644 --- a/src/client/GameSave.cpp +++ b/src/client/GameSave.cpp @@ -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) @@ -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) @@ -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) diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 47d5b4465..58afff6e8 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -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; @@ -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; @@ -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)) || diff --git a/src/simulation/SimulationData.h b/src/simulation/SimulationData.h index 7aa033389..90fcfeeb4 100644 --- a/src/simulation/SimulationData.h +++ b/src/simulation/SimulationData.h @@ -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