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

Method LoadFromXmlRootNode

Code/CryEngine/CryAction/LevelSystem.cpp:55–128  ·  view source on GitHub ↗

------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

53
54//------------------------------------------------------------------------
55bool CLevelRotation::LoadFromXmlRootNode(const XmlNodeRef rootNode, const char* altRootTag)
56{
57 if (rootNode)
58 {
59 if (!stricmp(rootNode->getTag(), "levelrotation") || (altRootTag && !stricmp(rootNode->getTag(), altRootTag)))
60 {
61 Reset();
62
63 TRandomisationFlags randFlags = ePRF_None;
64
65 bool r = false;
66 rootNode->getAttr("randomize", r);
67 if (r)
68 {
69 randFlags |= ePRF_Shuffle;
70 }
71
72 bool pairs = false;
73 rootNode->getAttr("maintainPairs", pairs);
74 if (pairs)
75 {
76 randFlags |= ePRF_MaintainPairs;
77 }
78
79 SetRandomisationFlags(randFlags);
80
81 bool includeNonPresentLevels = false;
82 rootNode->getAttr("includeNonPresentLevels", includeNonPresentLevels);
83
84 int n = rootNode->getChildCount();
85
86 XmlNodeRef lastLevelNode;
87
88 for (int i = 0; i < n; ++i)
89 {
90 XmlNodeRef child = rootNode->getChild(i);
91 if (child && !stricmp(child->getTag(), "level"))
92 {
93 const char* levelName = child->getAttr("name");
94 if (!levelName || !levelName[0])
95 {
96 continue;
97 }
98
99 if (!includeNonPresentLevels)
100 {
101 if (!CCryAction::GetCryAction()->GetILevelSystem()->GetLevelInfo(levelName)) //skipping non-present levels
102 {
103 continue;
104 }
105 }
106
107 //capture this good level child node in case it is last
108 lastLevelNode = child;
109
110 AddLevelFromNode(levelName, child);
111 }
112 }

Calls 8

GetLevelInfoMethod · 0.80
GetILevelSystemMethod · 0.80
ResetFunction · 0.50
getTagMethod · 0.45
getAttrMethod · 0.45
getChildCountMethod · 0.45
getChildMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected