From 0af3ce965a75ef8aa1c365d40166dfd50b1496a1 Mon Sep 17 00:00:00 2001 From: Vsevolod Kremianskii Date: Mon, 16 Nov 2020 13:41:25 +0700 Subject: [PATCH] fix: Make Trigger call SpatialObject::update --- src/game/object/area.cpp | 1 + src/game/object/trigger.cpp | 3 ++- src/game/object/trigger.h | 1 - 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/game/object/area.cpp b/src/game/object/area.cpp index e6794103..57dda4b4 100644 --- a/src/game/object/area.cpp +++ b/src/game/object/area.cpp @@ -776,6 +776,7 @@ void Area::checkTriggersIntersection(SpatialObject &triggerrer) { if (trigger.distanceTo(position2d) > kMaxDistanceToTestCollision) continue; if (trigger.isTenant(triggererPtr) || !trigger.isIn(position2d)) continue; + debug(boost::format("Trigger %s triggerred by %s") % trigger.tag() % triggerrer.tag()); trigger.addTenant(triggererPtr); if (!trigger.linkedToModule().empty()) { diff --git a/src/game/object/trigger.cpp b/src/game/object/trigger.cpp index 860c0a82..8fe6a8a8 100644 --- a/src/game/object/trigger.cpp +++ b/src/game/object/trigger.cpp @@ -81,11 +81,12 @@ void Trigger::update(float dt) { tenantsToRemove.insert(tenant); } for (auto &tenant : tenantsToRemove) { + _tenants.erase(tenant); if (!_blueprint->onExit().empty()) { runScript(_blueprint->onExit(), id(), tenant->id(), -1); } - _tenants.erase(tenant); } + SpatialObject::update(dt); } bool Trigger::isIn(const glm::vec2 &point) const { diff --git a/src/game/object/trigger.h b/src/game/object/trigger.h index 5b71bc1e..6d2f5300 100644 --- a/src/game/object/trigger.h +++ b/src/game/object/trigger.h @@ -48,7 +48,6 @@ public: private: std::shared_ptr _blueprint; - std::string _tag; std::string _transitionDestin; std::string _linkedToModule; std::string _linkedTo;