From 0c2a627ec3975808cae2dc9de6a3cae88558eaa8 Mon Sep 17 00:00:00 2001 From: "Bryce \"BtheDestroyer\" Dixon" Date: Fri, 22 Mar 2019 19:08:46 -0700 Subject: [PATCH] Fixed bug where OnActivate could be called before OnStart --- src/GameState.cpp | 1 + src/Object.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/GameState.cpp b/src/GameState.cpp index 98d2187..ef889a6 100644 --- a/src/GameState.cpp +++ b/src/GameState.cpp @@ -12,6 +12,7 @@ namespace GameState GameState::GameState(Object *parent, std::string name) : Object(parent, name) { + StateName(name); } const std::string GameState::StateName() diff --git a/src/Object.cpp b/src/Object.cpp index 1f77af7..de9dcca 100644 --- a/src/Object.cpp +++ b/src/Object.cpp @@ -204,6 +204,11 @@ void Object::TriggerOnActivate() { if (!Active()) return; + if (!_started) + { + OnStart(); + _started = true; + } for (Object *c : _children) c->TriggerOnActivate(); OnActivate();