| 236 | } |
| 237 | |
| 238 | void 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 | ////////////////////////////////////////////////////////////////////////// |
nothing calls this directly
no test coverage detected