Refactor things so that individual subsystems can override suspension.
This commit is contained in:
parent
58adf467bf
commit
e1bb9b67f5
1 changed files with 10 additions and 15 deletions
|
@ -115,16 +115,13 @@ FGSubsystemGroup::unbind ()
|
|||
void
|
||||
FGSubsystemGroup::update (double delta_time_sec)
|
||||
{
|
||||
if (!is_suspended()) {
|
||||
for (int i = 0; i < _members.size(); i++)
|
||||
_members[i]->update(delta_time_sec); // indirect call
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
FGSubsystemGroup::suspend ()
|
||||
{
|
||||
FGSubsystem::suspend();
|
||||
for (int i = 0; i < _members.size(); i++)
|
||||
_members[i]->subsystem->suspend();
|
||||
}
|
||||
|
@ -132,7 +129,6 @@ FGSubsystemGroup::suspend ()
|
|||
void
|
||||
FGSubsystemGroup::resume ()
|
||||
{
|
||||
FGSubsystem::resume();
|
||||
for (int i = 0; i < _members.size(); i++)
|
||||
_members[i]->subsystem->resume();
|
||||
}
|
||||
|
@ -140,7 +136,7 @@ FGSubsystemGroup::resume ()
|
|||
bool
|
||||
FGSubsystemGroup::is_suspended () const
|
||||
{
|
||||
return FGSubsystem::is_suspended();
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -229,10 +225,12 @@ FGSubsystemGroup::Member::update (double delta_time_sec)
|
|||
{
|
||||
elapsed_sec += delta_time_sec;
|
||||
if (elapsed_sec >= min_step_sec) {
|
||||
if (!subsystem->is_suspended()) {
|
||||
subsystem->update(delta_time_sec);
|
||||
elapsed_sec -= min_step_sec;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -280,8 +278,7 @@ FGSubsystemMgr::unbind ()
|
|||
void
|
||||
FGSubsystemMgr::update (double delta_time_sec)
|
||||
{
|
||||
if (!is_suspended()) {
|
||||
for (int i = 0; i < MAX_GROUPS; i++)
|
||||
for (int i = 0; i < MAX_GROUPS; i++) {
|
||||
_groups[i].update(delta_time_sec);
|
||||
}
|
||||
}
|
||||
|
@ -289,7 +286,6 @@ FGSubsystemMgr::update (double delta_time_sec)
|
|||
void
|
||||
FGSubsystemMgr::suspend ()
|
||||
{
|
||||
FGSubsystem::suspend();
|
||||
for (int i = 0; i < MAX_GROUPS; i++)
|
||||
_groups[i].suspend();
|
||||
}
|
||||
|
@ -297,7 +293,6 @@ FGSubsystemMgr::suspend ()
|
|||
void
|
||||
FGSubsystemMgr::resume ()
|
||||
{
|
||||
FGSubsystem::resume();
|
||||
for (int i = 0; i < MAX_GROUPS; i++)
|
||||
_groups[i].resume();
|
||||
}
|
||||
|
@ -305,7 +300,7 @@ FGSubsystemMgr::resume ()
|
|||
bool
|
||||
FGSubsystemMgr::is_suspended () const
|
||||
{
|
||||
return FGSubsystem::is_suspended();
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Add table
Reference in a new issue