MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / init

Function init

src/Engine/Options.cpp:386–416  ·  view source on GitHub ↗

* Handles the initialization of setting up default options * and finding and loading any existing ones. * @param argc Number of arguments. * @param argv Array of argument strings. * @return Was initialized. */

Source from the content-addressed store, hash-verified

384 * @return Was initialized.
385 */
386bool init(int argc, char *argv[])
387{
388 if (showHelp(argc, argv))
389 return false;
390 create();
391 resetDefault();
392 loadArgs(argc, argv);
393 setFolders();
394 updateOptions();
395
396 std::string s = getUserFolder();
397 s += "openxcom.log";
398 Logger::logFile() = s;
399 FILE *file = fopen(Logger::logFile().c_str(), "w");
400 if (!file)
401 {
402 throw Exception(s + " not found");
403 }
404 fflush(file);
405 fclose(file);
406 Log(LOG_INFO) << "Data folder is: " << _dataFolder;
407 Log(LOG_INFO) << "Data search is: ";
408 for (std::vector<std::string>::iterator i = _dataList.begin(); i != _dataList.end(); ++i)
409 {
410 Log(LOG_INFO) << "- " << *i;
411 }
412 Log(LOG_INFO) << "User folder is: " << _userFolder;
413 Log(LOG_INFO) << "Config folder is: " << _configFolder;
414 Log(LOG_INFO) << "Options loaded successfully.";
415 return true;
416}
417
418/**
419 * Sets up the game's Data folder where the data files

Callers 15

mainFunction · 0.85
loadMethod · 0.85
loadTerminalMethod · 0.85
chooseRandomRegionMethod · 0.85
initMethod · 0.85
btnPrevClickMethod · 0.85
btnNextClickMethod · 0.85
initMethod · 0.85
initMethod · 0.85
btnPrevClickMethod · 0.85
btnNextClickMethod · 0.85
initMethod · 0.85

Calls 8

showHelpFunction · 0.85
createFunction · 0.85
resetDefaultFunction · 0.85
loadArgsFunction · 0.85
setFoldersFunction · 0.85
updateOptionsFunction · 0.85
getUserFolderFunction · 0.85
ExceptionClass · 0.85

Tested by

no test coverage detected