Ejemplo n.º 1
0
// Activate the token group following the standard.
void MHTokenGroup::Activation(MHEngine *engine)
{
    if (m_fRunning)
    {
        return;
    }

    MHPresentable::Activation(engine);

    // We're supposed to apply Activation to each of the "items" but it isn't clear
    // exactly what that means.  Assume it means each of the visibles.
    for (int i = 0; i < m_TokenGrpItems.Size(); i++)
    {
        MHObjectRef *pObject = &m_TokenGrpItems.GetAt(i)->m_Object;

        // The object reference may be the null reference.
        // Worse: it seems that sometimes in BBC's MHEG the reference simply doesn't exist.
        if (pObject->IsSet())
        {
            try
            {
                engine->FindObject(m_TokenGrpItems.GetAt(i)->m_Object)->Activation(engine);
            }
            catch (char const *) {}
        }
    }

    engine->EventTriggered(this, EventTokenMovedTo, m_nTokenPosition);
    m_fRunning = true;
    engine->EventTriggered(this, EventIsRunning);
}
Ejemplo n.º 2
0
// Fix for MHActionGenericObjectRef
void MHActionGenericObjectRefFix::Perform(MHEngine *engine)
{
    MHObjectRef ref;
    if (m_RefObject.m_fIsDirect)
        m_RefObject.GetValue(ref, engine);
    else
        ref.Copy(*m_RefObject.GetReference());
    CallAction(engine, Target(engine), engine->FindObject(ref));
}
Ejemplo n.º 3
0
// Return the value, looking up any indirect ref.
void MHGenericObjectRef::GetValue(MHObjectRef &ref, MHEngine *engine) const
{
    if (m_fIsDirect) ref.Copy(m_ObjRef);
    else {
        MHUnion result;
        MHRoot *pBase = engine->FindObject(m_Indirect);
        pBase->GetVariableValue(result, engine);
        result.CheckType(MHUnion::U_ObjRef);
        ref.Copy(result.m_ObjRefVal);
    }
}
Ejemplo n.º 4
0
void MHPersistent::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHElemAction::Initialise(p, engine); // Target
    m_Succeeded.Initialise(p->GetArgN(1), engine);
    MHParseNode *pVarSeq = p->GetArgN(2);
    for (int i = 0; i < pVarSeq->GetSeqCount(); i++) {
        MHObjectRef *pVar = new MHObjectRef;
        m_Variables.Append(pVar);
        pVar->Initialise(pVarSeq->GetSeqN(i), engine);
    }
    m_FileName.Initialise(p->GetArgN(3), engine);
}
Ejemplo n.º 5
0
// Return the value, looking up any indirect ref.
void MHGenericObjectRef::GetValue(MHObjectRef &ref, MHEngine *engine) const
{
    if (m_fIsDirect)
    {
        ref.Copy(m_ObjRef);
    }
    else
    {
        // LVR - Hmm I don't think this is right. Should be: ref.Copy(m_Indirect);
        // But it's used in several places so workaround in Stream::MHActionGenericObjectRefFix
        MHUnion result;
        MHRoot *pBase = engine->FindObject(m_Indirect);
        pBase->GetVariableValue(result, engine);
        result.CheckType(MHUnion::U_ObjRef);
        ref.Copy(result.m_ObjRefVal);
    }
}