YAPOG  0.0.1
Yet Another Pokemon Online Game
WorldObjectReader.cpp
Go to the documentation of this file.
7 
8 namespace yap
9 {
11  WorldObject& worldObject,
12  const String& xmlRootNodeName)
13  : xmlRootNodeName_ (xmlRootNodeName)
14  , worldObject_ (worldObject)
15 
16  {
17  }
18 
20  {
21  }
22 
24  {
25  BaseReaderVisitor::Visit (visitable);
26 
27  auto reader = visitable.ChangeRoot (xmlRootNodeName_);
28 
29  if (!reader->NodeExists ("boundingBoxes"))
30  return;
31 
32  auto boundingBoxesReader = reader->ChangeRoot ("boundingBoxes");
33 
34  XmlReaderCollection boundingBoxReaders;
35  boundingBoxesReader->ReadNodes ("entry", boundingBoxReaders);
36  for (auto& xmlBoundingBoxReader : boundingBoxReaders)
37  {
38  BoundingBox* boundingBox = new BoundingBox ();
39  BoundingBoxReader boundingBoxReader (*boundingBox, "BoundingBox");
40  xmlBoundingBoxReader->Accept (boundingBoxReader);
41 
42  worldObject_.AddPhysicsBoundingBox (boundingBox);
43  }
44  }
45 } // namespace yap