diff --git a/.gdbinit b/.gdbinit index 94b5890..9422ffc 100644 --- a/.gdbinit +++ b/.gdbinit @@ -5,4 +5,6 @@ set logging overwrite on set print pretty on set pagination off break abort +break _invalid_parameter_noinfo +break _invalid_parameter catch throw diff --git a/ansi_parser.hpp b/ansi_parser.hpp index 64ba529..9dd054c 100644 --- a/ansi_parser.hpp +++ b/ansi_parser.hpp @@ -2,6 +2,7 @@ #include #include #include +#include typedef std::function ColorCB; diff --git a/map.cpp b/map.cpp index 530dea6..7d4c220 100644 --- a/map.cpp +++ b/map.cpp @@ -13,6 +13,7 @@ using namespace fmt; Map::Map(size_t width, size_t height) : $width(width), $height(height), + $tiles(height, matrix::Row(width, INV_WALL)), $walls(height, matrix::Row(width, INV_WALL)), $paths(width, height) {} diff --git a/map.hpp b/map.hpp index 9c834a5..c0a1d68 100644 --- a/map.hpp +++ b/map.hpp @@ -30,6 +30,7 @@ class Map { public: size_t $width; size_t $height; + Matrix $tiles; Matrix $walls; Pathing $paths; std::vector $rooms; @@ -42,6 +43,7 @@ public: Map(Map &map) = delete; Matrix& paths() { return $paths.paths(); } + Matrix& tiles() { return $tiles; } Matrix& input_map() { return $paths.input(); } Matrix& walls() { return $walls; } size_t width() { return $width; } diff --git a/systems.cpp b/systems.cpp index 2e6a2a2..df177e0 100644 --- a/systems.cpp +++ b/systems.cpp @@ -180,7 +180,7 @@ void System::draw_map(DinkyECS::World &world, Map &game_map, const Matrix &light const auto& player = world.get_the(); const auto& player_position = world.get(player.entity); Point start = game_map.center_camera(player_position.location, view_x, view_y); - auto &walls = game_map.walls(); + auto &tiles = game_map.tiles(); auto &paths = game_map.paths(); size_t end_x = std::min(view_x, game_map.width() - start.x); @@ -188,7 +188,7 @@ void System::draw_map(DinkyECS::World &world, Map &game_map, const Matrix &light for(size_t y = 0; y < end_y; ++y) { for(size_t x = 0; x < end_x; ++x) { - string tile = walls[start.y+y][start.x+x] == 1 ? config.WALL_TILE : config.FLOOR_TILE; + string tile = tiles[start.y+y][start.x+x] == L'#' ? config.WALL_TILE : config.FLOOR_TILE; int light_value = debug.LIGHT ? 160 : lighting[start.y+y][start.x+x]; if(tile == config.WALL_TILE) { diff --git a/tests/gui.cpp b/tests/gui.cpp index 60a20c7..8c00b57 100644 --- a/tests/gui.cpp +++ b/tests/gui.cpp @@ -13,7 +13,7 @@ using namespace fmt; using namespace components; using std::string; -TEST_CASE("load a basic gui run but don't loop", "[render]") { +TEST_CASE("load a basic gui run but don't loop", "[gui]") { DinkyECS::World world; save::load_configs(world); Map game_map(40, 40); diff --git a/tests/matrix.cpp b/tests/matrix.cpp index 0045062..10b20f7 100644 --- a/tests/matrix.cpp +++ b/tests/matrix.cpp @@ -133,7 +133,7 @@ TEST_CASE("thrash box iterators", "[matrix]") { } TEST_CASE("thrash compass iterators", "[matrix:compass]") { - for(int count = 0; count < 2000; count++) { + for(int count = 0; count < 20; count++) { size_t width = Random::uniform(1, 25); size_t height = Random::uniform(1, 33); @@ -163,7 +163,7 @@ TEST_CASE("thrash compass iterators", "[matrix:compass]") { } TEST_CASE("prototype flood algorithm", "[matrix:flood]") { - for(int count = 0; count < 1000; count++) { + for(int count = 0; count < 20; count++) { size_t width = Random::uniform(10, 25); size_t height = Random::uniform(10, 33); diff --git a/tools/designer.cpp b/tools/designer.cpp index ef3973d..db22d22 100644 --- a/tools/designer.cpp +++ b/tools/designer.cpp @@ -20,12 +20,12 @@ #include using namespace nlohmann; -using namespace fmt; using namespace ftxui; using namespace std::chrono_literals; using lighting::LightSource, lighting::LightRender; namespace fs = std::filesystem; using std::string, std::wstring, std::vector; +using fmt::println, fmt::print, fmt::format; const Point GRID_SIZE={15,8}; const int DEFAULT_FONT_SIZE=200; @@ -54,7 +54,7 @@ struct FontGrid { } void configure_font() { - dbc::check(fs::exists($font_list), format("font listing {} does not exist", $font_list)); + dbc::check(fs::exists($font_list), std::format("font listing {} does not exist", $font_list)); std::ifstream in_file($font_list); json input = json::parse(in_file); diff --git a/tools/fontextract.cpp b/tools/fontextract.cpp index 515e73a..9f23682 100644 --- a/tools/fontextract.cpp +++ b/tools/fontextract.cpp @@ -1,10 +1,8 @@ #include #include -#include // for operator""s, chrono_literals #include // for sleep_for #include #include -#include #include #include #include @@ -16,9 +14,10 @@ #include FT_TRUETYPE_IDS_H #include "dbc.hpp" #include "constants.hpp" +#include using namespace nlohmann; -using namespace fmt; +using fmt::format, fmt::println, fmt::print; namespace fs = std::filesystem; using std::string, std::wstring, std::vector; diff --git a/tser.hpp b/tser.hpp index bcc16dc..0fe6972 100644 --- a/tser.hpp +++ b/tser.hpp @@ -211,10 +211,10 @@ inline decltype(auto) members() const { return std::tie(__VA_ARGS__); } \ inline decltype(auto) members() { return std::tie(__VA_ARGS__); } \ static constexpr std::array _memberNameData = [](){ \ std::array chars{'\0'}; size_t _idx = 0; constexpr auto* ini(#__VA_ARGS__); \ -for (char const* _c = ini; *_c; ++_c, ++_idx) if(*_c != ',' && *_c != ' ') chars[_idx] = *_c; return chars;}(); \ +for (char const* _c = ini; *_c; ++_c, ++_idx) { if(*_c != ',' && *_c != ' ') chars[_idx] = *_c; } return chars;}(); \ static constexpr const char* _typeName = #Type; \ static constexpr std::array _memberNames = \ [](){ std::array out{ }; \ for(size_t _i = 0, nArgs = 0; nArgs < tser::detail::n_args(#__VA_ARGS__) ; ++_i) { \ -while(Type::_memberNameData[_i] == '\0') _i++; out[nArgs++] = &Type::_memberNameData[_i]; \ +while(Type::_memberNameData[_i] == '\0') {_i++;} out[nArgs++] = &Type::_memberNameData[_i]; \ while(Type::_memberNameData[++_i] != '\0'); } return out;}(); diff --git a/worldbuilder.cpp b/worldbuilder.cpp index 18a4e6f..87ba9cc 100644 --- a/worldbuilder.cpp +++ b/worldbuilder.cpp @@ -135,7 +135,9 @@ void WorldBuilder::generate() { } for(matrix::each_cell it{$map.$walls}; it.next();) { - $map.$walls[it.y][it.x] = !$map.$walls[it.y][it.x]; + int is_wall = !$map.$walls[it.y][it.x]; + $map.$walls[it.y][it.x] = is_wall; + $map.$tiles[it.y][it.x] = is_wall ? L'#' : L'.'; } }