From 122a30c18362c931e14460e285c5cca28949e8e9 Mon Sep 17 00:00:00 2001 From: Koncord Date: Sun, 10 Dec 2017 09:07:40 +0800 Subject: [PATCH] [General] Change type of refNumIndex & mpNum to unsigned --- apps/openmw-mp/Actors.cpp | 8 ++++---- apps/openmw-mp/Actors.hpp | 10 +++++----- apps/openmw-mp/Cell.cpp | 10 +++++----- apps/openmw-mp/Cell.hpp | 6 +++--- apps/openmw-mp/Object.cpp | 8 ++++---- apps/openmw-mp/Object.hpp | 8 ++++---- apps/openmw/mwworld/cellref.cpp | 4 ++-- apps/openmw/mwworld/cellref.hpp | 4 ++-- components/esm/cellref.hpp | 2 +- components/openmw-mp/Base/BaseActor.hpp | 4 ++-- components/openmw-mp/Base/BaseEvent.hpp | 4 ++-- components/openmw-mp/Base/BasePlayer.hpp | 4 ++-- 12 files changed, 36 insertions(+), 36 deletions(-) diff --git a/apps/openmw-mp/Actors.cpp b/apps/openmw-mp/Actors.cpp index b98930dcc..1f7f379e4 100644 --- a/apps/openmw-mp/Actors.cpp +++ b/apps/openmw-mp/Actors.cpp @@ -54,22 +54,22 @@ void Actor::setRefId(const std::string &refId) actor->refId = refId; } -int Actor::getRefNumIndex() const +unsigned Actor::getRefNumIndex() const { return actor->refNumIndex; } -void Actor::setRefNumIndex(int refNumIndex) +void Actor::setRefNumIndex(unsigned refNumIndex) { actor->refNumIndex = refNumIndex; } -int Actor::getMpNum() const +unsigned Actor::getMpNum() const { return actor->mpNum; } -void Actor::setMpNum(int mpNum) +void Actor::setMpNum(unsigned mpNum) { actor->mpNum = mpNum; } diff --git a/apps/openmw-mp/Actors.hpp b/apps/openmw-mp/Actors.hpp index c4dc1d89b..f6915b267 100644 --- a/apps/openmw-mp/Actors.hpp +++ b/apps/openmw-mp/Actors.hpp @@ -20,11 +20,11 @@ public: Actor(); std::string getRefId() const; void setRefId(const std::string &refId); - - int getRefNumIndex() const; - void setRefNumIndex(int refNumIndex); - int getMpNum() const; - void setMpNum(int mpNum); + + unsigned getRefNumIndex() const; + void setRefNumIndex(unsigned refNumIndex); + unsigned getMpNum() const; + void setMpNum(unsigned mpNum); bool doesHavePosition() const; // ???? bool doesHaveStatsDynamic() const; // ???? diff --git a/apps/openmw-mp/Cell.cpp b/apps/openmw-mp/Cell.cpp index 45d05cd3f..9c54a9602 100644 --- a/apps/openmw-mp/Cell.cpp +++ b/apps/openmw-mp/Cell.cpp @@ -13,7 +13,7 @@ using namespace std; -Cell::Cell(ESM::Cell cell) : cell(cell) +Cell::Cell(const ESM::Cell &cell) : cell(cell) { } @@ -111,7 +111,7 @@ void Cell::readActorList(unsigned char packetID, const mwmp::BaseActorList *newA } } -bool Cell::containsActor(int refNumIndex, int mpNum) +bool Cell::containsActor(unsigned refNumIndex, unsigned mpNum) { for (const auto &actor : cellActorList.baseActors) { @@ -121,7 +121,7 @@ bool Cell::containsActor(int refNumIndex, int mpNum) return false; } -mwmp::BaseActor *Cell::getActor(int refNumIndex, int mpNum) +mwmp::BaseActor *Cell::getActor(unsigned refNumIndex, unsigned mpNum) { for (const auto &actor : cellActorList.baseActors) { @@ -135,8 +135,8 @@ void Cell::removeActors(const mwmp::BaseActorList &newActorList) { for (auto it = cellActorList.baseActors.begin(); it != cellActorList.baseActors.end();) { - int refNumIndex = (*it)->refNumIndex; - int mpNum = (*it)->mpNum; + unsigned refNumIndex = (*it)->refNumIndex; + unsigned mpNum = (*it)->mpNum; bool foundActor = false; diff --git a/apps/openmw-mp/Cell.hpp b/apps/openmw-mp/Cell.hpp index f3554b40b..8b2748dcf 100644 --- a/apps/openmw-mp/Cell.hpp +++ b/apps/openmw-mp/Cell.hpp @@ -20,7 +20,7 @@ class Cell { friend class CellController; public: - Cell(ESM::Cell cell); + Cell(const ESM::Cell &cell); typedef std::deque TPlayers; typedef TPlayers::const_iterator Iterator; @@ -31,8 +31,8 @@ public: void removePlayer(Player *player); void readActorList(unsigned char packetID, const mwmp::BaseActorList *newActorList); - bool containsActor(int refNumIndex, int mpNum); - mwmp::BaseActor *getActor(int refNumIndex, int mpNum); + bool containsActor(unsigned refNumIndex, unsigned mpNum); + mwmp::BaseActor *getActor(unsigned refNumIndex, unsigned mpNum); void removeActors(const mwmp::BaseActorList &newActorList); RakNet::RakNetGUID *getAuthority(); diff --git a/apps/openmw-mp/Object.cpp b/apps/openmw-mp/Object.cpp index 6192cf315..731726d0e 100644 --- a/apps/openmw-mp/Object.cpp +++ b/apps/openmw-mp/Object.cpp @@ -89,23 +89,23 @@ void BaseObject::setRefId(const string &refId) object.refId = refId; } -int BaseObject::getRefNum() const +unsigned BaseObject::getRefNum() const { return object.refNumIndex; } -void BaseObject::setRefNum(int refNum) +void BaseObject::setRefNum(unsigned refNum) { changedBase = true; object.refNumIndex = refNum; } -int BaseObject::getMpNum() const +unsigned BaseObject::getMpNum() const { return object.mpNum; } -void BaseObject::setMpNum(int mpNum) +void BaseObject::setMpNum(unsigned mpNum) { changedBase = true; object.mpNum = mpNum; diff --git a/apps/openmw-mp/Object.hpp b/apps/openmw-mp/Object.hpp index f482a795f..30c44b82a 100644 --- a/apps/openmw-mp/Object.hpp +++ b/apps/openmw-mp/Object.hpp @@ -18,11 +18,11 @@ public: std::string getRefId() const; void setRefId(const std::string &refId); - int getRefNum() const; - void setRefNum(int refNum); + unsigned getRefNum() const; + void setRefNum(unsigned refNum); - int getMpNum() const; - void setMpNum(int mpNum); + unsigned getMpNum() const; + void setMpNum(unsigned mpNum); //void setEventCell(const std::string &cellDescription); diff --git a/apps/openmw/mwworld/cellref.cpp b/apps/openmw/mwworld/cellref.cpp index 952d1cde9..0dd4845aa 100644 --- a/apps/openmw/mwworld/cellref.cpp +++ b/apps/openmw/mwworld/cellref.cpp @@ -25,7 +25,7 @@ namespace MWWorld Get the mMpNum (unique multiplayer reference number) of a CellRef */ - int CellRef::getMpNum() const + unsigned CellRef::getMpNum() const { return mCellRef.mMpNum; } @@ -38,7 +38,7 @@ namespace MWWorld Set the mMpNum (unique multiplayer reference number) of a CellRef */ - void CellRef::setMpNum(int index) + void CellRef::setMpNum(unsigned index) { mCellRef.mMpNum = index; } diff --git a/apps/openmw/mwworld/cellref.hpp b/apps/openmw/mwworld/cellref.hpp index 790b589bc..00aabf0da 100644 --- a/apps/openmw/mwworld/cellref.hpp +++ b/apps/openmw/mwworld/cellref.hpp @@ -33,7 +33,7 @@ namespace MWWorld Get the mMpNum (unique multiplayer reference number) of a CellRef */ - int getMpNum() const; + unsigned getMpNum() const; /* End of tes3mp addition */ @@ -43,7 +43,7 @@ namespace MWWorld Set the mMpNum (unique multiplayer reference number) of a CellRef */ - void setMpNum(int index); + void setMpNum(unsigned index); /* End of tes3mp addition */ diff --git a/components/esm/cellref.hpp b/components/esm/cellref.hpp index a8a90357a..28d5a56a6 100644 --- a/components/esm/cellref.hpp +++ b/components/esm/cellref.hpp @@ -43,7 +43,7 @@ namespace ESM Keep track of a multiplayer-only number unique to this object */ - int mMpNum; + unsigned mMpNum; /* End of tes3mp addition */ diff --git a/components/openmw-mp/Base/BaseActor.hpp b/components/openmw-mp/Base/BaseActor.hpp index e7af6b689..fda4d1331 100644 --- a/components/openmw-mp/Base/BaseActor.hpp +++ b/components/openmw-mp/Base/BaseActor.hpp @@ -26,8 +26,8 @@ namespace mwmp } std::string refId; - int refNumIndex; - int mpNum; + unsigned refNumIndex; + unsigned mpNum; std::string response; std::string sound; diff --git a/components/openmw-mp/Base/BaseEvent.hpp b/components/openmw-mp/Base/BaseEvent.hpp index 38325c321..b9e6e09c6 100644 --- a/components/openmw-mp/Base/BaseEvent.hpp +++ b/components/openmw-mp/Base/BaseEvent.hpp @@ -24,8 +24,8 @@ namespace mwmp struct WorldObject { std::string refId; - int refNumIndex; - int mpNum; + unsigned refNumIndex; + unsigned mpNum; int count; int charge; int goldValue; diff --git a/components/openmw-mp/Base/BasePlayer.hpp b/components/openmw-mp/Base/BasePlayer.hpp index 76d73b7b7..79af7c271 100644 --- a/components/openmw-mp/Base/BasePlayer.hpp +++ b/components/openmw-mp/Base/BasePlayer.hpp @@ -37,8 +37,8 @@ namespace mwmp struct CurrentContainer { std::string refId; - int refNumIndex; - int mpNum; + unsigned refNumIndex; + unsigned mpNum; bool loot; };