diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/level.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/level.cpp b/src/level.cpp index efc2038..4fc7d2c 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -6,6 +6,7 @@ #include <SFML/System/Angle.hpp> #include <SFML/System/Vector2.hpp> #include <algorithm> +#include <cstdlib> #include <iterator> #include <string> @@ -48,6 +49,17 @@ namespace silly::editor { for (auto it = layer.tiles.begin(); it != layer.tiles.end(); ++it) { if (it->position != position) continue; + float r = it->rotation; + + if (rotation == 270.0f && r == 0.0f) { + r = 360.0f; + } + + // wall building + if (it->tile->type == TILE_WALL && std::abs(r - rotation) == 90.0f) { + break; + } + it->rotation = rotation; it->tile = tile; placed = true; |
