Exemplo n.º 1
0
bool CElement::LoadFromCustomData ( CLuaMain* pLuaMain, CEvents* pEvents )
{
    assert ( pLuaMain );
    assert ( pEvents );

    // Mark this as an MAP created element
    m_bMapCreated = true;

    // Read out all the attributes into our custom data records
    ReadCustomData ( pLuaMain, pEvents );

    // Grab the "id" custom data into our m_strName member
    char szBuf[MAX_ELEMENT_NAME_LENGTH + 1] = {0};
    GetCustomDataString ( "id", szBuf, MAX_ELEMENT_NAME_LENGTH, false );
    m_strName = szBuf;

    // Grab the attaching custom data
    GetCustomDataString ( "attachTo", m_szAttachToID, MAX_ELEMENT_NAME_LENGTH, true );
    GetCustomDataFloat ( "attachX", m_vecAttachedPosition.fX, true );
    GetCustomDataFloat ( "attachY", m_vecAttachedPosition.fY, true );
    GetCustomDataFloat ( "attachZ", m_vecAttachedPosition.fZ, true );

    // Load the special attributes from our custom data
    return ReadSpecialData ();
}
Exemplo n.º 2
0
bool CElement::LoadFromCustomData ( CEvents* pEvents )
{
    assert ( pEvents );

    // Read out all the attributes into our custom data records
    ReadCustomData ( pEvents );

    // Grab the "id" custom data into our m_strName member
    char szBuf[MAX_ELEMENT_NAME_LENGTH + 1] = {0};
    GetCustomDataString ( "id", szBuf, MAX_ELEMENT_NAME_LENGTH, false );
    m_strName = szBuf;

    // Grab the attaching custom data
    szBuf[0] = 0;
    GetCustomDataString ( "attachTo", szBuf, MAX_ELEMENT_NAME_LENGTH, true );
    m_strAttachToID = szBuf;
    GetCustomDataFloat ( "attachX", m_vecAttachedPosition.fX, true );
    GetCustomDataFloat ( "attachY", m_vecAttachedPosition.fY, true );
    GetCustomDataFloat ( "attachZ", m_vecAttachedPosition.fZ, true );

    // Load the special attributes from our custom data
    return ReadSpecialData ();
}