Kind of working save now, but does have problems with dead things.

This commit is contained in:
Zed A. Shaw 2024-11-06 15:06:10 -05:00
parent 99d56b246c
commit b2ed598c1f
5 changed files with 24 additions and 7 deletions

View file

@ -66,6 +66,7 @@ TEST_CASE("basic save a world", "[save]") {
world.set<Position>(player.entity, {10,10});
world.set<Motion>(player.entity, {0, 0});
world.set<Combat>(player.entity, {100, 10});
world.set<Tile>(player.entity, {"@"});
save::to_file("./savetest.world", world, map);
@ -78,15 +79,19 @@ TEST_CASE("basic save a world", "[save]") {
REQUIRE(position1.location.x == position2.location.x);
REQUIRE(position1.location.y == position2.location.y);
Combat &combat1 = in_world.get<Combat>(player.entity);
Combat &combat1 = world.get<Combat>(player.entity);
Combat &combat2 = in_world.get<Combat>(player.entity);
REQUIRE(combat1.hp == combat2.hp);
Motion &motion1 = in_world.get<Motion>(player.entity);
Motion &motion1 = world.get<Motion>(player.entity);
Motion &motion2 = in_world.get<Motion>(player.entity);
REQUIRE(motion1.dx == motion2.dx);
REQUIRE(motion1.dy == motion2.dy);
Tile &tile1 = world.get<Tile>(player.entity);
Tile &tile2 = in_world.get<Tile>(player.entity);
REQUIRE(tile1.chr == tile2.chr);
REQUIRE(map.width() == in_map.width());
REQUIRE(map.height() == in_map.height());
REQUIRE(map.$walls == in_map.$walls);