MCPcopy Create free account
hub / github.com/MergHQ/CRYENGINE / LoadInternalState

Method LoadInternalState

Code/CryEngine/CryEntitySystem/EntitySystem.cpp:2872–3052  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2870}
2871
2872void CEntitySystem::LoadInternalState(IDataReadStream& reader)
2873{
2874 // get layers in the level
2875 std::vector<CEntityLayer*> allLayers;
2876 for (TLayers::iterator it = m_layers.begin();
2877 it != m_layers.end(); ++it)
2878 {
2879 CEntityLayer* pLayer = it->second;
2880 allLayers.push_back(pLayer);
2881 }
2882
2883 // enable layers that are explicitly listed
2884 const uint32 numLayers = reader.ReadUint32();
2885 for (uint32 i = 0; i < numLayers; ++i)
2886 {
2887 const string layerName = reader.ReadString();
2888
2889 // find local layer
2890 CEntityLayer* pLayer = NULL;
2891 for (TLayers::iterator it = m_layers.begin();
2892 it != m_layers.end(); ++it)
2893 {
2894 if (it->second->GetName() == layerName)
2895 {
2896 pLayer = it->second;
2897 break;
2898 }
2899 }
2900
2901 // No layer found
2902 if (NULL == pLayer)
2903 {
2904 gEnv->pLog->LogAlways("Layer with name '%s' not found in local data",
2905 layerName.c_str());
2906 continue;
2907 }
2908
2909 // remove from the "all layers" list - what's left will be hidden
2910 std::vector<CEntityLayer*>::iterator it = std::find(allLayers.begin(), allLayers.end(), pLayer);
2911 if (it != allLayers.end())
2912 {
2913 allLayers.erase(it);
2914 }
2915
2916 pLayer->Enable(true, false, false); // NON RECURSIVE
2917
2918 // show/hide the objects also
2919 if (pLayer->GetId() != 0)
2920 {
2921 gEnv->p3DEngine->ActivateObjectsLayer(pLayer->GetId(), true, true, true, true, pLayer->GetName(), NULL, false);
2922 }
2923 }
2924
2925 // Hide rest of the layers
2926 for (std::vector<CEntityLayer*>::const_iterator it = allLayers.begin();
2927 it != allLayers.end(); ++it)
2928 {
2929 CEntityLayer* pLayer = *it;

Callers

nothing calls this directly

Calls 15

GetEntityFunction · 0.85
strcmpFunction · 0.85
ReadUint32Method · 0.80
IsLoadedFromLevelFileMethod · 0.80
CreateXmlNodeMethod · 0.80
ReadUint64Method · 0.80
SkipStringMethod · 0.80
findFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45
ReadStringMethod · 0.45

Tested by

no test coverage detected