// Activation - starts running the object. Sets m_fRunning and generates IsRunning event. void MHGroup::Activation(MHEngine *engine) { if (m_fRunning) { return; } MHRoot::Activation(engine); // Run any start-up actions. engine->AddActions(m_StartUp); engine->RunActions(); // Activate the ingredients in order. for (int i = 0; i < m_Items.Size(); i++) { MHIngredient *pIngredient = m_Items.GetAt(i); if (pIngredient->InitiallyActive()) { pIngredient->Activation(engine); } } m_fRunning = true; // Record the time here. This is the basis for absolute times. m_StartTime.start(); // Don't generate IsRunning here - that's done by the sub-classes. }
// Preparation - sets up the run-time representation. Sets m_fAvailable and generates IsAvailable event. void MHGroup::Preparation(MHEngine *engine) { // Prepare the ingredients first if they are initially active or are initially available programs. for (int i = 0; i < m_Items.Size(); i++) { MHIngredient *pIngredient = m_Items.GetAt(i); if (pIngredient->InitiallyActive() || pIngredient->InitiallyAvailable()) { pIngredient->Preparation(engine); } } MHRoot::Preparation(engine); // Prepare the root object and send the IsAvailable event. }