correct exit

This commit is contained in:
EmosewaMC 2022-04-09 15:35:40 -07:00
parent 3e60b9db4a
commit d085c0cf10

View File

@ -47,6 +47,7 @@ namespace Game {
bool shutdownSequenceStarted = false; bool shutdownSequenceStarted = false;
void ShutdownSequence(); void ShutdownSequence();
int FinalizeShutdown();
dLogger* SetupLogger(); dLogger* SetupLogger();
void StartAuthServer(); void StartAuthServer();
void StartChatServer(); void StartChatServer();
@ -168,7 +169,7 @@ int main(int argc, char** argv) {
std::cout << "Account created successfully!\n"; std::cout << "Account created successfully!\n";
Database::Destroy(); Database::Destroy("MasterServer");
delete Game::logger; delete Game::logger;
return EXIT_SUCCESS; return EXIT_SUCCESS;
@ -318,14 +319,8 @@ int main(int argc, char** argv) {
t += std::chrono::milliseconds(highFrameRate); t += std::chrono::milliseconds(highFrameRate);
std::this_thread::sleep_until(t); std::this_thread::sleep_until(t);
} }
FinalizeShutdown();
//Delete our objects here: exit(0);
Database::Destroy();
delete Game::im;
delete Game::server;
delete Game::logger;
return EXIT_SUCCESS;
} }
dLogger* SetupLogger() { dLogger* SetupLogger() {
@ -787,5 +782,15 @@ void ShutdownSequence() {
} }
} }
FinalizeShutdown();
}
int FinalizeShutdown() {
//Delete our objects here:
Database::Destroy("MasterServer");
delete Game::im;
delete Game::server;
delete Game::logger;
exit(0); exit(0);
} }