From c4f49e05e3374d7cf45d0007baa91ace6ca924a5 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Fri, 19 Aug 2016 07:54:10 +0300 Subject: [PATCH] Remove manual newlines for logger --- apps/openmw-mp/Networking.cpp | 14 +++--- apps/openmw-mp/Player.cpp | 8 ++-- apps/openmw-mp/Script/Functions/Stats.cpp | 2 +- apps/openmw-mp/main.cpp | 2 +- apps/openmw/mwmp/DedicatedPlayer.cpp | 12 +++--- apps/openmw/mwmp/LocalPlayer.cpp | 6 +-- apps/openmw/mwmp/Networking.cpp | 52 +++++++++++------------ 7 files changed, 48 insertions(+), 48 deletions(-) diff --git a/apps/openmw-mp/Networking.cpp b/apps/openmw-mp/Networking.cpp index e62c4f302..153f330b4 100644 --- a/apps/openmw-mp/Networking.cpp +++ b/apps/openmw-mp/Networking.cpp @@ -80,7 +80,7 @@ void Networking::Update(RakNet::Packet *packet) if (player->isHandshaked()) { - LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Wrong handshake with player %d, name: %s\n", + LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Wrong handshake with player %d, name: %s", player->GetID(), player->Npc()->mName.c_str()); KickPlayer(player->guid); @@ -89,7 +89,7 @@ void Networking::Update(RakNet::Packet *packet) if (*player->GetPassw() != passw) { - LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Wrong server password for player %d, name: %s (pass: %s)\n", + LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Wrong server password for player %d, name: %s (pass: %s)", player->GetID(), player->Npc()->mName.c_str(), player->GetPassw()->c_str()); @@ -115,7 +115,7 @@ void Networking::Update(RakNet::Packet *packet) if (!player->isHandshaked()) { - LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Wrong auth for player %d, name: %s\n", + LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Wrong auth for player %d, name: %s", player->GetID(), player->Npc()->mName.c_str()); //KickPlayer(player->guid); @@ -148,14 +148,14 @@ void Networking::Update(RakNet::Packet *packet) } case ID_GAME_CELL: { - LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_GAME_CELL from %s\n", + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_GAME_CELL from %s", player->Npc()->mName.c_str()); if (!player->CreatureStats()->mDead) { myPacket->Read(player); - LOG_APPEND(Log::LOG_INFO, "- Moved to %s\n", + LOG_APPEND(Log::LOG_INFO, "- Moved to %s", player->GetCell()->getDescription().c_str()); myPacket->Send(player, true); //send to other clients @@ -163,7 +163,7 @@ void Networking::Update(RakNet::Packet *packet) } else { - LOG_APPEND(Log::LOG_INFO, "- Ignored because %s is dead\n", + LOG_APPEND(Log::LOG_INFO, "- Ignored because %s is dead", player->Npc()->mName.c_str()); } @@ -229,7 +229,7 @@ void Networking::Update(RakNet::Packet *packet) case ID_GAME_DIE: { - LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_GAME_DIE from %s\n", + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_GAME_DIE from %s", player->Npc()->mName.c_str()); //packetMainStats.Read(player); diff --git a/apps/openmw-mp/Player.cpp b/apps/openmw-mp/Player.cpp index 0982980a5..0cc5dab0f 100644 --- a/apps/openmw-mp/Player.cpp +++ b/apps/openmw-mp/Player.cpp @@ -10,12 +10,12 @@ TSlots Players::slots; void Players::DeletePlayer(RakNet::RakNetGUID id) { - LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Deleting player with guid %s\n", + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Deleting player with guid %s", id.ToString()); if (players[id] != 0) { - LOG_APPEND(Log::LOG_INFO, "- Emptying slot %i\n", + LOG_APPEND(Log::LOG_INFO, "- Emptying slot %i", players[id]->GetID()); slots[players[id]->GetID()] = 0; @@ -27,7 +27,7 @@ void Players::DeletePlayer(RakNet::RakNetGUID id) void Players::NewPlayer(RakNet::RakNetGUID id) { - LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Creating new player with guid %s\n", + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Creating new player with guid %s", id.ToString()); players[id] = new Player(id); @@ -40,7 +40,7 @@ void Players::NewPlayer(RakNet::RakNetGUID id) { if (slots[i] == 0) { - LOG_APPEND(Log::LOG_INFO, "- Storing in slot %i\n", + LOG_APPEND(Log::LOG_INFO, "- Storing in slot %i", i); slots[i] = players[id]; diff --git a/apps/openmw-mp/Script/Functions/Stats.cpp b/apps/openmw-mp/Script/Functions/Stats.cpp index b516b45e6..5937ce0f5 100644 --- a/apps/openmw-mp/Script/Functions/Stats.cpp +++ b/apps/openmw-mp/Script/Functions/Stats.cpp @@ -63,7 +63,7 @@ void ScriptFunctions::SetRace(unsigned short pid, const char *race) noexcept if (player->Npc()->mRace == race) return; - LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Seting race for %s: %s -> %s\n", + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Seting race for %s: %s -> %s", player->Npc()->mName.c_str(), player->Npc()->mRace.c_str(), race); diff --git a/apps/openmw-mp/main.cpp b/apps/openmw-mp/main.cpp index f84a14b18..9e6881884 100644 --- a/apps/openmw-mp/main.cpp +++ b/apps/openmw-mp/main.cpp @@ -158,7 +158,7 @@ int main(int argc, char *argv[]) if (RakNet::NonNumericHostString(addr.c_str())) { - LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "%s", "You cannot use non numeric addresses for server."); + LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "%s", "You cannot use non-numeric addresses for the server."); return 1; } diff --git a/apps/openmw/mwmp/DedicatedPlayer.cpp b/apps/openmw/mwmp/DedicatedPlayer.cpp index caf4def0c..37630e2cd 100644 --- a/apps/openmw/mwmp/DedicatedPlayer.cpp +++ b/apps/openmw/mwmp/DedicatedPlayer.cpp @@ -43,7 +43,7 @@ MWWorld::Ptr DedicatedPlayer::getPtr() void Players::CreatePlayer(RakNet::RakNetGUID id) { - LOG_APPEND(Log::LOG_INFO, "%s", "- Setting up character info\n"); + LOG_APPEND(Log::LOG_INFO, "%s", "- Setting up character info"); MWBase::World *world = MWBase::Environment::get().getWorld(); MWWorld::Ptr player = world->getPlayerPtr(); @@ -74,7 +74,7 @@ void Players::CreatePlayer(RakNet::RakNetGUID id) if (_player->state == 0) { - LOG_APPEND(Log::LOG_INFO, "- Creating new reference pointer for %s\n", + LOG_APPEND(Log::LOG_INFO, "- Creating new reference pointer for %s", _player->Npc()->mName.c_str()); MWWorld::Ptr tmp = world->placeObject(_player->reference->getPtr(), cellStore, _pos); @@ -87,7 +87,7 @@ void Players::CreatePlayer(RakNet::RakNetGUID id) } else { - LOG_APPEND(Log::LOG_INFO, "- Updating reference pointer for %s\n", + LOG_APPEND(Log::LOG_INFO, "- Updating reference pointer for %s", _player->Npc()->mName.c_str()); _player->ptr.getBase()->canChangeCell = true; @@ -268,7 +268,7 @@ void DedicatedPlayer::UpdatePtr(MWWorld::Ptr newPtr) DedicatedPlayer *Players::NewPlayer(RakNet::RakNetGUID guid) { - LOG_APPEND(Log::LOG_INFO, "- Creating new DedicatedPlayer with guid %i\n", + LOG_APPEND(Log::LOG_INFO, "- Creating new DedicatedPlayer with guid %i", guid.ToUint32); players[guid] = new DedicatedPlayer(guid); @@ -433,14 +433,14 @@ void DedicatedPlayer::updateCell() // Go no further if cell data is invalid else { - LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Server sent invalid cell change info about %s (%s)!\n", + LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Server sent invalid cell change info about %s (%s)!", ptr.getBase()->mRef.getRefId().c_str(), this->Npc()->mName.c_str()); return; } - LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Server says %s (%s) moved to %s\n", + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Server says %s (%s) moved to %s", ptr.getBase()->mRef.getRefId().c_str(), this->Npc()->mName.c_str(), cellStore->getCell()->getDescription().c_str()); diff --git a/apps/openmw/mwmp/LocalPlayer.cpp b/apps/openmw/mwmp/LocalPlayer.cpp index a4144711f..35b81e653 100644 --- a/apps/openmw/mwmp/LocalPlayer.cpp +++ b/apps/openmw/mwmp/LocalPlayer.cpp @@ -383,9 +383,9 @@ void LocalPlayer::updateCell(bool forceUpdate) if (shouldUpdate) { - LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Sending ID_GAME_CELL to server\n"); + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Sending ID_GAME_CELL to server"); - LOG_APPEND(Log::LOG_INFO, "- Moved from %s to %s\n", + LOG_APPEND(Log::LOG_INFO, "- Moved from %s to %s", GetCell()->getDescription().c_str(), _cell->getDescription().c_str()); @@ -486,7 +486,7 @@ bool LocalPlayer::CharGenThread() // ToDo: need fix MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); (*Npc()) = *player.get()->mBase; - LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Sending ID_GAME_BASE_INFO to server with my CharGen info\n"); + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Sending ID_GAME_BASE_INFO to server with my CharGen info"); GetNetworking()->GetPacket(ID_GAME_BASE_INFO)->Send(this); if (CharGenStage()->end != 1) diff --git a/apps/openmw/mwmp/Networking.cpp b/apps/openmw/mwmp/Networking.cpp index 8c5b9b19f..0024a9f8d 100644 --- a/apps/openmw/mwmp/Networking.cpp +++ b/apps/openmw/mwmp/Networking.cpp @@ -50,35 +50,35 @@ void Networking::Update() switch (packet->data[0]) { case ID_REMOTE_DISCONNECTION_NOTIFICATION: - LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Another client has disconnected.\n"); + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Another client has disconnected."); break; case ID_REMOTE_CONNECTION_LOST: - LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Another client has lost connection.\n"); + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Another client has lost connection."); break; case ID_REMOTE_NEW_INCOMING_CONNECTION: - LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Another client has connected.\n"); + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Another client has connected."); break; case ID_CONNECTION_REQUEST_ACCEPTED: - LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Our connection request has been accepted.\n"); + LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Our connection request has been accepted."); break; case ID_NEW_INCOMING_CONNECTION: - LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "A connection is incoming.\n"); + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "A connection is incoming."); break; case ID_NO_FREE_INCOMING_CONNECTIONS: - LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "The server is full.\n"); + LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "The server is full."); MWBase::Environment::get().getStateManager()->requestQuit(); break; case ID_DISCONNECTION_NOTIFICATION: - LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "We have been disconnected.\n"); + LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "We have been disconnected."); MWBase::Environment::get().getStateManager()->requestQuit(); break; case ID_CONNECTION_LOST: - LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Connection lost.\n"); + LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Connection lost."); MWBase::Environment::get().getStateManager()->requestQuit(); break; default: ReceiveMessage(packet); - //LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Message with identifier %i has arrived.\n", packet->data[0]); + //LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Message with identifier %i has arrived.", packet->data[0]); break; } } @@ -130,10 +130,10 @@ void Networking::Connect(const std::string &ip, unsigned short port) connected = true; queue = false; - LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_CONNECTION_REQUESTED_ACCEPTED from %s\n", + LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_CONNECTION_REQUESTED_ACCEPTED from %s", serverAddr.ToString()); - LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Sending ID_GAME_BASE_INFO to server\n"); + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Sending ID_GAME_BASE_INFO to server"); GetPacket(ID_GAME_BASE_INFO)->Send(getLocalPlayer()); @@ -146,7 +146,7 @@ void Networking::Connect(const std::string &ip, unsigned short port) case ID_CONNECTION_LOST: throw runtime_error("ID_CONNECTION_LOST.\n"); default: - LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Connection message with identifier %i has arrived in initialization.\n", packet->data[0]); + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Connection message with identifier %i has arrived in initialization.", packet->data[0]); } } } @@ -186,11 +186,11 @@ void Networking::ReceiveMessage(RakNet::Packet *packet) } case ID_GAME_BASE_INFO: { - LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Received ID_GAME_BASE_INFO from server\n"); + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Received ID_GAME_BASE_INFO from server"); if (id == myid) { - LOG_APPEND(Log::LOG_INFO, "%s", "- Packet was about my id\n"); + LOG_APPEND(Log::LOG_INFO, "%s", "- Packet was about my id"); if (packet->length == myPacket->headerSize()) { @@ -200,17 +200,17 @@ void Networking::ReceiveMessage(RakNet::Packet *packet) else { myPacket->Packet(&bsIn, getLocalPlayer(), false); - LOG_APPEND(Log::LOG_INFO, "%s", "- Updating LocalPlayer\n"); + LOG_APPEND(Log::LOG_INFO, "%s", "- Updating LocalPlayer"); getLocalPlayer()->updateChar(); } } else { - LOG_APPEND(Log::LOG_INFO, "- Packet was about %s\n", pl == 0 ? "new player" : pl->Npc()->mName.c_str()); + LOG_APPEND(Log::LOG_INFO, "- Packet was about %s", pl == 0 ? "new player" : pl->Npc()->mName.c_str()); if (pl == 0) { - LOG_APPEND(Log::LOG_INFO, "%s", "- Exchanging data with new player\n"); + LOG_APPEND(Log::LOG_INFO, "%s", "- Exchanging data with new player"); pl = Players::NewPlayer(id); } @@ -225,7 +225,7 @@ void Networking::ReceiveMessage(RakNet::Packet *packet) { if (packet->length != myPacket->headerSize()) { - LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "ID_GAME_UPDATE_POS changed by server\n"); + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "ID_GAME_UPDATE_POS changed by server"); myPacket->Packet(&bsIn, getLocalPlayer(), false); getLocalPlayer()->setPosition(); } @@ -302,12 +302,12 @@ void Networking::ReceiveMessage(RakNet::Packet *packet) //cout << "Player: " << pl->Npc()->mName << " pressed: " << (pl->GetAttack()->pressed == 1) << endl; if (pl->GetAttack()->pressed == 0) { - LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Attack success: %s\n", + LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Attack success: %s", pl->GetAttack()->success ? "true" : "false"); if (pl->GetAttack()->success == 1) { - LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Damage: %f\n", + LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Damage: %f", pl->GetAttack()->damage); } } @@ -353,7 +353,7 @@ void Networking::ReceiveMessage(RakNet::Packet *packet) } else { - LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "SpellId: %s\n", + LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "SpellId: %s", pl->GetAttack()->refid.c_str()); } } @@ -382,7 +382,7 @@ void Networking::ReceiveMessage(RakNet::Packet *packet) } case ID_GAME_DIE: { - LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Received ID_GAME_DIE from server\n"); + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Received ID_GAME_DIE from server"); if (id == myid) { MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); @@ -393,7 +393,7 @@ void Networking::ReceiveMessage(RakNet::Packet *packet) } else if (pl != 0) { - LOG_APPEND(Log::LOG_INFO, "- Packet was about %s\n", pl->Npc()->mName.c_str()); + LOG_APPEND(Log::LOG_INFO, "- Packet was about %s", pl->Npc()->mName.c_str()); MWMechanics::DynamicStat health; pl->CreatureStats()->mDead = true; health.readState(pl->CreatureStats()->mDynamic[0]); @@ -543,7 +543,7 @@ void Networking::ReceiveMessage(RakNet::Packet *packet) { skillValue.readState(__pl->NpcStats()->mSkills[i]); __pl_ptr.getClass().getNpcStats(__pl_ptr).setSkill(i, skillValue); - //LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "skill %d, value %d\n", i, skillValue.getBase()); + //LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "skill %d, value %d", i, skillValue.getBase()); } break; @@ -554,7 +554,7 @@ void Networking::ReceiveMessage(RakNet::Packet *packet) { myPacket->Packet(&bsIn, getLocalPlayer(), false); - LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "ID_GUI_MESSAGEBOX, Type %d, MSG %s\n", + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "ID_GUI_MESSAGEBOX, Type %d, MSG %s", getLocalPlayer()->guiMessageBox.type, getLocalPlayer()->guiMessageBox.label.c_str()); @@ -568,7 +568,7 @@ void Networking::ReceiveMessage(RakNet::Packet *packet) break; } default: - LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Custom message with identifier %i has arrived in initialization.\n", packet->data[0]); + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Custom message with identifier %i has arrived in initialization.", packet->data[0]); } }