From 73b8cc5ccd4a4a7905c958fdf74ed6d647a52cd0 Mon Sep 17 00:00:00 2001 From: Askou Date: Fri, 11 Jun 2021 19:25:43 +0200 Subject: [PATCH] fix floor hitbox on no floor map --- sources/Map/Map.cpp | 9 +++++---- sources/Map/Map.hpp | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sources/Map/Map.cpp b/sources/Map/Map.cpp index af76ec99..f158d81b 100644 --- a/sources/Map/Map.cpp +++ b/sources/Map/Map.cpp @@ -381,7 +381,7 @@ namespace BBM return (map); } - MapGenerator::MapBlock MapGenerator::createMap(int width, int height) + MapGenerator::MapBlock MapGenerator::createMap(int width, int height, bool isHeight) { MapBlock map; @@ -408,7 +408,8 @@ namespace BBM for (int j = 0; j < height + 1; j++) if (!((i + 1) % 2) && !((j + 1) % 2)) map[std::make_tuple(i, 0, j)] = UNBREAKABLE; - map = createHeight(map, width, height); + if (isHeight) + map = createHeight(map, width, height); map = cleanBreakable(map, width, height); return (map); } @@ -426,11 +427,11 @@ namespace BBM for (int i = width / 2 - width / 4; i < width / 2 + width / 4 + 1; i++) { for (int j = height / 2 - height / 4; j < height / 2 + height / 4 + 1; j++) { if (map[std::make_tuple(i, 1, i)] != UPPERFLOOR) { - floor -= -1; + floor -= 1; break; } } - if (floor <= -1) + if (floor <= 0) break; } if (floor >= 1) { diff --git a/sources/Map/Map.hpp b/sources/Map/Map.hpp index 8161364d..562bfb40 100644 --- a/sources/Map/Map.hpp +++ b/sources/Map/Map.hpp @@ -181,7 +181,7 @@ namespace BBM //! @param width Width of the map //! @param height Height of the map //! @brief Generate map of block to be loaded - static MapBlock createMap(int width, int height); + static MapBlock createMap(int width, int height, bool isHeight = false); //! @param width Width of the map //! @param height Height of the map