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/world.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/world.cpp') 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 -- cgit