diff --git a/src/game/scripting/entity.cpp b/src/game/scripting/entity.cpp index ea92eb4..a1c875a 100644 --- a/src/game/scripting/entity.cpp +++ b/src/game/scripting/entity.cpp @@ -53,6 +53,8 @@ namespace game { if (&other != this) { + this->release(); + this->context_ = other.context_; this->entity_id_ = other.entity_id_; diff --git a/src/game/scripting/scheduler.cpp b/src/game/scripting/scheduler.cpp index 4c99ab1..7d2c28a 100644 --- a/src/game/scripting/scheduler.cpp +++ b/src/game/scripting/scheduler.cpp @@ -79,7 +79,7 @@ namespace game void scheduler::remove(const task_handle& handle) { - for (const auto task : this->tasks_) + for (const auto& task : this->tasks_) { if(task->id == handle.id) {