From 6e6237541a233fdeedb449f94e2d437303417180 Mon Sep 17 00:00:00 2001 From: Koncord Date: Wed, 21 Dec 2016 16:02:08 +0800 Subject: [PATCH] Fix "comparison between signed and unsigned integer expressions" --- apps/openmw-mp/Player.cpp | 4 ++-- apps/openmw-mp/Script/Functions/Spells.cpp | 2 +- apps/openmw/mwmp/GUIDialogList.cpp | 2 +- apps/openmw/mwworld/cellstore.cpp | 8 ++++---- apps/openmw/mwworld/cellstore.hpp | 8 ++++---- components/openmw-mp/Packets/Player/PacketSpellbook.cpp | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/apps/openmw-mp/Player.cpp b/apps/openmw-mp/Player.cpp index 75dbe38e42b..ec7d15ae824 100644 --- a/apps/openmw-mp/Player.cpp +++ b/apps/openmw-mp/Player.cpp @@ -36,7 +36,7 @@ void Players::newPlayer(RakNet::RakNetGUID guid) players[guid]->CreatureStats()->blank(); players[guid]->charClass.blank(); - for (int i = 0; i < mwmp::Networking::get().maxConnections(); i++) + for (unsigned int i = 0; i < mwmp::Networking::get().maxConnections(); i++) { if (slots[i] == 0) { @@ -63,7 +63,7 @@ TPlayers *Players::getPlayers() Player::Player(RakNet::RakNetGUID guid) : BasePlayer(guid) { handshakeState = false; - loadState = false; + loadState = NOTLOADED; lastAttacker = 0; } diff --git a/apps/openmw-mp/Script/Functions/Spells.cpp b/apps/openmw-mp/Script/Functions/Spells.cpp index 59866cc42da..4373f18a17a 100644 --- a/apps/openmw-mp/Script/Functions/Spells.cpp +++ b/apps/openmw-mp/Script/Functions/Spells.cpp @@ -52,7 +52,7 @@ bool SpellFunctions::HasSpell(unsigned short pid, const char* spellId) Player *player; GET_PLAYER(pid, player, false); - for (int i = 0; i < player->spellbook.count; i++) + for (unsigned int i = 0; i < player->spellbook.count; i++) if (Misc::StringUtils::ciEqual(player->spellbook.spells.at(i).id, spellId)) return true; return false; diff --git a/apps/openmw/mwmp/GUIDialogList.cpp b/apps/openmw/mwmp/GUIDialogList.cpp index b89143bbef2..ea33c6d47e0 100644 --- a/apps/openmw/mwmp/GUIDialogList.cpp +++ b/apps/openmw/mwmp/GUIDialogList.cpp @@ -28,7 +28,7 @@ GUIDialogList::GUIDialogList(const std::string &message, const std::vectoreventMouseButtonClick += MyGUI::newDelegate(this, &GUIDialogList::mousePressed); mMessage->setCaptionWithReplacing(message); - for(int i = 0; i < list.size(); i++) + for(size_t i = 0; i < list.size(); i++) mListBox->addItem(list[i]); } diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index 258acd69845..fbfb350b4ff 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -450,7 +450,7 @@ namespace MWWorld { PtrType mFound; std::string mIdToFind; - int mRefNumIndexToFind; + unsigned int mRefNumIndexToFind; bool operator()(const PtrType& ptr) { @@ -467,7 +467,7 @@ namespace MWWorld }; ///< Added by tes3mp and used to find an object by both its ID and its reference number - Ptr CellStore::searchExact (const std::string& id, int numIndex) + Ptr CellStore::searchExact (const std::string& id, unsigned int numIndex) { SearchExactVisitor searchVisitor; searchVisitor.mIdToFind = id; @@ -477,13 +477,13 @@ namespace MWWorld } // Added by tes3mp and used to get the last reference number in the cell - int CellStore::getLastRefNumIndex() const + unsigned int CellStore::getLastRefNumIndex() const { return lastRefNumIndex; } // Added by tes3mp and used to record the last reference number in the cell - void CellStore::setLastRefNumIndex(int value) + void CellStore::setLastRefNumIndex(unsigned int value) { lastRefNumIndex = value; } diff --git a/apps/openmw/mwworld/cellstore.hpp b/apps/openmw/mwworld/cellstore.hpp index 364480173b2..e32017cd393 100644 --- a/apps/openmw/mwworld/cellstore.hpp +++ b/apps/openmw/mwworld/cellstore.hpp @@ -76,7 +76,7 @@ namespace MWWorld float mWaterLevel; // Added by tes3mp - int lastRefNumIndex; + unsigned int lastRefNumIndex; MWWorld::TimeStamp mLastRespawn; @@ -234,13 +234,13 @@ namespace MWWorld Ptr searchViaActorId (int id); ///< Will return an empty Ptr if cell is not loaded. - Ptr searchExact (const std::string& id, int numIndex); + Ptr searchExact (const std::string& id, unsigned int numIndex); ///< Added by tes3mp and used to find an object by both its ID and its reference number - int getLastRefNumIndex() const; + unsigned int getLastRefNumIndex() const; // Added by tes3mp and used to get the last reference number in the cell - void setLastRefNumIndex(int value); + void setLastRefNumIndex(unsigned int value); // Added by tes3mp and used to record the last reference number in the cell float getWaterLevel() const; diff --git a/components/openmw-mp/Packets/Player/PacketSpellbook.cpp b/components/openmw-mp/Packets/Player/PacketSpellbook.cpp index 7673b396620..1bbb995cc3e 100644 --- a/components/openmw-mp/Packets/Player/PacketSpellbook.cpp +++ b/components/openmw-mp/Packets/Player/PacketSpellbook.cpp @@ -22,7 +22,7 @@ void PacketSpellbook::Packet(RakNet::BitStream *bs, BasePlayer *player, bool sen RW(player->spellbook.count, send); - for (int i = 0; i < player->spellbook.count; i++) + for (unsigned int i = 0; i < player->spellbook.count; i++) { Spell spell;