diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/behaviour_system.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/behaviour_system.cpp b/src/behaviour_system.cpp index 3637b3e..4a194f0 100644 --- a/src/behaviour_system.cpp +++ b/src/behaviour_system.cpp | |||
@@ -156,8 +156,10 @@ void BehaviourSystem::createPath(int spriteId) { | |||
156 | Direction::up, | 156 | Direction::up, |
157 | Direction::right }; | 157 | Direction::right }; |
158 | 158 | ||
159 | const std::vector<Direction>* directionList = sprite.cardinalDirectionsOnly ? &cardinalDirections : &allDirections; | 159 | std::vector<Direction> directionList = sprite.cardinalDirectionsOnly ? cardinalDirections : allDirections; |
160 | for (Direction dir : *directionList) { | 160 | directionList.push_back(nodeInfo.dirFromPreviousPoint); |
161 | |||
162 | for (Direction dir : directionList) { | ||
161 | vec2i newPos = searchNode.point + unitVecInDirection(dir) * sprite.movementSpeed; | 163 | vec2i newPos = searchNode.point + unitVecInDirection(dir) * sprite.movementSpeed; |
162 | 164 | ||
163 | if (newPos.x() < 0 || newPos.y() < 0 || newPos.x() >= mapBounds.w() || newPos.y() >= mapBounds.h()) { | 165 | if (newPos.x() < 0 || newPos.y() < 0 || newPos.x() >= mapBounds.w() || newPos.y() >= mapBounds.h()) { |