1
0
Fork 0

Refactor things so that individual subsystems can override suspension.

This commit is contained in:
david 2003-03-01 21:29:16 +00:00
parent 58adf467bf
commit e1bb9b67f5

View file

@ -115,16 +115,13 @@ FGSubsystemGroup::unbind ()
void void
FGSubsystemGroup::update (double delta_time_sec) FGSubsystemGroup::update (double delta_time_sec)
{ {
if (!is_suspended()) {
for (int i = 0; i < _members.size(); i++) for (int i = 0; i < _members.size(); i++)
_members[i]->update(delta_time_sec); // indirect call _members[i]->update(delta_time_sec); // indirect call
} }
}
void void
FGSubsystemGroup::suspend () FGSubsystemGroup::suspend ()
{ {
FGSubsystem::suspend();
for (int i = 0; i < _members.size(); i++) for (int i = 0; i < _members.size(); i++)
_members[i]->subsystem->suspend(); _members[i]->subsystem->suspend();
} }
@ -132,7 +129,6 @@ FGSubsystemGroup::suspend ()
void void
FGSubsystemGroup::resume () FGSubsystemGroup::resume ()
{ {
FGSubsystem::resume();
for (int i = 0; i < _members.size(); i++) for (int i = 0; i < _members.size(); i++)
_members[i]->subsystem->resume(); _members[i]->subsystem->resume();
} }
@ -140,7 +136,7 @@ FGSubsystemGroup::resume ()
bool bool
FGSubsystemGroup::is_suspended () const FGSubsystemGroup::is_suspended () const
{ {
return FGSubsystem::is_suspended(); return false;
} }
void void
@ -229,10 +225,12 @@ FGSubsystemGroup::Member::update (double delta_time_sec)
{ {
elapsed_sec += delta_time_sec; elapsed_sec += delta_time_sec;
if (elapsed_sec >= min_step_sec) { if (elapsed_sec >= min_step_sec) {
if (!subsystem->is_suspended()) {
subsystem->update(delta_time_sec); subsystem->update(delta_time_sec);
elapsed_sec -= min_step_sec; elapsed_sec -= min_step_sec;
} }
} }
}
@ -280,8 +278,7 @@ FGSubsystemMgr::unbind ()
void void
FGSubsystemMgr::update (double delta_time_sec) 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); _groups[i].update(delta_time_sec);
} }
} }
@ -289,7 +286,6 @@ FGSubsystemMgr::update (double delta_time_sec)
void void
FGSubsystemMgr::suspend () FGSubsystemMgr::suspend ()
{ {
FGSubsystem::suspend();
for (int i = 0; i < MAX_GROUPS; i++) for (int i = 0; i < MAX_GROUPS; i++)
_groups[i].suspend(); _groups[i].suspend();
} }
@ -297,7 +293,6 @@ FGSubsystemMgr::suspend ()
void void
FGSubsystemMgr::resume () FGSubsystemMgr::resume ()
{ {
FGSubsystem::resume();
for (int i = 0; i < MAX_GROUPS; i++) for (int i = 0; i < MAX_GROUPS; i++)
_groups[i].resume(); _groups[i].resume();
} }
@ -305,7 +300,7 @@ FGSubsystemMgr::resume ()
bool bool
FGSubsystemMgr::is_suspended () const FGSubsystemMgr::is_suspended () const
{ {
return FGSubsystem::is_suspended(); return false;
} }
void void