summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-07-08 20:42:40 +0300
committerAndrei Karas <akaras@inbox.ru>2011-07-08 20:42:40 +0300
commit1fcd75140b847a0e50584fc07fc47d90c9dd9fa8 (patch)
tree5c1b23c7eabc7d421f46d40ab0bf787ef7dac49b /src
parent53bc0b25c23f8f24d4119ae6fb5ba6ca0a91be19 (diff)
downloadplus-1fcd75140b847a0e50584fc07fc47d90c9dd9fa8.tar.gz
plus-1fcd75140b847a0e50584fc07fc47d90c9dd9fa8.tar.bz2
plus-1fcd75140b847a0e50584fc07fc47d90c9dd9fa8.tar.xz
plus-1fcd75140b847a0e50584fc07fc47d90c9dd9fa8.zip
Add small optimisations and fixes.
Diffstat (limited to 'src')
-rw-r--r--src/gui/outfitwindow.cpp4
-rw-r--r--src/gui/outfitwindow.h4
-rw-r--r--src/gui/widgets/layouthelper.cpp2
-rw-r--r--src/gui/widgets/layouthelper.h2
-rw-r--r--src/net/inventoryhandler.h4
-rw-r--r--src/net/manaserv/inventoryhandler.cpp4
-rw-r--r--src/net/manaserv/inventoryhandler.h4
-rw-r--r--src/net/manaserv/partyhandler.cpp2
-rw-r--r--src/net/manaserv/partyhandler.h11
-rw-r--r--src/net/manaserv/playerhandler.cpp8
-rw-r--r--src/net/manaserv/playerhandler.h8
-rw-r--r--src/net/partyhandler.h6
-rw-r--r--src/net/playerhandler.h8
-rw-r--r--src/net/tmwa/inventoryhandler.cpp4
-rw-r--r--src/net/tmwa/inventoryhandler.h4
-rw-r--r--src/net/tmwa/partyhandler.cpp2
-rw-r--r--src/net/tmwa/partyhandler.h6
-rw-r--r--src/net/tmwa/playerhandler.cpp8
-rw-r--r--src/net/tmwa/playerhandler.h8
-rw-r--r--src/resources/itemdb.h1
20 files changed, 52 insertions, 48 deletions
diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp
index 93dbd77a9..9dd41a643 100644
--- a/src/gui/outfitwindow.cpp
+++ b/src/gui/outfitwindow.cpp
@@ -487,7 +487,7 @@ void OutfitWindow::unequipNotInOutfit(int outfit)
}
}
-int OutfitWindow::keyToNumber(SDLKey key)
+int OutfitWindow::keyToNumber(SDLKey key) const
{
int outfitNum = -1;
switch (key)
@@ -672,7 +672,7 @@ int OutfitWindow::keyToNumber(SDLKey key)
return outfitNum;
}
-SDLKey OutfitWindow::numberToKey(int number)
+SDLKey OutfitWindow::numberToKey(int number) const
{
SDLKey key = SDLK_UNKNOWN;
switch (number)
diff --git a/src/gui/outfitwindow.h b/src/gui/outfitwindow.h
index 7fd29608c..2d2f6271b 100644
--- a/src/gui/outfitwindow.h
+++ b/src/gui/outfitwindow.h
@@ -82,9 +82,9 @@ class OutfitWindow : public Window, gcn::ActionListener
void unequipNotInOutfit(int outfit);
- int keyToNumber(SDLKey key);
+ int keyToNumber(SDLKey key) const;
- SDLKey numberToKey(int number);
+ SDLKey numberToKey(int number) const;
void next();
diff --git a/src/gui/widgets/layouthelper.cpp b/src/gui/widgets/layouthelper.cpp
index ace204143..54c41635f 100644
--- a/src/gui/widgets/layouthelper.cpp
+++ b/src/gui/widgets/layouthelper.cpp
@@ -35,7 +35,7 @@ LayoutHelper::~LayoutHelper()
mContainer->removeWidgetListener(this);
}
-Layout &LayoutHelper::getLayout()
+const Layout &LayoutHelper::getLayout() const
{
return mLayout;
}
diff --git a/src/gui/widgets/layouthelper.h b/src/gui/widgets/layouthelper.h
index 9b2795be7..c38356c07 100644
--- a/src/gui/widgets/layouthelper.h
+++ b/src/gui/widgets/layouthelper.h
@@ -54,7 +54,7 @@ class LayoutHelper : public gcn::WidgetListener
/**
* Gets the layout handler.
*/
- Layout &getLayout();
+ const Layout &getLayout() const;
/**
* Computes the position of the widgets according to the current
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
diff --git a/src/resources/itemdb.h b/src/resources/itemdb.h
index dedaa9ad1..267f60eef 100644
--- a/src/resources/itemdb.h
+++ b/src/resources/itemdb.h
@@ -65,6 +65,7 @@ namespace ItemDB
const std::map<int, ItemInfo*> &getItemInfos();
int getTagId(std::string tagName);
+
struct Stat
{
Stat(const std::string &tag,