From 820e2e9d428c273e065cfe18b48c183a5cbedd75 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Sat, 16 Dec 2017 19:06:43 +0100 Subject: Major refactor of game's entity code. --- src/common.hpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/common.hpp') diff --git a/src/common.hpp b/src/common.hpp index f543ca5..eaed590 100644 --- a/src/common.hpp +++ b/src/common.hpp @@ -129,7 +129,6 @@ namespace world { }; class entity_t { - world_t *parent_world; std::vector parents; void link_to_sector(sector_t *sector); @@ -139,12 +138,14 @@ namespace world { size_t cookie = 0; public: + world_t *world = 0; int type; cmodel_t cmodel; rectf_t render_bounds; int render_layer = 0; entity_t(int type_); + ~entity_t(void) {}; void link(world_t *world); void unlink(); @@ -189,6 +190,7 @@ namespace interface { namespace game { bool load_assets(void); + class entity_t; class unit_t; class effect_t; @@ -203,11 +205,11 @@ namespace game { }; class state_t { - std::unordered_set units; - std::unordered_set selected_units; - std::unordered_set awake_units; + protected: + friend entity_t; - std::unordered_set effects; + std::unordered_set awake_entities; + std::unordered_set selected_units; procgen::prng_t dice_prng; public: @@ -225,7 +227,7 @@ namespace game { size_t roll(roll_params_t *P); - void add_effect(effect_t *effect); + void wake_everything(v2f_t x, float range); }; } -- cgit