diff --git a/dChatServer/ChatPacketHandler.cpp b/dChatServer/ChatPacketHandler.cpp index 737bbba4..899fd355 100644 --- a/dChatServer/ChatPacketHandler.cpp +++ b/dChatServer/ChatPacketHandler.cpp @@ -354,7 +354,7 @@ void ChatPacketHandler::HandleTeamInvite(Packet* packet) if (team->memberIDs.size() > 3) { // no more teams greater than 4 - Game::logger->Log("ChatPacketHandler", "Someone tried to invite a 5th player to a team"); + Game::logger->Log("ChatPacketHandler", "Someone tried to invite a 5th player to a team\n"); return; } diff --git a/dDatabase/Database.cpp b/dDatabase/Database.cpp index 23fed182..cdadbbaa 100644 --- a/dDatabase/Database.cpp +++ b/dDatabase/Database.cpp @@ -28,7 +28,7 @@ void Database::Connect(const string& host, const string& database, const string& void Database::Destroy() { if (!con) return; - cout << "Destroying MySQL connection!" << endl; + Game::logger->Log("Database", "Destroying MySQL connection!\n"); con->close(); delete con; } //Destroy diff --git a/dGame/dBehaviors/VerifyBehavior.cpp b/dGame/dBehaviors/VerifyBehavior.cpp index 71f75a18..f4edfece 100644 --- a/dGame/dBehaviors/VerifyBehavior.cpp +++ b/dGame/dBehaviors/VerifyBehavior.cpp @@ -23,7 +23,7 @@ void VerifyBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS if (self == nullptr) { - Game::logger->Log("VerifyBehavior", "Invalid self for (%llu)", context->originator); + Game::logger->Log("VerifyBehavior", "Invalid self for (%llu)\n", context->originator); return; } diff --git a/dGame/dGameMessages/GameMessages.cpp b/dGame/dGameMessages/GameMessages.cpp index 1df0a3f2..cd7910b4 100644 --- a/dGame/dGameMessages/GameMessages.cpp +++ b/dGame/dGameMessages/GameMessages.cpp @@ -5672,7 +5672,7 @@ void GameMessages::HandleDoneArrangingWithItem(RakNet::BitStream* inStream, Enti return; } - Game::logger->Log("GameMessages", "Build area found: %llu", buildArea->GetObjectID()); + Game::logger->Log("GameMessages", "Build area found: %llu\n", buildArea->GetObjectID()); GameMessages::SendStartArrangingWithItem( character, diff --git a/dMasterServer/MasterServer.cpp b/dMasterServer/MasterServer.cpp index f16e791d..cb968169 100644 --- a/dMasterServer/MasterServer.cpp +++ b/dMasterServer/MasterServer.cpp @@ -645,7 +645,7 @@ void HandlePacket(Packet* packet) { } case MSG_MASTER_SHUTDOWN_UNIVERSE: { - Game::logger->Log("MasterServer","Received shutdown universe command, ""shutting down in 10 minutes.\n"); + Game::logger->Log("MasterServer","Received shutdown universe command, shutting down in 10 minutes.\n"); shouldShutdown = true; break; } @@ -707,7 +707,7 @@ void ShutdownSequence() { auto* objIdManager = ObjectIDManager::TryInstance(); if (objIdManager != nullptr) { objIdManager->SaveToDatabase(); - printf("Saved objidtracker...\n"); + Game::logger->Log("MasterServer", "Saved ObjectIDTracker to DB\n"); } auto t = std::chrono::high_resolution_clock::now(); @@ -717,7 +717,8 @@ void ShutdownSequence() { exit(0); } - printf("Attempting to shutdown instances, max 60 seconds...\n"); + Game::logger->Log("MasterServer", "Attempting to shutdown instances, max 60 seconds...\n"); + while (true) { auto done = true; diff --git a/dNet/dServer.cpp b/dNet/dServer.cpp index df366955..27b6df7c 100644 --- a/dNet/dServer.cpp +++ b/dNet/dServer.cpp @@ -104,13 +104,13 @@ Packet* dServer::ReceiveFromMaster() { if (packet->length < 1) { mMasterPeer->DeallocatePacket(packet); return nullptr; } if (packet->data[0] == ID_DISCONNECTION_NOTIFICATION || packet->data[0] == ID_CONNECTION_LOST) { - mLogger->Log("Server", "Lost our connection to master, shutting DOWN!\n"); + mLogger->Log("dServer", "Lost our connection to master, shutting DOWN!\n"); mMasterConnectionActive = false; //ConnectToMaster(); //We'll just shut down now } if (packet->data[0] == ID_CONNECTION_REQUEST_ACCEPTED) { - mLogger->Log("Server", "Established connection to master\n"); + mLogger->Log("dServer", "Established connection to master, zone (%i), instance (%i)\n",this->GetZoneID(), this->GetInstanceID()); mMasterConnectionActive = true; mMasterSystemAddress = packet->systemAddress; MasterPackets::SendServerInfo(this, packet); @@ -127,6 +127,7 @@ Packet* dServer::ReceiveFromMaster() { //When we handle these packets in World instead dServer, we just return the packet's pointer. default: + return packet; } } diff --git a/dWorldServer/WorldServer.cpp b/dWorldServer/WorldServer.cpp index 520907ff..2a6cbaa5 100644 --- a/dWorldServer/WorldServer.cpp +++ b/dWorldServer/WorldServer.cpp @@ -475,7 +475,7 @@ int main(int argc, char** argv) { if (framesSinceMasterStatus >= 200) { - Game::logger->Log("WorldServer", "Finished loading world, ready up!\n"); + Game::logger->Log("WorldServer", "Finished loading world with zone (%i), ready up!\n", Game::server->GetZoneID()); MasterPackets::SendWorldReady(Game::server, Game::server->GetZoneID(), Game::server->GetInstanceID()); @@ -546,7 +546,7 @@ int main(int argc, char** argv) { if (Game::physicsWorld) Game::physicsWorld = nullptr; if (Game::zoneManager) delete Game::zoneManager; - Game::logger->Log("Test", "Quitting\n"); + Game::logger->Log("WorldServer", "Shutdown complete, zone (%i), instance (%i)\n", Game::server->GetZoneID(), instanceID); Metrics::Clear(); Database::Destroy(); @@ -573,13 +573,13 @@ dLogger * SetupLogger(int zoneID, int instanceID) { void HandlePacketChat(Packet* packet) { if (packet->data[0] == ID_DISCONNECTION_NOTIFICATION || packet->data[0] == ID_CONNECTION_LOST) { - Game::logger->Log("WorldServer", "Lost our connection to chat.\n"); - + Game::logger->Log("WorldServer", "Lost our connection to chat, zone(%i), instance(%i)\n", Game::server->GetZoneID(), Game::server->GetInstanceID()); + chatConnected = false; } if (packet->data[0] == ID_CONNECTION_REQUEST_ACCEPTED) { - Game::logger->Log("WorldServer", "Established connection to chat\n"); + Game::logger->Log("WorldServer", "Established connection to chat, zone(%i), instance (%i)\n",Game::server -> GetZoneID(), Game::server -> GetInstanceID()); Game::chatSysAddr = packet->systemAddress; chatConnected = true; @@ -863,7 +863,7 @@ void HandlePacket(Packet* packet) { case MSG_MASTER_SHUTDOWN: { worldShutdownSequenceStarted = true; - Game::logger->Log("WorldServer", "Got shutdown request\n"); + Game::logger->Log("WorldServer", "Got shutdown request from master, zone (%i), instance (%i)\n", Game::server->GetZoneID(), Game::server->GetInstanceID()); break; } @@ -1186,11 +1186,11 @@ void HandlePacket(Packet* packet) { } } else { - Game::logger->Log("WorldMain", "Couldn't find character to log in with for user %s (%i)!\n", user->GetUsername().c_str(), user->GetAccountID()); + Game::logger->Log("WorldServer", "Couldn't find character to log in with for user %s (%i)!\n", user->GetUsername().c_str(), user->GetAccountID()); Game::server->Disconnect(packet->systemAddress, SERVER_DISCON_CHARACTER_NOT_FOUND); } } else { - Game::logger->Log("WorldMain", "Couldn't get user for level load complete!\n"); + Game::logger->Log("WorldServer", "Couldn't get user for level load complete!\n"); } break; } @@ -1296,7 +1296,7 @@ void WorldShutdownSequence() auto t = std::chrono::high_resolution_clock::now(); auto ticks = 0; - printf("Attempting to shutdown world, max 10 seconds...");; + Game::logger->Log("WorldServer", "Attempting to shutdown world, zone (%i), instance (%i), max 10 seconds...\n", Game::server->GetZoneID(), instanceID); while (true) {