diff --git a/apps/openmw-mp/MasterClient.cpp b/apps/openmw-mp/MasterClient.cpp index b3cb4ae27..d073c961e 100644 --- a/apps/openmw-mp/MasterClient.cpp +++ b/apps/openmw-mp/MasterClient.cpp @@ -113,7 +113,7 @@ RakNet::RakString MasterClient::Send(std::string motd, unsigned players, unsigne if (httpConnection->GetResponse(transmitted, hostTransmitted, response, hostReceived, contentOffset)) { - if(contentOffset < 0) + if (contentOffset < 0) return "NO_CONTENT"; // no content tcpInterface.CloseConnection(sa); return (response.C_String() + contentOffset); diff --git a/apps/openmw-mp/Networking.cpp b/apps/openmw-mp/Networking.cpp index b3a9e78dd..9d1c8acbd 100644 --- a/apps/openmw-mp/Networking.cpp +++ b/apps/openmw-mp/Networking.cpp @@ -178,7 +178,7 @@ void Networking::Update(RakNet::Packet *packet) { DEBUG_PRINTF("ID_GAME_ATTACK\n"); - if(!player->CreatureStats()->mDead) + if (!player->CreatureStats()->mDead) { myPacket->Read(player); @@ -250,7 +250,7 @@ void Networking::Update(RakNet::Packet *packet) Script::CallBackReturn result = true; Script::Call(result, player->GetID(), player->ChatMessage()->c_str()); - if(result) + if (result) { *player->ChatMessage() = player->Npc()->mName + " (" + std::to_string(player->GetID()) + "): " + *player->ChatMessage() + "\n"; diff --git a/apps/openmw-mp/Player.cpp b/apps/openmw-mp/Player.cpp index da1c40a8b..f4e5279b6 100644 --- a/apps/openmw-mp/Player.cpp +++ b/apps/openmw-mp/Player.cpp @@ -9,7 +9,7 @@ TSlots Players::slots; void Players::DeletePlayer(RakNet::RakNetGUID id) { - if(players[id] != 0) + if (players[id] != 0) { slots[players[id]->GetID()] = 0; delete players[id]; @@ -22,9 +22,9 @@ void Players::NewPlayer(RakNet::RakNetGUID id) { players[id] = new Player(id); - for(int i = 0; i < 16; i++) + for (int i = 0; i < 16; i++) { - if(slots[i] == 0) + if (slots[i] == 0) { slots[i] = players[id]; slots[i]->SetID(i); diff --git a/apps/openmw-mp/Script/API/TimerAPI.cpp b/apps/openmw-mp/Script/API/TimerAPI.cpp index b964b2756..90e4c06aa 100644 --- a/apps/openmw-mp/Script/API/TimerAPI.cpp +++ b/apps/openmw-mp/Script/API/TimerAPI.cpp @@ -220,7 +220,7 @@ bool TimerAPI::IsEndTimer(int timerid) void TimerAPI::Terminate() { - for(auto timer : timers) + for (auto timer : timers) { if (timer.second != nullptr) delete timer.second; diff --git a/apps/openmw-mp/Script/Functions/Chat.cpp b/apps/openmw-mp/Script/Functions/Chat.cpp index bdd62918c..f7b878aeb 100644 --- a/apps/openmw-mp/Script/Functions/Chat.cpp +++ b/apps/openmw-mp/Script/Functions/Chat.cpp @@ -16,7 +16,7 @@ void ScriptFunctions::SendMessage(unsigned short pid, const char *message, bool DEBUG_PRINTF("System: %s", message); mwmp::Networking::Get().GetController()->GetPacket(ID_CHAT_MESSAGE)->Send(player, false); - if(broadcast) + if (broadcast) mwmp::Networking::Get().GetController()->GetPacket(ID_CHAT_MESSAGE)->Send(player, true); } diff --git a/apps/openmw-mp/Script/Functions/Stats.cpp b/apps/openmw-mp/Script/Functions/Stats.cpp index 24f1f5331..071056c3d 100644 --- a/apps/openmw-mp/Script/Functions/Stats.cpp +++ b/apps/openmw-mp/Script/Functions/Stats.cpp @@ -235,7 +235,7 @@ int ScriptFunctions::GetAttribute(unsigned short pid, unsigned short attribute) Player *player; GET_PLAYER(pid, player, 0); - if(attribute > 7) + if (attribute > 7) return 0; return player->CreatureStats()->mAttributes[attribute].mBase; @@ -246,7 +246,7 @@ void ScriptFunctions::SetAttribute(unsigned short pid, unsigned short attribute, Player *player; GET_PLAYER(pid, player,); - if(attribute > 7) + if (attribute > 7) return; DEBUG_PRINTF("SetAttribute(%d, %d, %d)\n", pid, attribute, value); @@ -259,7 +259,7 @@ int ScriptFunctions::GetCurrentAttribute(unsigned short pid, unsigned short attr Player *player; GET_PLAYER(pid, player, 0); - if(attribute > 7) + if (attribute > 7) return 0; return player->CreatureStats()->mAttributes[attribute].mCurrent; diff --git a/apps/openmw-mp/Script/Functions/Translocations.cpp b/apps/openmw-mp/Script/Functions/Translocations.cpp index a9b809cba..40c623a93 100644 --- a/apps/openmw-mp/Script/Functions/Translocations.cpp +++ b/apps/openmw-mp/Script/Functions/Translocations.cpp @@ -66,7 +66,7 @@ void ScriptFunctions::SetCell(unsigned short pid, const char *name) noexcept Player *player; GET_PLAYER(pid, player,); - /*if(player->GetCell()->mName == name) + /*if (player->GetCell()->mName == name) return;*/ cout << "attempt to move player (pid: " << pid << " name: " << player->Npc()->mName << ") from "; diff --git a/apps/openmw-mp/Script/LangLua/LangLua.cpp b/apps/openmw-mp/Script/LangLua/LangLua.cpp index 7d8a10a6f..a85ea2a47 100644 --- a/apps/openmw-mp/Script/LangLua/LangLua.cpp +++ b/apps/openmw-mp/Script/LangLua/LangLua.cpp @@ -108,7 +108,7 @@ void LangLua::LoadProgram(const char *filename) luabridge::Namespace tes3mp = luabridge::getGlobalNamespace(lua).beginNamespace("tes3mp"); - for(unsigned i = 0; i < functions_n; i++) + for (unsigned i = 0; i < functions_n; i++) tes3mp.addCFunction(functions_[i].name, functions_[i].func); tes3mp.endNamespace(); diff --git a/apps/openmw-mp/Script/LangPawn/PawnFunc.cpp b/apps/openmw-mp/Script/LangPawn/PawnFunc.cpp index 504ef4a49..890bae9ad 100644 --- a/apps/openmw-mp/Script/LangPawn/PawnFunc.cpp +++ b/apps/openmw-mp/Script/LangPawn/PawnFunc.cpp @@ -128,16 +128,16 @@ cell LangPAWN::CallPublic(AMX *amx, const cell *params) noexcept } boost::any result = Public::Call(&name[0], args); - if(result.empty()) + if (result.empty()) return 0; cell ret = 0; - if(result.type().hash_code() == typeid(signed int).hash_code()) + if (result.type().hash_code() == typeid(signed int).hash_code()) ret = boost::any_cast(result); - else if(result.type().hash_code() == typeid(unsigned int).hash_code()) + else if (result.type().hash_code() == typeid(unsigned int).hash_code()) ret = boost::any_cast(result); - else if(result.type().hash_code() == typeid(double).hash_code()) + else if (result.type().hash_code() == typeid(double).hash_code()) ret = amx_ftoc(result); return ret; diff --git a/apps/openmw-mp/Script/Script.hpp b/apps/openmw-mp/Script/Script.hpp index 0699ad873..896045ca4 100644 --- a/apps/openmw-mp/Script/Script.hpp +++ b/apps/openmw-mp/Script/Script.hpp @@ -37,7 +37,7 @@ private: template R GetScript(const char *name) { - if(script_type == SCRIPT_CPP) + if (script_type == SCRIPT_CPP) { return SystemInterface(lang->GetInterface(), name).result; } @@ -99,14 +99,14 @@ public: if (script->script_type == SCRIPT_CPP) result = reinterpret_cast>>(callback)(std::forward(args)...); #if defined (ENABLE_PAWN) - else if(script->script_type == SCRIPT_PAWN) + else if (script->script_type == SCRIPT_PAWN) { boost::any any = script->lang->Call(data.name, data.callback.types, B, std::forward(args)...); result = reinterpret_cast> ((int)boost::any_cast(any)); // TODO: WTF?! int?! } #endif #if defined (ENABLE_LUA) - else if(script->script_type == SCRIPT_LUA) + else if (script->script_type == SCRIPT_LUA) { boost::any any = script->lang->Call(data.name, data.callback.types, B, std::forward(args)...); result = static_cast>(boost::any_cast(any).cast>()); @@ -138,11 +138,11 @@ public: if (script->script_type == SCRIPT_CPP) reinterpret_cast>>(callback)(std::forward(args)...); #if defined (ENABLE_PAWN) - else if(script->script_type == SCRIPT_PAWN) + else if (script->script_type == SCRIPT_PAWN) script->lang->Call(data.name, data.callback.types, B, std::forward(args)...); #endif #if defined (ENABLE_LUA) - else if(script->script_type == SCRIPT_LUA) + else if (script->script_type == SCRIPT_LUA) script->lang->Call(data.name, data.callback.types, B, std::forward(args)...); #endif ++count; diff --git a/apps/openmw-mp/Script/ScriptFunction.cpp b/apps/openmw-mp/Script/ScriptFunction.cpp index 14b1addbd..0d15e45a7 100644 --- a/apps/openmw-mp/Script/ScriptFunction.cpp +++ b/apps/openmw-mp/Script/ScriptFunction.cpp @@ -66,7 +66,7 @@ boost::any ScriptFunction::Call(const vector &args) cell ret = boost::any_cast(any); - switch(ret_type) + switch (ret_type) { case 'i': result = static_cast(ret); diff --git a/apps/openmw-mp/Utils.cpp b/apps/openmw-mp/Utils.cpp index 1e7b47f53..958d65f24 100644 --- a/apps/openmw-mp/Utils.cpp +++ b/apps/openmw-mp/Utils.cpp @@ -33,8 +33,8 @@ std::string Utils::convertPath(std::string str) #endif #if defined(_WIN32) || defined(__APPLE__) - for(auto &ch : str) - if(ch == '/') + for (auto &ch : str) + if (ch == '/') ch = _SEP_; #endif //defined(_WIN32) || defined(__APPLE__) return str; diff --git a/apps/openmw-mp/main.cpp b/apps/openmw-mp/main.cpp index 0f3f09d79..50d0ec5b9 100644 --- a/apps/openmw-mp/main.cpp +++ b/apps/openmw-mp/main.cpp @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) loadSettings(mgr); int logLevel = mgr.getInt("loglevel", "General"); - if(logLevel < Log::LOG_INFO || logLevel > Log::LOG_FATAL) + if (logLevel < Log::LOG_INFO || logLevel > Log::LOG_FATAL) logLevel = Log::LOG_INFO; LOG_INIT(logLevel); diff --git a/apps/openmw/mwmp/DedicatedPlayer.cpp b/apps/openmw/mwmp/DedicatedPlayer.cpp index 1ab05d936..4a766def8 100644 --- a/apps/openmw/mwmp/DedicatedPlayer.cpp +++ b/apps/openmw/mwmp/DedicatedPlayer.cpp @@ -103,7 +103,7 @@ void Players::CreatePlayer(RakNet::RakNetGUID id) void Players::CleanUp() { - for(std::map ::iterator it = players.begin(); it != players.end(); it++) + for (std::map ::iterator it = players.begin(); it != players.end(); it++) delete it->second; } @@ -225,7 +225,7 @@ void Players::Update(float dt) value.readState(pl->CreatureStats()->mDynamic[2]); npcStats->setFatigue(value); - if(npcStats->isDead()) + if (npcStats->isDead()) npcStats->resurrect(); @@ -274,10 +274,10 @@ void DedicatedPlayer::UpdateInventory() const string &dedicItem = EquipedItem(slot)->refid; std::string item = ""; bool equal = false; - if(it != invStore.end()) + if (it != invStore.end()) { item = it->getCellRef().getRefId(); - if(!Misc::StringUtils::ciEqual(item, dedicItem)) // if other item equiped + if (!Misc::StringUtils::ciEqual(item, dedicItem)) // if other item equiped { MWWorld::ContainerStore &store = ptr.getClass().getContainerStore(ptr); store.remove(item, store.count(item), ptr); @@ -353,11 +353,11 @@ const std::string DedicatedPlayer::GetAnim() type == ESM::Weapon::MarksmanCrossbow || type == ESM::Weapon::MarksmanBow*/) anim_weap = "1h"; - else if(type == ESM::Weapon::LongBladeTwoHand || + else if (type == ESM::Weapon::LongBladeTwoHand || type == ESM::Weapon::BluntTwoClose || type == ESM::Weapon::AxeTwoHand) anim_weap = "2c"; - else if(type == ESM::Weapon::BluntTwoWide || + else if (type == ESM::Weapon::BluntTwoWide || type == ESM::Weapon::SpearTwoWide) anim_weap = "2w"; } @@ -376,12 +376,12 @@ DedicatedPlayer *Players::GetPlayer(const MWWorld::Ptr &ptr) { std::map ::iterator it = players.begin(); - for(; it != players.end(); it++) + for (; it != players.end(); it++) { - if(it->second == 0 || it->second->getPtr().mRef == 0) + if (it->second == 0 || it->second->getPtr().mRef == 0) continue; string refid = ptr.getCellRef().getRefId(); - if(it->second->getPtr().getCellRef().getRefId() == refid) + if (it->second->getPtr().getCellRef().getRefId() == refid) return it->second; } return 0; @@ -392,9 +392,9 @@ void DedicatedPlayer::UpdateDrawState() using namespace MWMechanics; if (drawState == 0) ptr.getClass().getNpcStats(ptr).setDrawState(DrawState_Nothing); - else if(drawState == 1) + else if (drawState == 1) ptr.getClass().getNpcStats(ptr).setDrawState(DrawState_Weapon); - else if(drawState == 2) + else if (drawState == 2) ptr.getClass().getNpcStats(ptr).setDrawState(DrawState_Spell); MWMechanics::NpcStats *npcStats = &ptr.getClass().getNpcStats(ptr); diff --git a/apps/openmw/mwmp/GUIChat.cpp b/apps/openmw/mwmp/GUIChat.cpp index d0441cf07..a18d473a3 100644 --- a/apps/openmw/mwmp/GUIChat.cpp +++ b/apps/openmw/mwmp/GUIChat.cpp @@ -80,7 +80,7 @@ namespace mwmp void GUIChat::acceptCommand(MyGUI::EditBox *_sender) { const std::string &cm = mCommandLine->getOnlyText(); - if(cm.empty()) return; + if (cm.empty()) return; // Add the command to the history, and set the current pointer to // the end of the list @@ -150,7 +150,7 @@ namespace mwmp windowState++; if (windowState == 3) windowState = 0; - switch(windowState) + switch (windowState) { case CHAT_DISABLED: this->mMainWidget->setVisible(false); @@ -192,7 +192,7 @@ namespace mwmp if (mCommandHistory.empty()) return; // Traverse history with up and down arrows - if(key == MyGUI::KeyCode::ArrowUp) + if (key == MyGUI::KeyCode::ArrowUp) { // If the user was editing a string, store it for later if (mCurrent == mCommandHistory.end()) @@ -206,7 +206,7 @@ namespace mwmp } else if (key == MyGUI::KeyCode::ArrowDown) { - if(mCurrent != mCommandHistory.end()) + if (mCurrent != mCommandHistory.end()) { ++mCurrent; diff --git a/apps/openmw/mwmp/GUIController.cpp b/apps/openmw/mwmp/GUIController.cpp index d0babb2fe..5015d6a2c 100644 --- a/apps/openmw/mwmp/GUIController.cpp +++ b/apps/openmw/mwmp/GUIController.cpp @@ -24,7 +24,7 @@ mwmp::GUIController::GUIController(): mInputBox(0) mwmp::GUIController::~GUIController() { - /* if(mChat != nullptr) + /* if (mChat != nullptr) delete mChat; mChat = nullptr;*/ } diff --git a/apps/openmw/mwmp/LocalPlayer.cpp b/apps/openmw/mwmp/LocalPlayer.cpp index f73541309..7b0c22b14 100644 --- a/apps/openmw/mwmp/LocalPlayer.cpp +++ b/apps/openmw/mwmp/LocalPlayer.cpp @@ -70,7 +70,7 @@ void LocalPlayer::updateBaseStats(bool forceUpdate) static MWMechanics::DynamicStat oldFatigue(creatureClass->getFatigue()); static float timer = 0; - if(((oldHealth != health || oldMagicka != magicka || oldFatigue != fatigue) && + if (((oldHealth != health || oldMagicka != magicka || oldFatigue != fatigue) && (timer += MWBase::Environment::get().getFrameDuration()) >= 0.5 ) || forceUpdate) { oldHealth = health; @@ -179,16 +179,16 @@ void LocalPlayer::updateInventory(bool forceUpdate) for (int slot = 0; slot < MWWorld::InventoryStore::Slots; ++slot) { MWWorld::ContainerStoreIterator it = invStore.getSlot(slot); - if(it != invStore.end() && !::Misc::StringUtils::ciEqual(it->getCellRef().getRefId(), EquipedItem(slot)->refid)) + if (it != invStore.end() && !::Misc::StringUtils::ciEqual(it->getCellRef().getRefId(), EquipedItem(slot)->refid)) { invChanged = true; EquipedItem(slot)->refid = it->getCellRef().getRefId(); - if(slot == MWWorld::InventoryStore::Slot_CarriedRight) + if (slot == MWWorld::InventoryStore::Slot_CarriedRight) { MWMechanics::WeaponType weaptype; MWMechanics::getActiveWeapon(player.getClass().getCreatureStats(player), player.getClass().getInventoryStore(player), &weaptype); - if(weaptype != MWMechanics::WeapType_Thrown) + if (weaptype != MWMechanics::WeapType_Thrown) EquipedItem(slot)->count = 1; } else @@ -246,7 +246,7 @@ void LocalPlayer::updateAttackState(bool forceUpdate) } attackPressed = true; } - else if(!world->getPlayer().getAttackingOrSpell() && attackPressed) + else if (!world->getPlayer().getAttackingOrSpell() && attackPressed) { if (/*state == MWMechanics::DrawState_Spell ||*/ state == MWMechanics::DrawState_Weapon) { @@ -455,7 +455,7 @@ void LocalPlayer::updateDrawStateAndFlags(bool forceUpdate) else if (state == MWMechanics::DrawState_Spell) (*DrawState()) = 2; - if(jump) + if (jump) mwmp::Main::get().getLocalPlayer()->updatePosition(true); // fix position after jump; RakNet::BitStream bs; @@ -474,10 +474,10 @@ void LocalPlayer::CharGen(int stageFirst, int stageEnd) bool LocalPlayer::CharGenThread() // ToDo: need fix { MWBase::WindowManager *windowManager = MWBase::Environment::get().getWindowManager(); - if(windowManager->isGuiMode()) + if (windowManager->isGuiMode()) return false; - if(CharGenStage()->current >= CharGenStage()->end) + if (CharGenStage()->current >= CharGenStage()->end) { if (GetNetworking()->isConnected() && CharGenStage()->current == CharGenStage()->end && @@ -486,9 +486,10 @@ bool LocalPlayer::CharGenThread() // ToDo: need fix MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); (*Npc()) = *player.get()->mBase; + printf("Sending ID_GAME_BASE_INFO to server with my CharGen info"); GetNetworking()->GetPacket(ID_GAME_BASE_INFO)->Send(this); - if(CharGenStage()->end != 1) + if (CharGenStage()->end != 1) { updateBaseStats(true); updateAttributesAndSkills(true); diff --git a/apps/openmw/mwmp/Networking.cpp b/apps/openmw/mwmp/Networking.cpp index 925e11728..f4c4b7793 100644 --- a/apps/openmw/mwmp/Networking.cpp +++ b/apps/openmw/mwmp/Networking.cpp @@ -100,7 +100,7 @@ void Networking::Connect(const std::string &ip, unsigned short port) errmsg = "Connection attempt failed.\n"; bool queue = true; - while(queue) + while (queue) { for (RakNet::Packet *packet = peer->Receive(); packet; peer->DeallocatePacket( packet), packet = peer->Receive()) @@ -170,7 +170,7 @@ void Networking::ReceiveMessage(RakNet::Packet *packet) BasePacket *myPacket = controller.GetPacket(packet->data[0]); - switch(packet->data[0]) + switch (packet->data[0]) { case ID_HANDSHAKE: { @@ -183,7 +183,7 @@ void Networking::ReceiveMessage(RakNet::Packet *packet) if (id == myid) { cout << "TEST: " << packet->length << endl; - if(packet->length == myPacket->headerSize()) + if (packet->length == myPacket->headerSize()) { cout << "ID_GAME_BASE_INFO request only" << endl; myPacket->Send(getLocalPlayer(), serverAddr); @@ -233,7 +233,7 @@ void Networking::ReceiveMessage(RakNet::Packet *packet) { if (id == myid) MWBase::Environment::get().getStateManager()->requestQuit(); - else if(pl != 0) + else if (pl != 0) Players::DisconnectPlayer(id); } @@ -288,7 +288,7 @@ void Networking::ReceiveMessage(RakNet::Packet *packet) if (pl->GetAttack()->pressed == 0) { cout << "success: " << (pl->GetAttack()->success == 1); - if(pl->GetAttack()->success == 1) + if (pl->GetAttack()->success == 1) cout << " damage: " << pl->GetAttack()->damage; cout << endl; } @@ -536,11 +536,11 @@ void Networking::ReceiveMessage(RakNet::Packet *packet) printf("ID_GUI_MESSAGEBOX, Type %d, MSG %s\n", getLocalPlayer()->guiMessageBox.type, getLocalPlayer()->guiMessageBox.label.c_str()); - if(getLocalPlayer()->guiMessageBox.type == BasePlayer::GUIMessageBox::MessageBox) + if (getLocalPlayer()->guiMessageBox.type == BasePlayer::GUIMessageBox::MessageBox) Main::get().getGUIConroller()->ShowMessageBox(getLocalPlayer()->guiMessageBox); - else if(getLocalPlayer()->guiMessageBox.type == BasePlayer::GUIMessageBox::CustomMessageBox) + else if (getLocalPlayer()->guiMessageBox.type == BasePlayer::GUIMessageBox::CustomMessageBox) Main::get().getGUIConroller()->ShowCustomMessageBox(getLocalPlayer()->guiMessageBox); - else if(getLocalPlayer()->guiMessageBox.type == BasePlayer::GUIMessageBox::InputDialog) + else if (getLocalPlayer()->guiMessageBox.type == BasePlayer::GUIMessageBox::InputDialog) Main::get().getGUIConroller()->ShowInputBox(getLocalPlayer()->guiMessageBox); } break; @@ -562,7 +562,7 @@ LocalPlayer *Networking::getLocalPlayer() bool Networking::isDedicatedPlayer(const MWWorld::Ptr &ptr) { - if(ptr.mRef == 0) + if (ptr.mRef == 0) return 0; DedicatedPlayer *pl = Players::GetPlayer(ptr); @@ -573,7 +573,7 @@ bool Networking::Attack(const MWWorld::Ptr &ptr) { DedicatedPlayer *pl = Players::GetPlayer(ptr); - if(pl == 0) + if (pl == 0) return false; return pl->GetAttack()->pressed; diff --git a/components/openmw-mp/Base/BasePlayer.hpp b/components/openmw-mp/Base/BasePlayer.hpp index cd661ef66..18106a496 100644 --- a/components/openmw-mp/Base/BasePlayer.hpp +++ b/components/openmw-mp/Base/BasePlayer.hpp @@ -97,7 +97,7 @@ namespace mwmp virtual Item *EquipedItem(int id) { - if(id >= 18) return &equipedItems[18]; + if (id >= 18) return &equipedItems[18]; return &equipedItems[id]; } diff --git a/components/openmw-mp/Log.cpp b/components/openmw-mp/Log.cpp index 18ad567bc..1b48e8056 100644 --- a/components/openmw-mp/Log.cpp +++ b/components/openmw-mp/Log.cpp @@ -21,14 +21,14 @@ Log::Log(int logLevel) : logLevel(logLevel) void Log::Create(int logLevel) { - if(sLog != NULL) + if (sLog != NULL) return; sLog = new Log(logLevel); } void Log::Delete() { - if(sLog == NULL) + if (sLog == NULL) return delete sLog; sLog = NULL; @@ -52,18 +52,18 @@ const char* getTime() void Log::print(int level, const char *file, int line, const char *message, ...) const { - if(level < logLevel) return; + if (level < logLevel) return; std::stringstream sstr; sstr << "[" << getTime() << "] "; - if(file != 0 && line != 0) + if (file != 0 && line != 0) { sstr << "[" << file << ":"; sstr << line << "] "; } sstr << "["; - switch(level) + switch (level) { case LOG_WARN: sstr << "WARN"; @@ -80,7 +80,7 @@ void Log::print(int level, const char *file, int line, const char *message, ...) sstr << "]: "; sstr << message; char back = *sstr.str().rbegin(); - if(back != '\n') + if (back != '\n') sstr << '\n'; va_list args; va_start(args, message); diff --git a/components/openmw-mp/Packets/BasePacket.cpp b/components/openmw-mp/Packets/BasePacket.cpp index 848bc80af..5fedca21e 100644 --- a/components/openmw-mp/Packets/BasePacket.cpp +++ b/components/openmw-mp/Packets/BasePacket.cpp @@ -14,7 +14,7 @@ void BasePacket::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send) this->player = player; this->bs = bs; - if(send) + if (send) { bs->Write(packetID); bs->Write(player->guid); @@ -73,8 +73,8 @@ void BasePacket::RequestData(RakNet::RakNetGUID player) void BasePacket::SetStreams(RakNet::BitStream *inStream, RakNet::BitStream *outStream) { - if(inStream != 0) + if (inStream != 0) bsRead = inStream; - if(outStream != 0) + if (outStream != 0) bsSend = outStream; } \ No newline at end of file diff --git a/components/openmw-mp/Packets/PacketAttribute.cpp b/components/openmw-mp/Packets/PacketAttribute.cpp index 69627f2cc..9fccf3279 100644 --- a/components/openmw-mp/Packets/PacketAttribute.cpp +++ b/components/openmw-mp/Packets/PacketAttribute.cpp @@ -16,6 +16,6 @@ void PacketAttribute::Packet(RakNet::BitStream *bs, BasePlayer *player, bool sen { BasePacket::Packet(bs, player, send); - for(int i = 0; i < AttributesCount; ++i) + for (int i = 0; i < AttributesCount; ++i) RW(player->CreatureStats()->mAttributes[i], send); } diff --git a/components/openmw-mp/Packets/PacketAttributesAndStats.cpp b/components/openmw-mp/Packets/PacketAttributesAndStats.cpp index fcfa601e1..f6ba73b17 100644 --- a/components/openmw-mp/Packets/PacketAttributesAndStats.cpp +++ b/components/openmw-mp/Packets/PacketAttributesAndStats.cpp @@ -17,7 +17,7 @@ void PacketAttributesAndStats::Packet(RakNet::BitStream *bs, BasePlayer *player, { BasePacket::Packet(bs, player, send); - for(int i = 0; i < AttributesCount; ++i) + for (int i = 0; i < AttributesCount; ++i) RW(player->CreatureStats()->mAttributes[i], send); for (int i = 0; i < StatsCount; ++i) diff --git a/components/openmw-mp/Packets/PacketEquiped.cpp b/components/openmw-mp/Packets/PacketEquiped.cpp index e2f89546e..96dfa97aa 100644 --- a/components/openmw-mp/Packets/PacketEquiped.cpp +++ b/components/openmw-mp/Packets/PacketEquiped.cpp @@ -16,7 +16,7 @@ void PacketEquiped::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send) { BasePacket::Packet(bs, player, send); - for(int i = 0; i < 19; i++) + for (int i = 0; i < 19; i++) { RW(player->EquipedItem(i)->refid, send); RW(player->EquipedItem(i)->count, send); diff --git a/components/openmw-mp/Packets/PacketGUIBoxes.cpp b/components/openmw-mp/Packets/PacketGUIBoxes.cpp index d9b563cca..4bd014edd 100644 --- a/components/openmw-mp/Packets/PacketGUIBoxes.cpp +++ b/components/openmw-mp/Packets/PacketGUIBoxes.cpp @@ -22,7 +22,7 @@ void PacketGUIBoxes::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send RW(player->guiMessageBox.data, send); - if(player->guiMessageBox.type == BasePlayer::GUIMessageBox::CustomMessageBox) + if (player->guiMessageBox.type == BasePlayer::GUIMessageBox::CustomMessageBox) RW(player->guiMessageBox.buttons, send); } diff --git a/components/openmw-mp/PacketsController.cpp b/components/openmw-mp/PacketsController.cpp index 48e324604..1f561a96d 100644 --- a/components/openmw-mp/PacketsController.cpp +++ b/components/openmw-mp/PacketsController.cpp @@ -55,7 +55,7 @@ mwmp::PacketsController::PacketsController(RakNet::RakPeerInterface *peer) mwmp::BasePacket *mwmp::PacketsController::GetPacket(RakNet::MessageID id) { BasePacket * packet; - switch(id) + switch (id) { case ID_GAME_UPDATE_POS: packet = packetPosition;