diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-07-08 20:42:40 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-07-08 20:42:40 +0300 |
commit | 1fcd75140b847a0e50584fc07fc47d90c9dd9fa8 (patch) | |
tree | 5c1b23c7eabc7d421f46d40ab0bf787ef7dac49b /src/net | |
parent | 53bc0b25c23f8f24d4119ae6fb5ba6ca0a91be19 (diff) | |
download | mv-1fcd75140b847a0e50584fc07fc47d90c9dd9fa8.tar.gz mv-1fcd75140b847a0e50584fc07fc47d90c9dd9fa8.tar.bz2 mv-1fcd75140b847a0e50584fc07fc47d90c9dd9fa8.tar.xz mv-1fcd75140b847a0e50584fc07fc47d90c9dd9fa8.zip |
Add small optimisations and fixes.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/inventoryhandler.h | 4 | ||||
-rw-r--r-- | src/net/manaserv/inventoryhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/manaserv/inventoryhandler.h | 4 | ||||
-rw-r--r-- | src/net/manaserv/partyhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/manaserv/partyhandler.h | 11 | ||||
-rw-r--r-- | src/net/manaserv/playerhandler.cpp | 8 | ||||
-rw-r--r-- | src/net/manaserv/playerhandler.h | 8 | ||||
-rw-r--r-- | src/net/partyhandler.h | 6 | ||||
-rw-r--r-- | src/net/playerhandler.h | 8 | ||||
-rw-r--r-- | src/net/tmwa/inventoryhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/tmwa/inventoryhandler.h | 4 | ||||
-rw-r--r-- | src/net/tmwa/partyhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/partyhandler.h | 6 | ||||
-rw-r--r-- | src/net/tmwa/playerhandler.cpp | 8 | ||||
-rw-r--r-- | src/net/tmwa/playerhandler.h | 8 |
15 files changed, 45 insertions, 42 deletions
diff --git a/src/net/inventoryhandler.h b/src/net/inventoryhandler.h index e34eb5e55..06c73d288 100644 --- a/src/net/inventoryhandler.h +++ b/src/net/inventoryhandler.h @@ -45,7 +45,7 @@ class InventoryHandler virtual void dropItem(const Item *item, int amount) = 0; - virtual bool canSplit(const Item *item) = 0; + virtual bool canSplit(const Item *item) const = 0; virtual void splitItem(const Item *item, int amount) = 0; @@ -63,7 +63,7 @@ class InventoryHandler // TODO: fix/remove me virtual size_t getSize(int type) const = 0; - virtual int convertFromServerSlot(int eAthenaSlot) = 0; + virtual int convertFromServerSlot(int eAthenaSlot) const = 0; // virtual ~InventoryHandler() {} }; diff --git a/src/net/manaserv/inventoryhandler.cpp b/src/net/manaserv/inventoryhandler.cpp index 75823be51..5e38354fb 100644 --- a/src/net/manaserv/inventoryhandler.cpp +++ b/src/net/manaserv/inventoryhandler.cpp @@ -151,7 +151,7 @@ void InventoryHandler::dropItem(const Item *item, int amount) gameServerConnection->send(msg); } -bool InventoryHandler::canSplit(const Item *item) +bool InventoryHandler::canSplit(const Item *item) const { return item && !item->isEquipment() && item->getQuantity() > 1; } @@ -212,7 +212,7 @@ size_t InventoryHandler::getSize(int type) const } } -int InventoryHandler::convertFromServerSlot(int eAthenaSlot) +int InventoryHandler::convertFromServerSlot(int eAthenaSlot) const { return eAthenaSlot; } diff --git a/src/net/manaserv/inventoryhandler.h b/src/net/manaserv/inventoryhandler.h index 6b24699b0..fbe53d735 100644 --- a/src/net/manaserv/inventoryhandler.h +++ b/src/net/manaserv/inventoryhandler.h @@ -84,7 +84,7 @@ class InventoryHandler : public MessageHandler, Net::InventoryHandler void dropItem(const Item *item, int amount); - bool canSplit(const Item *item); + bool canSplit(const Item *item) const; void splitItem(const Item *item, int amount); @@ -99,7 +99,7 @@ class InventoryHandler : public MessageHandler, Net::InventoryHandler size_t getSize(int type) const; - int convertFromServerSlot(int eAthenaSlot); + int convertFromServerSlot(int eAthenaSlot) const; private: EquipBackend mEquips; diff --git a/src/net/manaserv/partyhandler.cpp b/src/net/manaserv/partyhandler.cpp index b3d69e826..9a5f19678 100644 --- a/src/net/manaserv/partyhandler.cpp +++ b/src/net/manaserv/partyhandler.cpp @@ -186,7 +186,7 @@ void PartyHandler::chat(const std::string &text A_UNUSED) // TODO } -void PartyHandler::requestPartyMembers() +void PartyHandler::requestPartyMembers() const { //MessageOut msg(PCMSG_GUILD_GET_MEMBERS); diff --git a/src/net/manaserv/partyhandler.h b/src/net/manaserv/partyhandler.h index 45cc39e05..7403d0e36 100644 --- a/src/net/manaserv/partyhandler.h +++ b/src/net/manaserv/partyhandler.h @@ -65,13 +65,16 @@ public: void chat(const std::string &text); - void requestPartyMembers(); + void requestPartyMembers() const; - PartyShare getShareExperience() { return PARTY_SHARE_NO; } + PartyShare getShareExperience() const + { return PARTY_SHARE_NO; } - void setShareExperience(PartyShare share A_UNUSED) {} + void setShareExperience(PartyShare share A_UNUSED) + { } - PartyShare getShareItems() { return PARTY_SHARE_NO; } + PartyShare getShareItems() const + { return PARTY_SHARE_NO; } void setShareItems(PartyShare share A_UNUSED) {} private: diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp index 5ac058b7e..1194cb9f2 100644 --- a/src/net/manaserv/playerhandler.cpp +++ b/src/net/manaserv/playerhandler.cpp @@ -417,22 +417,22 @@ void PlayerHandler::ignoreAll(bool ignore A_UNUSED) // TODO } -bool PlayerHandler::canUseMagic() +bool PlayerHandler::canUseMagic() const { return true; } -bool PlayerHandler::canCorrectAttributes() +bool PlayerHandler::canCorrectAttributes() const { return true; } -int PlayerHandler::getJobLocation() +int PlayerHandler::getJobLocation() const { return -1; } -Vector PlayerHandler::getDefaultWalkSpeed() +Vector PlayerHandler::getDefaultWalkSpeed() const { // Return translation in pixels per ticks. return ManaServ::BeingHandler::giveSpeedInPixelsPerTicks(6.0f); diff --git a/src/net/manaserv/playerhandler.h b/src/net/manaserv/playerhandler.h index 2460877ec..dcd05d5fc 100644 --- a/src/net/manaserv/playerhandler.h +++ b/src/net/manaserv/playerhandler.h @@ -70,12 +70,12 @@ class PlayerHandler : public MessageHandler, public Net::PlayerHandler void ignorePlayer(const std::string &player, bool ignore); void ignoreAll(bool ignore); - bool canUseMagic(); - bool canCorrectAttributes(); + bool canUseMagic() const; + bool canCorrectAttributes() const; - int getJobLocation(); + int getJobLocation() const; - Vector getDefaultWalkSpeed(); + Vector getDefaultWalkSpeed() const; private: void handleMapChangeMessage(Net::MessageIn &msg); diff --git a/src/net/partyhandler.h b/src/net/partyhandler.h index e78db209b..e33bac383 100644 --- a/src/net/partyhandler.h +++ b/src/net/partyhandler.h @@ -63,13 +63,13 @@ class PartyHandler virtual void chat(const std::string &text) = 0; - virtual void requestPartyMembers() = 0; + virtual void requestPartyMembers() const = 0; - virtual PartyShare getShareExperience() = 0; + virtual PartyShare getShareExperience() const = 0; virtual void setShareExperience(PartyShare share) = 0; - virtual PartyShare getShareItems() = 0; + virtual PartyShare getShareItems() const = 0; virtual void setShareItems(PartyShare share) = 0; diff --git a/src/net/playerhandler.h b/src/net/playerhandler.h index 524340458..2abd12d57 100644 --- a/src/net/playerhandler.h +++ b/src/net/playerhandler.h @@ -62,13 +62,13 @@ class PlayerHandler virtual void ignoreAll(bool ignore) = 0; - virtual bool canUseMagic() = 0; + virtual bool canUseMagic() const = 0; - virtual bool canCorrectAttributes() = 0; + virtual bool canCorrectAttributes() const = 0; - virtual int getJobLocation() = 0; + virtual int getJobLocation() const = 0; - virtual Vector getDefaultWalkSpeed() = 0; + virtual Vector getDefaultWalkSpeed() const = 0; }; } // namespace Net diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 734c8403e..43f04d2dc 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -618,7 +618,7 @@ void InventoryHandler::dropItem(const Item *item, int amount) outMsg.writeInt16(static_cast<Sint16>(amount)); } -bool InventoryHandler::canSplit(const Item *item A_UNUSED) +bool InventoryHandler::canSplit(const Item *item A_UNUSED) const { return false; } @@ -678,7 +678,7 @@ size_t InventoryHandler::getSize(int type) const return 0; } } -int InventoryHandler::convertFromServerSlot(int serverSlot) +int InventoryHandler::convertFromServerSlot(int serverSlot) const { if (serverSlot < 0 || serverSlot > 13) return 0; diff --git a/src/net/tmwa/inventoryhandler.h b/src/net/tmwa/inventoryhandler.h index 5866f9077..f831f7a78 100644 --- a/src/net/tmwa/inventoryhandler.h +++ b/src/net/tmwa/inventoryhandler.h @@ -153,7 +153,7 @@ class InventoryHandler : public MessageHandler, public Net::InventoryHandler void dropItem(const Item *item, int amount); - bool canSplit(const Item *item); + bool canSplit(const Item *item) const; void splitItem(const Item *item, int amount); @@ -168,7 +168,7 @@ class InventoryHandler : public MessageHandler, public Net::InventoryHandler size_t getSize(int type) const; - int convertFromServerSlot(int serverSlot); + int convertFromServerSlot(int serverSlot) const; void pushPickup(int floorId) { mSentPickups.push(floorId); } diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp index f057b6f5f..f8e1e4de8 100644 --- a/src/net/tmwa/partyhandler.cpp +++ b/src/net/tmwa/partyhandler.cpp @@ -544,7 +544,7 @@ void PartyHandler::chat(const std::string &text) outMsg.writeString(text, static_cast<int>(text.length())); } -void PartyHandler::requestPartyMembers() +void PartyHandler::requestPartyMembers() const { // Our eAthena doesn't have this message // Not needed anyways diff --git a/src/net/tmwa/partyhandler.h b/src/net/tmwa/partyhandler.h index b2e08d12d..207bc5f26 100644 --- a/src/net/tmwa/partyhandler.h +++ b/src/net/tmwa/partyhandler.h @@ -64,14 +64,14 @@ class PartyHandler : public MessageHandler, public Net::PartyHandler void chat(const std::string &text); - void requestPartyMembers(); + void requestPartyMembers() const; - PartyShare getShareExperience() + PartyShare getShareExperience() const { return mShareExp; } void setShareExperience(PartyShare share); - PartyShare getShareItems() + PartyShare getShareItems() const { return mShareItems; } void setShareItems(PartyShare share); diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index 62027cdd4..18bed203f 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -759,22 +759,22 @@ void PlayerHandler::ignoreAll(bool ignore A_UNUSED) // TODO } -bool PlayerHandler::canUseMagic() +bool PlayerHandler::canUseMagic() const { return PlayerInfo::getStatEffective(MATK) > 0; } -bool PlayerHandler::canCorrectAttributes() +bool PlayerHandler::canCorrectAttributes() const { return false; } -int PlayerHandler::getJobLocation() +int PlayerHandler::getJobLocation() const { return JOB; } -Vector PlayerHandler::getDefaultWalkSpeed() +Vector PlayerHandler::getDefaultWalkSpeed() const { // Return an normalized speed for any side // as the offset is calculated elsewhere. diff --git a/src/net/tmwa/playerhandler.h b/src/net/tmwa/playerhandler.h index d4e232ecf..fc4230856 100644 --- a/src/net/tmwa/playerhandler.h +++ b/src/net/tmwa/playerhandler.h @@ -62,12 +62,12 @@ class PlayerHandler : public MessageHandler, public Net::PlayerHandler void ignorePlayer(const std::string &player, bool ignore); void ignoreAll(bool ignore); - bool canUseMagic(); - bool canCorrectAttributes(); + bool canUseMagic() const; + bool canCorrectAttributes() const; - int getJobLocation(); + int getJobLocation() const; - Vector getDefaultWalkSpeed(); + Vector getDefaultWalkSpeed() const; }; } // namespace TmwAthena |