diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2017-12-16 19:06:43 +0100 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2017-12-16 19:06:43 +0100 |
commit | 820e2e9d428c273e065cfe18b48c183a5cbedd75 (patch) | |
tree | e20a60780ecb4d7dbc53a641bdd86d3407c29577 /src/world.cpp | |
parent | c341559390ce52b47d056226fc102287dc41b304 (diff) |
Major refactor of game's entity code.
Diffstat (limited to 'src/world.cpp')
-rw-r--r-- | src/world.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/world.cpp b/src/world.cpp index 1975b4e..a5e8869 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -375,7 +375,7 @@ void entity_t::link_to_sector(sector_t *sector) sector->ents.insert(this); } -void entity_t::link(world_t *world) +void entity_t::link(world_t *world_) { rectf_t total_bounds; float fx, fy; @@ -383,6 +383,11 @@ void entity_t::link(world_t *world) float xlip, ylip; size_t xsecs, ysecs; + if (world) + unlink(); + + world = world_; + total_bounds = cmodel.bounds | render_bounds; fx = floor(total_bounds[0][0]); @@ -425,7 +430,7 @@ void entity_t::unlink(void) } parents.clear(); - parent_world = nullptr; + world = 0; } } // namespace world |