diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-03-27 00:10:16 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-03-27 00:10:16 +0300 |
commit | 18d8872333e2e433ce7b9e7be71706de37933097 (patch) | |
tree | dea07c5b7dcd29a3105b42b64ce0414e45f36b10 /src/net/ea/buysellhandler.cpp | |
parent | 170b469cbcf4adcd82604a6b2efd5a0630ef3fb5 (diff) | |
download | manaplus-18d8872333e2e433ce7b9e7be71706de37933097.tar.gz manaplus-18d8872333e2e433ce7b9e7be71706de37933097.tar.bz2 manaplus-18d8872333e2e433ce7b9e7be71706de37933097.tar.xz manaplus-18d8872333e2e433ce7b9e7be71706de37933097.zip |
improve some network handlers classes.
Diffstat (limited to 'src/net/ea/buysellhandler.cpp')
-rw-r--r-- | src/net/ea/buysellhandler.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp index d1cf17007..a0d7d03dd 100644 --- a/src/net/ea/buysellhandler.cpp +++ b/src/net/ea/buysellhandler.cpp @@ -50,12 +50,12 @@ BuySellHandler::BuySellHandler() : { } -void BuySellHandler::requestSellList(std::string nick) +void BuySellHandler::requestSellList(const std::string &nick) const { if (nick.empty() != 0 || !shopWindow) return; - std::string data = "!selllist " + toString(tick_time); + const std::string data = "!selllist " + toString(tick_time); shopWindow->setAcceptPlayer(nick); if (config.getBoolValue("hideShopMessages")) @@ -69,12 +69,12 @@ void BuySellHandler::requestSellList(std::string nick) } } -void BuySellHandler::requestBuyList(std::string nick) +void BuySellHandler::requestBuyList(const std::string &nick) const { if (nick.empty() || !shopWindow) return; - std::string data = "!buylist " + toString(tick_time); + const std::string data = "!buylist " + toString(tick_time); shopWindow->setAcceptPlayer(nick); if (config.getBoolValue("hideShopMessages")) @@ -90,14 +90,14 @@ void BuySellHandler::requestBuyList(std::string nick) void BuySellHandler::sendBuyRequest(const std::string &nick, const ShopItem *const item, - const int amount) + const int amount) const { if (!chatWindow || nick.empty() || !item || amount < 1 || amount > item->getQuantity()) { return; } - std::string data = strprintf("!buyitem %d %d %d", + const std::string data = strprintf("!buyitem %d %d %d", item->getId(), item->getPrice(), amount); if (config.getBoolValue("hideShopMessages")) @@ -108,7 +108,7 @@ void BuySellHandler::sendBuyRequest(const std::string &nick, void BuySellHandler::sendSellRequest(const std::string &nick, const ShopItem *const item, - const int amount) + const int amount) const { if (!chatWindow || nick.empty() || !item || amount < 1 || amount > item->getQuantity()) @@ -116,7 +116,7 @@ void BuySellHandler::sendSellRequest(const std::string &nick, return; } - std::string data = strprintf("!sellitem %d %d %d", + const std::string data = strprintf("!sellitem %d %d %d", item->getId(), item->getPrice(), amount); if (config.getBoolValue("hideShopMessages")) @@ -134,7 +134,8 @@ void BuySellHandler::processNpcBuySellChoice(Net::MessageIn &msg) } } -void BuySellHandler::processNpcSell(Net::MessageIn &msg, int offset) +void BuySellHandler::processNpcSell(Net::MessageIn &msg, + const int offset) const { msg.readInt16(); // length const int n_items = (msg.getLength() - 4) / 10; @@ -162,7 +163,7 @@ void BuySellHandler::processNpcSell(Net::MessageIn &msg, int offset) } } -void BuySellHandler::processNpcBuyResponse(Net::MessageIn &msg) +void BuySellHandler::processNpcBuyResponse(Net::MessageIn &msg) const { if (msg.readInt8() == 0) { |