Skip to content

Commit 0c2a627

Browse files
committed
Fixed bug where OnActivate could be called before OnStart
1 parent abd3d94 commit 0c2a627

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/GameState.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ namespace GameState
1212
GameState::GameState(Object *parent, std::string name)
1313
: Object(parent, name)
1414
{
15+
StateName(name);
1516
}
1617

1718
const std::string GameState::StateName()

src/Object.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,11 @@ void Object::TriggerOnActivate()
204204
{
205205
if (!Active())
206206
return;
207+
if (!_started)
208+
{
209+
OnStart();
210+
_started = true;
211+
}
207212
for (Object *c : _children)
208213
c->TriggerOnActivate();
209214
OnActivate();

0 commit comments

Comments
 (0)