| 1049 | } |
| 1050 | |
| 1051 | bool ConfigManager::loadTilesets(const std::string& fileName) |
| 1052 | { |
| 1053 | OD_LOG_INF("Load Tilesets file: " + fileName); |
| 1054 | std::stringstream defFile; |
| 1055 | if(!Helper::readFileWithoutComments(fileName, defFile)) |
| 1056 | { |
| 1057 | OD_LOG_ERR("Couldn't read " + fileName); |
| 1058 | return false; |
| 1059 | } |
| 1060 | |
| 1061 | std::string nextParam; |
| 1062 | defFile >> nextParam; |
| 1063 | if (nextParam != "[Tilesets]") |
| 1064 | { |
| 1065 | OD_LOG_ERR("Invalid Tilesets start format. Line was " + nextParam); |
| 1066 | return false; |
| 1067 | } |
| 1068 | |
| 1069 | while(true) |
| 1070 | { |
| 1071 | defFile >> nextParam; |
| 1072 | if (nextParam == "[/Tilesets]") |
| 1073 | break; |
| 1074 | |
| 1075 | if (nextParam == "[/Tileset]") |
| 1076 | continue; |
| 1077 | |
| 1078 | if (nextParam != "[Tileset]") |
| 1079 | { |
| 1080 | OD_LOG_ERR("Expecting TileSet tag but got=" + nextParam); |
| 1081 | return false; |
| 1082 | } |
| 1083 | |
| 1084 | defFile >> nextParam; |
| 1085 | if (nextParam != "Name") |
| 1086 | { |
| 1087 | OD_LOG_ERR("Expecting Name tag but got=" + nextParam); |
| 1088 | return false; |
| 1089 | } |
| 1090 | |
| 1091 | std::string tileSetName; |
| 1092 | defFile >> tileSetName; |
| 1093 | |
| 1094 | TileSet* tileSet = new TileSet(); |
| 1095 | mTileSets[tileSetName] = tileSet; |
| 1096 | |
| 1097 | defFile >> nextParam; |
| 1098 | if(nextParam != "[TileLink]") |
| 1099 | { |
| 1100 | OD_LOG_ERR("Expecting TileLink tag but got=" + nextParam); |
| 1101 | return false; |
| 1102 | } |
| 1103 | |
| 1104 | while(true) |
| 1105 | { |
| 1106 | defFile >> nextParam; |
| 1107 | if(nextParam == "[/TileLink]") |
| 1108 | break; |
nothing calls this directly
no test coverage detected