diff options
| author | jacob1 <jfu614@gmail.com> | 2013-08-30 00:59:37 (GMT) |
|---|---|---|
| committer | jacob1 <jfu614@gmail.com> | 2013-08-30 01:00:31 (GMT) |
| commit | b17ef7f938808fe972030757921e958793a17943 (patch) | |
| tree | b3a39a5c3a8eeaf3471e1cc08e98f00e1cd286d4 /src | |
| parent | c3d3f9fc2abd0b44d996fd511ce6cdddd74c8ea6 (diff) | |
| download | powder-b17ef7f938808fe972030757921e958793a17943.zip powder-b17ef7f938808fe972030757921e958793a17943.tar.gz | |
fix PSTN bug found in save 1299509 (hopefully won't break anything)
Diffstat (limited to 'src')
| -rw-r--r-- | src/simulation/elements/PSTN.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/simulation/elements/PSTN.cpp b/src/simulation/elements/PSTN.cpp index 6dda77f..998f7a2 100644 --- a/src/simulation/elements/PSTN.cpp +++ b/src/simulation/elements/PSTN.cpp @@ -167,7 +167,7 @@ int Element_PSTN::update(UPDATE_FUNC_ARGS) //#TPT-Directive ElementHeader Element_PSTN static int CanMoveStack(Simulation * sim, int stackX, int stackY, int directionX, int directionY, int maxSize, int amount, bool retract, int block) int Element_PSTN::CanMoveStack(Simulation * sim, int stackX, int stackY, int directionX, int directionY, int maxSize, int amount, bool retract, int block) { - int posX, posY, r, spaces = 0, currentPos = 0; + int posX, posY, r, spaces = 0, currentPos = 0, num = 0; if (amount <= 0) return 0; for(posX = stackX, posY = stackY; currentPos < maxSize + amount && currentPos < XRES-1; posX += directionX, posY += directionY) { @@ -176,7 +176,7 @@ int Element_PSTN::CanMoveStack(Simulation * sim, int stackX, int stackY, int dir } r = sim->pmap[posY][posX]; if (sim->IsWallBlocking(posX, posY, 0) || (block && (r&0xFF) == block)) - return spaces; + return num; if(!r) { spaces++; tempParts[currentPos++] = -1; @@ -186,8 +186,9 @@ int Element_PSTN::CanMoveStack(Simulation * sim, int stackX, int stackY, int dir if(spaces < maxSize && currentPos < maxSize && (!retract || ((r&0xFF) == PT_FRME) && posX == stackX && posY == stackY)) tempParts[currentPos++] = r>>8; else - return spaces; + return num; } + num++; } if (spaces) return currentPos; |
