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

Method loadGlobalConfig

source/utils/ConfigManager.cpp:174–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174bool ConfigManager::loadGlobalConfig(const std::string& configPath)
175{
176 std::stringstream configFile;
177 std::string fileName = configPath + "global.cfg";
178 if(!Helper::readFileWithoutComments(fileName, configFile))
179 {
180 OD_LOG_ERR("Couldn't read " + fileName);
181 return false;
182 }
183
184 std::string nextParam;
185 uint32_t paramsOk = 0;
186 while(configFile.good())
187 {
188 if(!(configFile >> nextParam))
189 break;
190
191 if(nextParam == "[SeatColors]")
192 {
193 if(!loadGlobalConfigSeatColors(configFile))
194 break;
195
196 paramsOk |= 1;
197 continue;
198 }
199
200 if(nextParam == "[ConfigFiles]")
201 {
202 if(!loadGlobalConfigDefinitionFiles(configFile))
203 break;
204
205 paramsOk |= 2;
206 continue;
207 }
208
209 if(nextParam == "[GameConfig]")
210 {
211 if(!loadGlobalGameConfig(configFile))
212 break;
213
214 paramsOk |= 4;
215 continue;
216 }
217 }
218
219 if(paramsOk != 0x07)
220 {
221 OD_LOG_ERR("Not enough parameters for config file paramsOk=" + Helper::toString(paramsOk));
222 return false;
223 }
224
225 return true;
226}
227
228bool ConfigManager::loadGlobalConfigDefinitionFiles(std::stringstream& configFile)
229{

Callers

nothing calls this directly

Calls 2

readFileWithoutCommentsFunction · 0.85
toStringFunction · 0.70

Tested by

no test coverage detected