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

Method WriteTable

Code/CryEngine/CrySystem/XML/SerializeXMLWriter.cpp:238–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

236}
237
238void CSerializeXMLWriterImpl::WriteTable(XmlNodeRef node, SmartScriptTable tbl, bool bCheckEntityOnScript)
239{
240 CHECK_SCRIPT_STACK;
241
242 EntityId entityId;
243 if (bCheckEntityOnScript && IsEntity(tbl, entityId))
244 {
245 node->setAttr(TAG_SCRIPT_TYPE, "entityId");
246 node->setAttr(TAG_SCRIPT_VALUE, entityId);
247 }
248 else if (IsVector(tbl))
249 {
250 Vec3 value;
251 tbl->GetValue("x", value.x);
252 tbl->GetValue("y", value.y);
253 tbl->GetValue("z", value.z);
254 node->setAttr(TAG_SCRIPT_TYPE, "vec");
255 node->setAttr(TAG_SCRIPT_VALUE, value);
256 }
257 else
258 {
259 node->setAttr(TAG_SCRIPT_TYPE, "table");
260 CHECK_SCRIPT_STACK;
261 int arrayCount = tbl->Count();
262 if (arrayCount)
263 {
264 node->setAttr("count", arrayCount);
265 CHECK_SCRIPT_STACK;
266 for (int i = 1; i <= arrayCount; i++)
267 {
268 ScriptAnyValue tempValue;
269 tbl->GetAtAny(i, tempValue);
270 if (tempValue.type != ANY_TFUNCTION && tempValue.type != ANY_TUSERDATA && tempValue.type != ANY_ANY)
271 ScriptValue(node, "i", NULL, tempValue, true);
272 }
273 }
274 else
275 {
276 CHECK_SCRIPT_STACK;
277 IScriptTable::Iterator iter = tbl->BeginIteration();
278 while (tbl->MoveNext(iter))
279 {
280 if (iter.sKey)
281 {
282 ScriptAnyValue tempValue;
283 tbl->GetValueAny(iter.sKey, tempValue);
284 if (ShouldSkipValue(iter.sKey, tempValue))
285 continue;
286 if (tempValue.type != ANY_TFUNCTION && tempValue.type != ANY_TUSERDATA && tempValue.type != ANY_ANY)
287 ScriptValue(node, "te", iter.sKey, tempValue, true);
288 }
289 }
290 tbl->EndIteration(iter);
291 }
292 }
293}
294
295//////////////////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 8

GetAtAnyMethod · 0.80
BeginIterationMethod · 0.80
GetValueAnyMethod · 0.80
EndIterationMethod · 0.80
setAttrMethod · 0.45
GetValueMethod · 0.45
CountMethod · 0.45
MoveNextMethod · 0.45

Tested by

no test coverage detected