60 lines
1.3 KiB
C++
60 lines
1.3 KiB
C++
/**
|
|
* \file main.cpp
|
|
* \brief Univerxel game
|
|
* \author Shu
|
|
* \version 0.0.2
|
|
*
|
|
* Univerxel main program.
|
|
*/
|
|
|
|
#include "client/Client.hpp"
|
|
#include "server/Server.hpp"
|
|
#include "client/srvContainer.hpp"
|
|
#include "core/options_full.hpp"
|
|
#include "core/utils/tracy.hpp"
|
|
#include "core/utils/logger.hpp"
|
|
#include "version.h"
|
|
|
|
|
|
/// Entry point
|
|
int main(int argc, char *argv[]){
|
|
LOG("Univerxel " << UNIVERXEL_VERSION);
|
|
|
|
#if TRACY_ENABLE
|
|
LOG("Profiling !");
|
|
#endif
|
|
|
|
auto options = config::options(argc > 1 ? argv[1] : config::DEFAULT_FILE);
|
|
options.save();
|
|
|
|
world::module::Registry::Load();
|
|
|
|
if (options.hasClient()) {
|
|
#if TRACY_ENABLE
|
|
tracy::SetThreadName("Client");
|
|
#endif
|
|
ServerFactory* srvContainer = options.hasServer() ?
|
|
new ServerFactory(options.getServer()) : nullptr;
|
|
|
|
auto client = Client(options.getClient(), srvContainer);
|
|
client.run();
|
|
|
|
delete srvContainer;
|
|
} else if (options.hasServer()) {
|
|
#if TRACY_ENABLE
|
|
tracy::SetThreadName("Server");
|
|
#endif
|
|
LOG_I("Running only server");
|
|
auto server = Server(options.getServer());
|
|
server.run();
|
|
} else {
|
|
FATAL("Nothing to start");
|
|
}
|
|
|
|
options.save();
|
|
world::module::Registry::Unload();
|
|
|
|
options.save();
|
|
|
|
return 0;
|
|
} |