Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
dudantas authored Sep 23, 2023
2 parents 01994f1 + e63dc63 commit 1003740
Show file tree
Hide file tree
Showing 195 changed files with 6,910 additions and 6,960 deletions.
76 changes: 39 additions & 37 deletions src/canary_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,57 +52,59 @@ CanaryServer::CanaryServer(
}

int CanaryServer::run() {
g_dispatcher().addTask([this] {
try {
loadConfigLua();
g_dispatcher().addTask(
[this] {
try {
loadConfigLua();

logger.info("Server protocol: {}.{}{}", CLIENT_VERSION_UPPER, CLIENT_VERSION_LOWER, g_configManager().getBoolean(OLD_PROTOCOL) ? " and 10x allowed!" : "");
logger.info("Server protocol: {}.{}{}", CLIENT_VERSION_UPPER, CLIENT_VERSION_LOWER, g_configManager().getBoolean(OLD_PROTOCOL) ? " and 10x allowed!" : "");

rsa.start();
initializeDatabase();
loadModules();
setWorldType();
loadMaps();
rsa.start();
initializeDatabase();
loadModules();
setWorldType();
loadMaps();

logger.info("Initializing gamestate...");
g_game().setGameState(GAME_STATE_INIT);
logger.info("Initializing gamestate...");
g_game().setGameState(GAME_STATE_INIT);

setupHousesRent();
setupHousesRent();

IOMarket::checkExpiredOffers();
IOMarket::getInstance().updateStatistics();
IOMarket::checkExpiredOffers();
IOMarket::getInstance().updateStatistics();

logger.info("Loaded all modules, server starting up...");
logger.info("Loaded all modules, server starting up...");

#ifndef _WIN32
if (getuid() == 0 || geteuid() == 0) {
logger.warn("{} has been executed as root user, "
"please consider running it as a normal user",
STATUS_SERVER_NAME);
}
if (getuid() == 0 || geteuid() == 0) {
logger.warn("{} has been executed as root user, "
"please consider running it as a normal user",
STATUS_SERVER_NAME);
}
#endif

g_game().start(&serviceManager);
g_game().setGameState(GAME_STATE_NORMAL);
g_game().start(&serviceManager);
g_game().setGameState(GAME_STATE_NORMAL);

g_webhook().sendMessage("Server is now online", "Server has successfully started.", WEBHOOK_COLOR_ONLINE);
g_webhook().sendMessage("Server is now online", "Server has successfully started.", WEBHOOK_COLOR_ONLINE);

loaderDone = true;
loaderSignal.notify_all();
} catch (FailedToInitializeCanary &err) {
loadFailed = true;
logger.error(err.what());
loaderDone = true;
loaderSignal.notify_all();
} catch (FailedToInitializeCanary &err) {
loadFailed = true;
logger.error(err.what());

logger.error("The program will close after pressing the enter key...");
logger.error("The program will close after pressing the enter key...");

if (isatty(STDIN_FILENO)) {
getchar();
}
if (isatty(STDIN_FILENO)) {
getchar();
}

loaderSignal.notify_all();
}
},
"CanaryServer::run");
loaderSignal.notify_all();
}
},
"CanaryServer::run"
);

loaderSignal.wait(loaderUniqueLock, [this] { return loaderDone || loadFailed; });

Expand Down Expand Up @@ -350,7 +352,7 @@ void CanaryServer::loadModules() {

g_game().loadBoostedCreature();
g_ioBosstiary().loadBoostedBoss();
g_ioprey().InitializeTaskHuntOptions();
g_ioprey().initializeTaskHuntOptions();
}

void CanaryServer::modulesLoadHelper(bool loaded, std::string moduleName) {
Expand Down
Loading

0 comments on commit 1003740

Please sign in to comment.