2020-08-22 22:30:12 -04:00
|
|
|
/*!
|
|
|
|
* @file main.cpp
|
|
|
|
* Main for the game. Launches the runtime.
|
|
|
|
*/
|
2020-10-11 19:55:29 -04:00
|
|
|
|
|
|
|
#include <string>
|
2020-08-22 22:30:12 -04:00
|
|
|
#include "runtime.h"
|
|
|
|
#include "common/versions.h"
|
2021-01-06 12:16:39 -05:00
|
|
|
#include "common/log/log.h"
|
|
|
|
#include "common/util/FileUtil.h"
|
2022-02-07 23:53:36 -05:00
|
|
|
#include "game/discord.h"
|
|
|
|
|
|
|
|
// Discord RPC
|
|
|
|
extern int64_t gStartTime;
|
2020-08-22 22:30:12 -04:00
|
|
|
|
2020-10-11 19:55:29 -04:00
|
|
|
void setup_logging(bool verbose) {
|
2021-01-06 12:16:39 -05:00
|
|
|
lg::set_file(file_util::get_file_path({"log/game.txt"}));
|
2020-10-11 19:55:29 -04:00
|
|
|
if (verbose) {
|
2021-02-21 11:02:28 -05:00
|
|
|
lg::set_file_level(lg::level::debug);
|
|
|
|
lg::set_stdout_level(lg::level::debug);
|
|
|
|
lg::set_flush_level(lg::level::debug);
|
2020-10-11 19:55:29 -04:00
|
|
|
} else {
|
2021-01-06 12:16:39 -05:00
|
|
|
lg::set_file_level(lg::level::warn);
|
|
|
|
lg::set_stdout_level(lg::level::warn);
|
|
|
|
lg::set_flush_level(lg::level::warn);
|
2020-10-11 19:55:29 -04:00
|
|
|
}
|
2021-01-06 12:16:39 -05:00
|
|
|
lg::initialize();
|
2020-10-11 19:55:29 -04:00
|
|
|
}
|
2020-10-06 18:03:33 -04:00
|
|
|
|
2020-10-11 19:55:29 -04:00
|
|
|
int main(int argc, char** argv) {
|
|
|
|
bool verbose = false;
|
|
|
|
for (int i = 1; i < argc; i++) {
|
|
|
|
if (std::string("-v") == argv[i]) {
|
|
|
|
verbose = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-07 23:53:36 -05:00
|
|
|
gStartTime = time(0);
|
|
|
|
init_discord_rpc();
|
|
|
|
|
2020-10-11 19:55:29 -04:00
|
|
|
setup_logging(verbose);
|
|
|
|
|
|
|
|
while (true) {
|
2020-08-22 22:30:12 -04:00
|
|
|
// run the runtime in a loop so we can reset the game and have it restart cleanly
|
2021-01-06 12:16:39 -05:00
|
|
|
lg::info("OpenGOAL Runtime {}.{}", versions::GOAL_VERSION_MAJOR, versions::GOAL_VERSION_MINOR);
|
2020-10-01 18:08:23 -04:00
|
|
|
|
2020-09-06 16:58:25 -04:00
|
|
|
if (exec_runtime(argc, argv) == 2) {
|
|
|
|
return 0;
|
|
|
|
}
|
2020-08-22 22:30:12 -04:00
|
|
|
}
|
|
|
|
return 0;
|
2020-10-01 12:27:58 -04:00
|
|
|
}
|