Brought over a bunch of code from the roguelike and now will use it to generate a random map.

This commit is contained in:
Zed A. Shaw 2025-01-30 11:38:57 -05:00
parent 8d3d3b4ec3
commit 2daa1c9bd5
59 changed files with 4303 additions and 411 deletions

40
tests/levelmanager.cpp Normal file
View file

@ -0,0 +1,40 @@
#include <catch2/catch_test_macros.hpp>
#include <fmt/core.h>
#include "map.hpp"
#include "dinkyecs.hpp"
#include "worldbuilder.hpp"
#include "save.hpp"
#include "systems.hpp"
#include "spatialmap.hpp"
#include "levelmanager.hpp"
using namespace fmt;
using std::string;
TEST_CASE("basic level manager test", "[levelmanager]") {
LevelManager lm;
// starts off with one already but I need to change that
size_t level1 = lm.current_index();
size_t level2 = lm.create_level();
auto& test1_level = lm.get(level1);
auto& test2_level = lm.get(level2);
REQUIRE(test1_level.map->width() > 0);
REQUIRE(test1_level.map->height() > 0);
REQUIRE(test1_level.index == 0);
REQUIRE(test2_level.map->width() > 0);
REQUIRE(test2_level.map->height() > 0);
REQUIRE(test2_level.index == 1);
auto& cur_level = lm.current();
REQUIRE(cur_level.index == 0);
auto& next_level = lm.next();
REQUIRE(next_level.index == 1);
auto& prev_level = lm.previous();
REQUIRE(prev_level.index == 0);
}