summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-09-18 21:52:15 +0300
committerAndrei Karas <akaras@inbox.ru>2013-09-18 21:52:15 +0300
commit78744020528ef6231e1606bbe2e8c53011c77935 (patch)
tree3055821a8dabab37c660fdc3b99309f970158b69 /src
parentc0d5142d1ed98b62ad87603fa9d2620dce256bd7 (diff)
downloadmv-78744020528ef6231e1606bbe2e8c53011c77935.tar.gz
mv-78744020528ef6231e1606bbe2e8c53011c77935.tar.bz2
mv-78744020528ef6231e1606bbe2e8c53011c77935.tar.xz
mv-78744020528ef6231e1606bbe2e8c53011c77935.zip
add const to net classes.
Diffstat (limited to 'src')
-rw-r--r--src/net/adminhandler.h2
-rw-r--r--src/net/ea/adminhandler.cpp3
-rw-r--r--src/net/ea/adminhandler.h8
-rw-r--r--src/net/ea/itemhandler.cpp6
-rw-r--r--src/net/ea/itemhandler.h6
-rw-r--r--src/net/ea/partyhandler.cpp2
-rw-r--r--src/net/ea/partyhandler.h2
-rw-r--r--src/net/ea/tradehandler.cpp14
-rw-r--r--src/net/ea/tradehandler.h14
-rw-r--r--src/net/eathena/messagehandler.cpp2
-rw-r--r--src/net/eathena/messagehandler.h2
-rw-r--r--src/net/eathena/network.cpp4
-rw-r--r--src/net/eathena/network.h4
-rw-r--r--src/net/messagein.cpp2
-rw-r--r--src/net/messagein.h2
-rw-r--r--src/net/messageout.cpp4
-rw-r--r--src/net/messageout.h2
-rw-r--r--src/net/packetcounters.cpp4
-rw-r--r--src/net/packetcounters.h4
-rw-r--r--src/net/partyhandler.h2
-rw-r--r--src/net/sdltcpnet.cpp2
-rw-r--r--src/net/sdltcpnet.h2
-rw-r--r--src/net/tmwa/messagehandler.cpp2
-rw-r--r--src/net/tmwa/messagehandler.h2
-rw-r--r--src/net/tmwa/network.cpp4
-rw-r--r--src/net/tmwa/network.h4
26 files changed, 53 insertions, 52 deletions
diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h
index c3b58fa9e..81e32062e 100644
--- a/src/net/adminhandler.h
+++ b/src/net/adminhandler.h
@@ -60,7 +60,7 @@ class AdminHandler
const int x, const int y) const = 0;
virtual void createItems(const int id, const int color,
- const int amount) = 0;
+ const int amount) const = 0;
virtual void gotoName(const std::string &name) const = 0;
diff --git a/src/net/ea/adminhandler.cpp b/src/net/ea/adminhandler.cpp
index 583239f0c..36a08bc4c 100644
--- a/src/net/ea/adminhandler.cpp
+++ b/src/net/ea/adminhandler.cpp
@@ -93,7 +93,8 @@ void AdminHandler::ipcheckName(const std::string &name) const
Net::getChatHandler()->talk("@ipcheck " + name, GENERAL_CHANNEL);
}
-void AdminHandler::createItems(const int id, const int color, const int amount)
+void AdminHandler::createItems(const int id, const int color,
+ const int amount) const
{
if (serverVersion < 1)
{
diff --git a/src/net/ea/adminhandler.h b/src/net/ea/adminhandler.h
index f32c02ffd..8a2697584 100644
--- a/src/net/ea/adminhandler.h
+++ b/src/net/ea/adminhandler.h
@@ -59,14 +59,14 @@ class AdminHandler : public Net::AdminHandler
void gotoName(const std::string &name) const;
- void recallName(const std::string &name) const;
+ void recallName(const std::string &name) const override;
- void reviveName(const std::string &name) const;
+ void reviveName(const std::string &name) const override;
- void ipcheckName(const std::string &name) const;
+ void ipcheckName(const std::string &name) const override;
void createItems(const int id, const int color,
- const int amount);
+ const int amount) const override;
};
} // namespace Ea
diff --git a/src/net/ea/itemhandler.cpp b/src/net/ea/itemhandler.cpp
index aafe6fc4b..9c9a74b2d 100644
--- a/src/net/ea/itemhandler.cpp
+++ b/src/net/ea/itemhandler.cpp
@@ -37,7 +37,7 @@ ItemHandler::~ItemHandler()
{
}
-void ItemHandler::processItemVisible(Net::MessageIn &msg)
+void ItemHandler::processItemVisible(Net::MessageIn &msg) const
{
const int id = msg.readInt32();
const int itemId = msg.readInt16();
@@ -55,7 +55,7 @@ void ItemHandler::processItemVisible(Net::MessageIn &msg)
}
}
-void ItemHandler::processItemDropped(Net::MessageIn &msg)
+void ItemHandler::processItemDropped(Net::MessageIn &msg) const
{
const int id = msg.readInt32();
const int itemId = msg.readInt16();
@@ -73,7 +73,7 @@ void ItemHandler::processItemDropped(Net::MessageIn &msg)
}
}
-void ItemHandler::processItemRemove(Net::MessageIn &msg)
+void ItemHandler::processItemRemove(Net::MessageIn &msg) const
{
if (actorSpriteManager)
{
diff --git a/src/net/ea/itemhandler.h b/src/net/ea/itemhandler.h
index 8847090f6..ec45cfba3 100644
--- a/src/net/ea/itemhandler.h
+++ b/src/net/ea/itemhandler.h
@@ -37,11 +37,11 @@ class ItemHandler
virtual ~ItemHandler();
- void processItemVisible(Net::MessageIn &msg);
+ void processItemVisible(Net::MessageIn &msg) const;
- void processItemRemove(Net::MessageIn &msg);
+ void processItemRemove(Net::MessageIn &msg) const;
- void processItemDropped(Net::MessageIn &msg);
+ void processItemDropped(Net::MessageIn &msg) const;
};
} // namespace Ea
diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp
index 8bb8b6a8a..b7353be26 100644
--- a/src/net/ea/partyhandler.cpp
+++ b/src/net/ea/partyhandler.cpp
@@ -431,7 +431,7 @@ void PartyHandler::processPartyMessage(Net::MessageIn &msg) const
}
}
-ChatTab *PartyHandler::getTab()
+ChatTab *PartyHandler::getTab() const
{
return partyTab;
}
diff --git a/src/net/ea/partyhandler.h b/src/net/ea/partyhandler.h
index 4b829f73e..ced44a426 100644
--- a/src/net/ea/partyhandler.h
+++ b/src/net/ea/partyhandler.h
@@ -53,7 +53,7 @@ class PartyHandler : public Net::PartyHandler
void clear() const override;
- ChatTab *getTab() override;
+ ChatTab *getTab() const override;
virtual void processPartyCreate(Net::MessageIn &msg) const;
diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp
index 77f71d75a..3e1e5c5b3 100644
--- a/src/net/ea/tradehandler.cpp
+++ b/src/net/ea/tradehandler.cpp
@@ -75,7 +75,7 @@ void TradeHandler::removeItem(const int slotNum A_UNUSED,
{
}
-void TradeHandler::processTradeRequest(Net::MessageIn &msg)
+void TradeHandler::processTradeRequest(Net::MessageIn &msg) const
{
// If a trade window or request window is already open, send a
// trade cancel to any other trade request.
@@ -123,7 +123,7 @@ void TradeHandler::processTradeRequest(Net::MessageIn &msg)
}
}
-void TradeHandler::processTradeResponse(Net::MessageIn &msg)
+void TradeHandler::processTradeResponse(Net::MessageIn &msg) const
{
if (confirmDlg || tradePartnerName.empty()
|| !player_relations.hasPermission(tradePartnerName,
@@ -182,7 +182,7 @@ void TradeHandler::processTradeResponse(Net::MessageIn &msg)
}
}
-void TradeHandler::processTradeItemAdd(Net::MessageIn &msg)
+void TradeHandler::processTradeItemAdd(Net::MessageIn &msg) const
{
const int amount = msg.readInt32();
const int type = msg.readInt16();
@@ -205,7 +205,7 @@ void TradeHandler::processTradeItemAdd(Net::MessageIn &msg)
}
}
-void TradeHandler::processTradeItemAddResponse(Net::MessageIn &msg)
+void TradeHandler::processTradeItemAddResponse(Net::MessageIn &msg) const
{
// Trade: New Item add response (was 0x00ea, now 01b1)
const int index = msg.readInt16() - INVENTORY_OFFSET;
@@ -258,7 +258,7 @@ void TradeHandler::processTradeItemAddResponse(Net::MessageIn &msg)
}
}
-void TradeHandler::processTradeOk(Net::MessageIn &msg)
+void TradeHandler::processTradeOk(Net::MessageIn &msg) const
{
// 0 means ok from myself, 1 means ok from other;
if (tradeWindow)
@@ -267,7 +267,7 @@ void TradeHandler::processTradeOk(Net::MessageIn &msg)
msg.readInt8();
}
-void TradeHandler::processTradeCancel(Net::MessageIn &msg A_UNUSED)
+void TradeHandler::processTradeCancel(Net::MessageIn &msg A_UNUSED) const
{
NotifyManager::notify(NotifyManager::TRADE_CANCELLED);
if (tradeWindow)
@@ -278,7 +278,7 @@ void TradeHandler::processTradeCancel(Net::MessageIn &msg A_UNUSED)
PlayerInfo::setTrading(false);
}
-void TradeHandler::processTradeComplete(Net::MessageIn &msg A_UNUSED)
+void TradeHandler::processTradeComplete(Net::MessageIn &msg A_UNUSED) const
{
NotifyManager::notify(NotifyManager::TRADE_COMPLETE);
if (tradeWindow)
diff --git a/src/net/ea/tradehandler.h b/src/net/ea/tradehandler.h
index 98dbd8383..31d0c2c76 100644
--- a/src/net/ea/tradehandler.h
+++ b/src/net/ea/tradehandler.h
@@ -38,19 +38,19 @@ class TradeHandler : public Net::TradeHandler
void removeItem(const int slotNum, const int amount) const override;
- void processTradeRequest(Net::MessageIn &msg);
+ void processTradeRequest(Net::MessageIn &msg) const;
- void processTradeResponse(Net::MessageIn &msg);
+ void processTradeResponse(Net::MessageIn &msg) const;
- void processTradeItemAdd(Net::MessageIn &msg);
+ void processTradeItemAdd(Net::MessageIn &msg) const;
- void processTradeItemAddResponse(Net::MessageIn &msg);
+ void processTradeItemAddResponse(Net::MessageIn &msg) const;
- void processTradeOk(Net::MessageIn &msg);
+ void processTradeOk(Net::MessageIn &msg) const;
- void processTradeCancel(Net::MessageIn &msg);
+ void processTradeCancel(Net::MessageIn &msg) const;
- void processTradeComplete(Net::MessageIn &msg);
+ void processTradeComplete(Net::MessageIn &msg) const;
};
} // namespace Ea
diff --git a/src/net/eathena/messagehandler.cpp b/src/net/eathena/messagehandler.cpp
index bf7753e4f..222c86390 100644
--- a/src/net/eathena/messagehandler.cpp
+++ b/src/net/eathena/messagehandler.cpp
@@ -43,7 +43,7 @@ MessageHandler::~MessageHandler()
mNetwork->unregisterHandler(this);
}
-void MessageHandler::setNetwork(Network *network)
+void MessageHandler::setNetwork(Network *const network)
{
assert(!(network && mNetwork));
mNetwork = network;
diff --git a/src/net/eathena/messagehandler.h b/src/net/eathena/messagehandler.h
index bc67f3246..ade96baba 100644
--- a/src/net/eathena/messagehandler.h
+++ b/src/net/eathena/messagehandler.h
@@ -44,7 +44,7 @@ class MessageHandler : public Net::MessageHandler
~MessageHandler();
- void setNetwork(Network *network);
+ void setNetwork(Network *const network);
protected:
Network *mNetwork;
diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp
index 24c3a70fa..4786d9ee7 100644
--- a/src/net/eathena/network.cpp
+++ b/src/net/eathena/network.cpp
@@ -124,7 +124,7 @@ Network::~Network()
mInstance = nullptr;
}
-void Network::registerHandler(MessageHandler *handler)
+void Network::registerHandler(MessageHandler *const handler)
{
if (!handler)
return;
@@ -135,7 +135,7 @@ void Network::registerHandler(MessageHandler *handler)
handler->setNetwork(this);
}
-void Network::unregisterHandler(MessageHandler *handler)
+void Network::unregisterHandler(MessageHandler *const handler)
{
if (!handler)
return;
diff --git a/src/net/eathena/network.h b/src/net/eathena/network.h
index 041c9889a..01caad450 100644
--- a/src/net/eathena/network.h
+++ b/src/net/eathena/network.h
@@ -45,9 +45,9 @@ class Network final : public Ea::Network
~Network();
- void registerHandler(MessageHandler *handler);
+ void registerHandler(MessageHandler *const handler);
- void unregisterHandler(MessageHandler *handler);
+ void unregisterHandler(MessageHandler *const handler);
void clearHandlers();
diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp
index 2bc054e8b..219ef8a2f 100644
--- a/src/net/messagein.cpp
+++ b/src/net/messagein.cpp
@@ -37,7 +37,7 @@
namespace Net
{
-MessageIn::MessageIn(const char *data, unsigned int length):
+MessageIn::MessageIn(const char *const data, const unsigned int length):
mData(data),
mLength(length),
mId(0),
diff --git a/src/net/messagein.h b/src/net/messagein.h
index 0197effec..47527a879 100644
--- a/src/net/messagein.h
+++ b/src/net/messagein.h
@@ -110,7 +110,7 @@ class MessageIn
/**
* Constructor.
*/
- MessageIn(const char *data, unsigned int length);
+ MessageIn(const char *const data, const unsigned int length);
const char *mData; /**< The message data. */
unsigned int mLength; /**< The length of the data. */
diff --git a/src/net/messageout.cpp b/src/net/messageout.cpp
index cb948cdd5..ab279020f 100644
--- a/src/net/messageout.cpp
+++ b/src/net/messageout.cpp
@@ -36,7 +36,7 @@
namespace Net
{
-MessageOut::MessageOut(int16_t id A_UNUSED):
+MessageOut::MessageOut(const int16_t id A_UNUSED):
mData(nullptr),
mDataSize(0),
mPos(0)
@@ -45,7 +45,7 @@ MessageOut::MessageOut(int16_t id A_UNUSED):
DEBUGLOG("MessageOut");
}
-void MessageOut::writeInt8(int8_t value)
+void MessageOut::writeInt8(const int8_t value)
{
DEBUGLOG("writeInt8: " + toStringPrint(static_cast<int>(value)));
expand(1);
diff --git a/src/net/messageout.h b/src/net/messageout.h
index 1d1b51b55..68d4b53a3 100644
--- a/src/net/messageout.h
+++ b/src/net/messageout.h
@@ -76,7 +76,7 @@ class MessageOut
/**
* Constructor.
*/
- explicit MessageOut(int16_t id);
+ explicit MessageOut(const int16_t id);
/**
* Expand the packet data to be able to hold more data.
diff --git a/src/net/packetcounters.cpp b/src/net/packetcounters.cpp
index 5b3faeb06..65ece62f8 100644
--- a/src/net/packetcounters.cpp
+++ b/src/net/packetcounters.cpp
@@ -38,7 +38,7 @@ int PacketCounters::mOutBytesCalc = 0;
int PacketCounters::mOutPackets = 0;
int PacketCounters::mOutPacketsCalc = 0;
-void PacketCounters::incInBytes(int cnt)
+void PacketCounters::incInBytes(const int cnt)
{
if (!runCounters)
return;
@@ -70,7 +70,7 @@ int PacketCounters::getInPackets()
return PacketCounters::mInPacketsCalc;
}
-void PacketCounters::incOutBytes(int cnt)
+void PacketCounters::incOutBytes(const int cnt)
{
if (!runCounters)
return;
diff --git a/src/net/packetcounters.h b/src/net/packetcounters.h
index afb5dab90..713a13451 100644
--- a/src/net/packetcounters.h
+++ b/src/net/packetcounters.h
@@ -28,7 +28,7 @@
class PacketCounters final
{
public:
- static void incInBytes(int cnt);
+ static void incInBytes(const int cnt);
static void incInPackets();
@@ -36,7 +36,7 @@ public:
static int getInPackets() A_WARN_UNUSED;
- static void incOutBytes(int cnt);
+ static void incOutBytes(const int cnt);
static void incOutPackets();
diff --git a/src/net/partyhandler.h b/src/net/partyhandler.h
index 3425f01b8..93854ff42 100644
--- a/src/net/partyhandler.h
+++ b/src/net/partyhandler.h
@@ -77,7 +77,7 @@ class PartyHandler
virtual void clear() const = 0;
- virtual ChatTab *getTab() = 0;
+ virtual ChatTab *getTab() const = 0;
};
} // namespace Net
diff --git a/src/net/sdltcpnet.cpp b/src/net/sdltcpnet.cpp
index cb6d6145e..4ea659ecf 100644
--- a/src/net/sdltcpnet.cpp
+++ b/src/net/sdltcpnet.cpp
@@ -146,7 +146,7 @@ int TcpNet::delSocket(const TcpNet::SocketSet set, const TcpNet::Socket sock)
return SDLNet_TCP_DelSocket(set, sock);
}
-void TcpNet::freeSocketSet(TcpNet::SocketSet set)
+void TcpNet::freeSocketSet(const TcpNet::SocketSet set)
{
SDLNet_FreeSocketSet(set);
}
diff --git a/src/net/sdltcpnet.h b/src/net/sdltcpnet.h
index 4f0a3df28..a61c218b8 100644
--- a/src/net/sdltcpnet.h
+++ b/src/net/sdltcpnet.h
@@ -55,7 +55,7 @@ namespace TcpNet
int delSocket(const TcpNet::SocketSet set, const TcpNet::Socket sock);
- void freeSocketSet(TcpNet::SocketSet set);
+ void freeSocketSet(const TcpNet::SocketSet set);
} // namespace TcpNet
#endif // NET_SDLTCPNET_H
diff --git a/src/net/tmwa/messagehandler.cpp b/src/net/tmwa/messagehandler.cpp
index 6de8ea645..66aa36e56 100644
--- a/src/net/tmwa/messagehandler.cpp
+++ b/src/net/tmwa/messagehandler.cpp
@@ -43,7 +43,7 @@ MessageHandler::~MessageHandler()
mNetwork->unregisterHandler(this);
}
-void MessageHandler::setNetwork(Network *network)
+void MessageHandler::setNetwork(Network *const network)
{
assert(!(network && mNetwork));
mNetwork = network;
diff --git a/src/net/tmwa/messagehandler.h b/src/net/tmwa/messagehandler.h
index 578926478..e012f7a8a 100644
--- a/src/net/tmwa/messagehandler.h
+++ b/src/net/tmwa/messagehandler.h
@@ -46,7 +46,7 @@ class MessageHandler : public Net::MessageHandler
~MessageHandler();
- void setNetwork(Network *network);
+ void setNetwork(Network *const network);
protected:
Network *mNetwork;
diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp
index 73288d4d1..a843c9b6b 100644
--- a/src/net/tmwa/network.cpp
+++ b/src/net/tmwa/network.cpp
@@ -102,7 +102,7 @@ Network::~Network()
mInstance = nullptr;
}
-void Network::registerHandler(MessageHandler *handler)
+void Network::registerHandler(MessageHandler *const handler)
{
if (!handler)
return;
@@ -113,7 +113,7 @@ void Network::registerHandler(MessageHandler *handler)
handler->setNetwork(this);
}
-void Network::unregisterHandler(MessageHandler *handler)
+void Network::unregisterHandler(MessageHandler *const handler)
{
if (!handler)
return;
diff --git a/src/net/tmwa/network.h b/src/net/tmwa/network.h
index 9d2e49183..7e007742c 100644
--- a/src/net/tmwa/network.h
+++ b/src/net/tmwa/network.h
@@ -46,9 +46,9 @@ class Network final : public Ea::Network
~Network();
- void registerHandler(MessageHandler *handler);
+ void registerHandler(MessageHandler *const handler);
- void unregisterHandler(MessageHandler *handler);
+ void unregisterHandler(MessageHandler *const handler);
void clearHandlers();