MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / loadTilesetValues

Method loadTilesetValues

source/utils/ConfigManager.cpp:1163–1209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1161}
1162
1163bool ConfigManager::loadTilesetValues(std::istream& defFile, TileVisual tileVisual, std::vector<TileSetValue>& tileValues)
1164{
1165 std::string nextParam;
1166 std::string beginTag = "[" + Tile::tileVisualToString(tileVisual) + "]";
1167 std::string endTag = "[/" + Tile::tileVisualToString(tileVisual) + "]";
1168 defFile >> nextParam;
1169 if (nextParam != beginTag)
1170 {
1171 OD_LOG_ERR("Expecting " + beginTag + " tag but got=" + nextParam);
1172 return false;
1173 }
1174 while(true)
1175 {
1176 std::string indexStr;
1177 defFile >> indexStr;
1178 if(indexStr == endTag)
1179 return true;
1180
1181 boost::dynamic_bitset<> x(indexStr);
1182 uint32_t index = static_cast<int>(x.to_ulong());
1183
1184 std::string meshName;
1185 defFile >> meshName;
1186
1187 std::string materialName;
1188 defFile >> materialName;
1189 if(materialName.compare("''") == 0)
1190 materialName.clear();
1191
1192 double rotX;
1193 defFile >> rotX;
1194
1195 double rotY;
1196 defFile >> rotY;
1197
1198 double rotZ;
1199 defFile >> rotZ;
1200
1201 if(index >= tileValues.size())
1202 {
1203 OD_LOG_ERR("Tileset index too high in tileset=" + endTag + ", index=" + indexStr);
1204 return false;
1205 }
1206
1207 tileValues[index] = TileSetValue(meshName, materialName, rotX, rotY, rotZ);
1208 }
1209}
1210
1211void ConfigManager::loadUserConfig(const std::string& fileName)
1212{

Callers

nothing calls this directly

Calls 2

clearMethod · 0.80
TileSetValueClass · 0.70

Tested by

no test coverage detected