MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / Serialize

Method Serialize

Editor/Objects/ShapeObject.cpp:456–543  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

454
455//////////////////////////////////////////////////////////////////////////
456void CShapeObject::Serialize( CObjectArchive &ar )
457{
458 m_bIgnoreGameUpdate = true;
459 CBaseObject::Serialize( ar );
460 m_bIgnoreGameUpdate = false;
461
462 XmlNodeRef xmlNode = ar.node;
463 if (ar.bLoading)
464 {
465 m_bAreaModified = true;
466 m_bIgnoreGameUpdate = true;
467 m_entities.Clear();
468
469 GUID entityId;
470 if (xmlNode->getAttr( "EntityId",entityId ))
471 {
472 // For Backward compatability.
473 //m_entities.push_back(entityId);
474 ar.SetResolveCallback( this,entityId,functor(m_entities,&CSafeObjectsArray::Add) );
475 }
476
477 // Load Entities.
478 m_points.clear();
479 XmlNodeRef points = xmlNode->findChild( "Points" );
480 if (points)
481 {
482 for (int i = 0; i < points->getChildCount(); i++)
483 {
484 XmlNodeRef pnt = points->getChild(i);
485 Vec3 pos;
486 pnt->getAttr( "Pos",pos );
487 m_points.push_back(pos);
488 }
489 }
490 XmlNodeRef entities = xmlNode->findChild( "Entities" );
491 if (entities)
492 {
493 for (int i = 0; i < entities->getChildCount(); i++)
494 {
495 XmlNodeRef ent = entities->getChild(i);
496 GUID entityId;
497 if (ent->getAttr( "Id",entityId ))
498 {
499 //m_entities.push_back(id);
500 ar.SetResolveCallback( this,entityId,functor(m_entities,&CSafeObjectsArray::Add) );
501 }
502 }
503 }
504
505 if (ar.bUndo)
506 {
507 // Update game area only in undo mode.
508 m_bIgnoreGameUpdate = false;
509 }
510 CalcBBox();
511 UpdateGameArea();
512
513 // Update UI.

Callers

nothing calls this directly

Calls 15

functorFunction · 0.85
SetResolveCallbackMethod · 0.80
GetShapeMethod · 0.80
SetShapeMethod · 0.80
ClearMethod · 0.45
getAttrMethod · 0.45
clearMethod · 0.45
findChildMethod · 0.45
getChildCountMethod · 0.45
getChildMethod · 0.45
push_backMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected