void CTownHandler::loadBuildings(CTown &town, const JsonNode & source) { BOOST_FOREACH(const JsonNode &node, source.Vector()) { loadBuilding(town, node); } }
// ------------------------------------ setup void FerryBuilding::setupBuilding(string fileToLoad) { selectedFile = 0; fileCount = 0; bSaved = true; bFirstPoint = true; bEnable = false; file = fileToLoad; loadBuilding(fileToLoad); /* // list all files for buildings fileLister.allowExt("xml"); int numFiles = fileLister.listDir(fileToLoad); if(numFiles > 0) { for(int i=0; i<numFiles; i++) { files.push_back(fileLister.getName(i)); fileCount ++; } selectedFile = 0; // load the building from xml loadBuilding(files[0]); } */ }
void CTownHandler::loadBuildings(CTown &town, const JsonNode & source) { if (source.getType() == JsonNode::DATA_VECTOR) { for(auto &node : source.Vector()) { if (!node.isNull()) loadBuilding(town, node); } } else { for(auto &node : source.Struct()) { if (!node.second.isNull()) loadBuilding(town, node.second); } } }