diff --git a/components.cpp b/components.cpp index 77fcd54..7f21c81 100644 --- a/components.cpp +++ b/components.cpp @@ -19,7 +19,6 @@ namespace components { components::enroll(MAP); components::enroll(MAP); components::enroll(MAP); - components::enroll(MAP); components::enroll(MAP); components::enroll(MAP); components::enroll(MAP); diff --git a/components.hpp b/components.hpp index f0e3011..3d717e4 100644 --- a/components.hpp +++ b/components.hpp @@ -63,10 +63,6 @@ namespace components { std::string ai_goal_name; }; - struct Weapon { - int damage = 0; - }; - struct Curative { int hp = 10; }; @@ -145,7 +141,6 @@ namespace components { ENROLL_COMPONENT(Sprite, name, width, height, scale); ENROLL_COMPONENT(Curative, hp); ENROLL_COMPONENT(LightSource, strength, radius); - ENROLL_COMPONENT(Weapon, damage); ENROLL_COMPONENT(Position, location.x, location.y); ENROLL_COMPONENT(EnemyConfig, ai_script, ai_start_name, ai_goal_name); ENROLL_COMPONENT(Personality, hearing_distance, tough); diff --git a/dinkyecs.hpp b/dinkyecs.hpp index d2e2f71..b29ed63 100644 --- a/dinkyecs.hpp +++ b/dinkyecs.hpp @@ -40,6 +40,10 @@ namespace DinkyECS Entity entity() { return ++entity_count; } + void destroy(DinkyECS::Entity entity) { + (void)entity; + } + void clone_into(DinkyECS::World &to_world) { to_world.$constants = $constants; to_world.$facts = $facts; diff --git a/pathing.cpp b/pathing.cpp index 81390b7..2dc8ada 100644 --- a/pathing.cpp +++ b/pathing.cpp @@ -112,7 +112,6 @@ bool Pathing::random_walk(Point &out, bool random, int cur = $paths[out.y][out.x]; // pick a random start of directions - // BUG: is uniform inclusive of the dir.size()? int rand_start = Random::uniform(0, dist_size); // go through all possible directions diff --git a/tests/dinkyecs.cpp b/tests/dinkyecs.cpp index 9b17f82..ccf6ba5 100644 --- a/tests/dinkyecs.cpp +++ b/tests/dinkyecs.cpp @@ -192,54 +192,11 @@ TEST_CASE("confirm copying and constants", "[ecs-constants]") { REQUIRE(player2.eid == player_info.eid); } - -TEST_CASE("test serialization with nlohmann::json", "[ecs-serialize]") { - /* - DinkyECS::ComponentMap component_map; - DinkyECS::Component(component_map); - DinkyECS::Component(component_map); - DinkyECS::Component(component_map); - DinkyECS::Component(component_map); - DinkyECS::Component(component_map); - - auto data = R"( - [ - { - "_type": "Position", - "location": { - "x": 10, - "y": 5 - } - }, - { - "_type": "Motion", - "dx": 0, - "dy": 1 - }, - { - "_type": "Velocity", - "x": 0.1, - "y": 10.2 - } - ] - )"_json; - +TEST_CASE("can destroy all entity", "[ecs-destroy]") { DinkyECS::World world; - DinkyECS::Entity ent1 = world.entity(); - DinkyECS::Entity ent2 = world.entity(); - - DinkyECS::configure(component_map, world, ent1, data); - DinkyECS::configure(component_map, world, ent2, data); - - world.query([&](const auto ent, auto &pos, auto &motion) { - fmt::println("entity: {}; position={},{} and motion={},{} motion.random={}", - ent, pos.location.x, pos.location.y, - motion.dx, motion.dy, motion.random); - REQUIRE(pos.location.x == 10); - REQUIRE(pos.location.y == 5); - REQUIRE(motion.dx == 0); - REQUIRE(motion.dy == 1); - REQUIRE(motion.random == false); - }); - */ + auto entity = world.entity(); + + world.set(entity, {10,10}); + world.set(entity, {1}); + world.set(entity, {0,0}); }