SGSubsystemGroup::SGSubsystemGroup () :
_fixedUpdateTime(-1.0),
_updateTimeRemainder(0.0),
- _initPosition(-1)
+ _initPosition(0)
{
}
SGSubsystem::InitStatus
SGSubsystemGroup::incrementalInit()
{
- if (_initPosition < 0)
- _initPosition = 0;
-
if (_initPosition >= _members.size())
return INIT_DONE;
// reverse order to prevent order dependency problems
for (unsigned int i = _members.size(); i > 0; i--)
_members[i-1]->subsystem->shutdown();
- _initPosition = -1;
+ _initPosition = 0;
}
void
SGSubsystemMgr::SGSubsystemMgr () :
- _initPosition(-1)
+ _initPosition(0)
{
for (int i = 0; i < MAX_GROUPS; i++) {
_groups[i] = new SGSubsystemGroup;
SGSubsystem::InitStatus
SGSubsystemMgr::incrementalInit()
{
- if (_initPosition < 0)
- _initPosition = 0;
-
if (_initPosition >= MAX_GROUPS)
return INIT_DONE;
for (int i = MAX_GROUPS-1; i >= 0; i--)
_groups[i]->shutdown();
- _initPosition = -1;
+ _initPosition = 0;
}
double _updateTimeRemainder;
/// index of the member we are currently init-ing
- int _initPosition;
+ unsigned int _initPosition;
};
private:
SGSubsystemGroup* _groups[MAX_GROUPS];
- int _initPosition;
+ unsigned int _initPosition;
typedef std::map<std::string, SGSubsystem*> SubsystemDict;
SubsystemDict _subsystem_map;