diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2013-01-23 19:17:11 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2013-01-23 19:17:11 (GMT) |
| commit | 0034dd654e2cb4814da6303806d0c03df34ad3dd (patch) | |
| tree | 53b67915b11cbce966ebeb7c5d0d24a056b13d59 /src/simulation/elements/PSTN.cpp | |
| parent | 412e13a03edc7ee99f6f2c385479c562f9913bd7 (diff) | |
| download | powder-0034dd654e2cb4814da6303806d0c03df34ad3dd.zip powder-0034dd654e2cb4814da6303806d0c03df34ad3dd.tar.gz | |
Fix FRME limits
Diffstat (limited to 'src/simulation/elements/PSTN.cpp')
| -rw-r--r-- | src/simulation/elements/PSTN.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/simulation/elements/PSTN.cpp b/src/simulation/elements/PSTN.cpp index a911f48..7e4aaa6 100644 --- a/src/simulation/elements/PSTN.cpp +++ b/src/simulation/elements/PSTN.cpp @@ -53,7 +53,7 @@ int Element_PSTN::tempParts[128]; #define PISTON_INACTIVE 0x00 #define PISTON_RETRACT 0x01 #define PISTON_EXTEND 0x02 -#define MAX_FRAME 0xFF +#define MAX_FRAME 0x0F //#TPT-Directive ElementHeader Element_PSTN static int update(UPDATE_FUNC_ARGS) int Element_PSTN::update(UPDATE_FUNC_ARGS) @@ -170,10 +170,11 @@ int Element_PSTN::MoveStack(Simulation * sim, int stackX, int stackY, int direct int val = MoveStack(sim, posX, posY, directionX, directionY, size, amount, retract, 1); if(val < biggestMove) biggestMove = val; - } + } else + break; } - if(!c) - continue; //If in the centre, don't do extend twice + } + for(int c = 1; c < MAX_FRAME; c++) { posY = stackY - (c*newY); posX = stackX - (c*newX); if (posX < XRES && posY < YRES && posX >= 0 && posY >= 0) { @@ -182,7 +183,8 @@ int Element_PSTN::MoveStack(Simulation * sim, int stackX, int stackY, int direct int val = MoveStack(sim, posX, posY, directionX, directionY, size, amount, retract, 1); if(val < biggestMove) biggestMove = val; - } + } else + break; } } return biggestMove; |
