World copying with facts and constants is working so now new levels are possible, but need to work on previous level motion.
This commit is contained in:
parent
2735a0ac1f
commit
82216b8307
6 changed files with 52 additions and 32 deletions
|
@ -152,3 +152,31 @@ TEST_CASE("confirm that the event system works", "[ecs]") {
|
|||
ready = world.has_event<GUIEvent>();
|
||||
REQUIRE(ready == false);
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("confirm copying and constants", "[ecs-constants]") {
|
||||
DinkyECS::World world1;
|
||||
|
||||
Player player_info{"Zed", world1.entity()};
|
||||
world1.set_the<Player>(player_info);
|
||||
|
||||
world1.set<Position>(player_info.eid, {10,10});
|
||||
world1.make_constant(player_info.eid);
|
||||
|
||||
DinkyECS::World world2;
|
||||
world1.clone_into(world2);
|
||||
|
||||
auto &test1 = world1.get<Position>(player_info.eid);
|
||||
auto &test2 = world2.get<Position>(player_info.eid);
|
||||
|
||||
REQUIRE(test2.x == test1.x);
|
||||
REQUIRE(test2.y == test1.y);
|
||||
|
||||
// check for accidental reference
|
||||
test1.x = 100;
|
||||
REQUIRE(test2.x != test1.x);
|
||||
|
||||
// test the facts copy over
|
||||
auto &player2 = world2.get_the<Player>();
|
||||
REQUIRE(player2.eid == player_info.eid);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue