void CLiteObjectMgr::Load(ILTMessage_Read *pMsg) { // Get rid of the old stuff... Clear(); // Read the active object count uint32 nNumActiveObjectsRemaining = pMsg->Readuint32(); m_nNumActiveObjects = nNumActiveObjectsRemaining; // Read the inactive object count uint32 nNumInactiveObjectsRemaining = pMsg->Readuint32(); m_nNumInactiveObjects = nNumInactiveObjectsRemaining; // Reserve some space m_aActiveObjects.reserve(m_nNumActiveObjects); m_aInactiveObjects.reserve(m_nNumInactiveObjects); // Load the active objects uint32 nCurSerializeID = 0; for (; nNumActiveObjectsRemaining; --nNumActiveObjectsRemaining) { m_aActiveObjects.push_back(LoadObjectInfo(pMsg, nCurSerializeID++)); ASSERT(!pMsg->EOM()); } ASSERT(nCurSerializeID == m_aActiveObjects.size()); // Load the inactive objects for (; nNumInactiveObjectsRemaining; --nNumInactiveObjectsRemaining) { m_aInactiveObjects.push_back(LoadObjectInfo(pMsg, nCurSerializeID++)); ASSERT(!pMsg->EOM()); } // Tell the active objects to load TObjectList::iterator iCurObj = m_aActiveObjects.begin(); for (; iCurObj != m_aActiveObjects.end(); ++iCurObj) { (*iCurObj)->Load(pMsg); } // Tell the inactive objects to load for (iCurObj = m_aInactiveObjects.begin(); iCurObj != m_aInactiveObjects.end(); ++iCurObj) { (*iCurObj)->Load(pMsg); } }
ObjectInfo* ObjectManager::Get(std::string Path) { ObjectInfo* objectInfo = _objectMap[Path]; if (!objectInfo) { objectInfo = LoadObjectInfo (Path); _objectMap[Path] = objectInfo; } return objectInfo; }