diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-09-18 17:49:18 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-09-18 17:49:18 +0300 |
commit | 70b520b1e876f9698bb95baa2d274ea289a0c6bd (patch) | |
tree | 152c7519b0d9b8fb424af2373ec48db823a85575 /src/net | |
parent | 62ec17f6e489ec50f17219444468aeb8969dc961 (diff) | |
parent | 3b999f51c740d0541c53d223518e5e4bb482d996 (diff) | |
download | plus-stripped1.1.9.18.tar.gz plus-stripped1.1.9.18.tar.bz2 plus-stripped1.1.9.18.tar.xz plus-stripped1.1.9.18.zip |
Merge branch 'master' into strippedstripped1.1.9.18
Conflicts:
src/guichan/cliprectangle.cpp
src/guichan/focushandler.cpp
src/guichan/gui.cpp
src/guichan/include/guichan/cliprectangle.hpp
src/guichan/include/guichan/inputevent.hpp
src/guichan/include/guichan/keyevent.hpp
src/guichan/include/guichan/mouseevent.hpp
src/guichan/include/guichan/widgets/button.hpp
src/guichan/include/guichan/widgets/checkbox.hpp
src/guichan/include/guichan/widgets/dropdown.hpp
src/guichan/include/guichan/widgets/radiobutton.hpp
src/guichan/include/guichan/widgets/slider.hpp
src/guichan/include/guichan/widgets/tab.hpp
src/guichan/include/guichan/widgets/tabbedarea.hpp
src/guichan/include/guichan/widgets/textfield.hpp
src/guichan/include/guichan/widgets/window.hpp
src/guichan/inputevent.cpp
src/guichan/keyevent.cpp
src/guichan/mouseevent.cpp
src/guichan/widget.cpp
src/guichan/widgets/button.cpp
src/guichan/widgets/checkbox.cpp
src/guichan/widgets/dropdown.cpp
src/guichan/widgets/radiobutton.cpp
src/guichan/widgets/slider.cpp
src/guichan/widgets/tab.cpp
src/guichan/widgets/tabbedarea.cpp
src/guichan/widgets/textfield.cpp
src/guichan/widgets/window.cpp
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/ea/buysellhandler.cpp | 12 | ||||
-rw-r--r-- | src/net/ea/chathandler.cpp | 20 | ||||
-rw-r--r-- | src/net/ea/gamehandler.cpp | 3 | ||||
-rw-r--r-- | src/net/ea/gamehandler.h | 3 | ||||
-rw-r--r-- | src/net/ea/gui/guildtab.cpp | 2 | ||||
-rw-r--r-- | src/net/ea/inventoryhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/ea/inventoryhandler.h | 16 | ||||
-rw-r--r-- | src/net/ea/partyhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/manaserv/charhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/manaserv/chathandler.cpp | 2 | ||||
-rw-r--r-- | src/net/manaserv/generalhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/manaserv/generalhandler.h | 2 | ||||
-rw-r--r-- | src/net/manaserv/network.cpp | 6 | ||||
-rw-r--r-- | src/net/manaserv/npchandler.cpp | 2 | ||||
-rw-r--r-- | src/net/messagein.cpp | 16 | ||||
-rw-r--r-- | src/net/tmwa/adminhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/adminhandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/beinghandler.cpp | 28 | ||||
-rw-r--r-- | src/net/tmwa/generalhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/tmwa/generalhandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/npchandler.cpp | 2 |
21 files changed, 71 insertions, 69 deletions
diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp index 685562d6f..f38d17a59 100644 --- a/src/net/ea/buysellhandler.cpp +++ b/src/net/ea/buysellhandler.cpp @@ -70,7 +70,7 @@ void BuySellHandler::requestSellList(std::string nick) else { if (chatWindow) - chatWindow->whisper(nick, data, BY_PLAYER); + chatWindow->addWhisper(nick, data, BY_PLAYER); } } @@ -89,7 +89,7 @@ void BuySellHandler::requestBuyList(std::string nick) else { if (chatWindow) - chatWindow->whisper(nick, data, BY_PLAYER); + chatWindow->addWhisper(nick, data, BY_PLAYER); } } @@ -102,12 +102,12 @@ void BuySellHandler::sendBuyRequest(std::string nick, ShopItem* item, return; } std::string data = strprintf("!buyitem %d %d %d", - item->getId(), item->getPrice(), amount); + item->getId(), item->getPrice(), amount); if (config.getBoolValue("hideShopMessages")) Net::getChatHandler()->privateMessage(nick, data); else - chatWindow->whisper(nick, data, BY_PLAYER); + chatWindow->addWhisper(nick, data, BY_PLAYER); } void BuySellHandler::sendSellRequest(std::string nick, ShopItem* item, @@ -120,12 +120,12 @@ void BuySellHandler::sendSellRequest(std::string nick, ShopItem* item, } std::string data = strprintf("!sellitem %d %d %d", - item->getId(), item->getPrice(), amount); + item->getId(), item->getPrice(), amount); if (config.getBoolValue("hideShopMessages")) Net::getChatHandler()->privateMessage(nick, data); else - chatWindow->whisper(nick, data, BY_PLAYER); + chatWindow->addWhisper(nick, data, BY_PLAYER); } void BuySellHandler::processNpcBuySellChoice(Net::MessageIn &msg) diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp index 5737cc2b2..c18b1bb9a 100644 --- a/src/net/ea/chathandler.cpp +++ b/src/net/ea/chathandler.cpp @@ -125,7 +125,7 @@ void ChatHandler::processWhisperResponse(Net::MessageIn &msg) case 0x01: if (chatWindow) { - chatWindow->whisper(nick, + chatWindow->addWhisper(nick, strprintf(_("Whisper could not be " "sent, %s is offline."), nick.c_str()), BY_SERVER); } @@ -133,7 +133,7 @@ void ChatHandler::processWhisperResponse(Net::MessageIn &msg) case 0x02: if (chatWindow) { - chatWindow->whisper(nick, + chatWindow->addWhisper(nick, strprintf(_("Whisper could not " "be sent, ignored by %s."), nick.c_str()), BY_SERVER); @@ -183,7 +183,7 @@ void ChatHandler::processWhisper(Net::MessageIn &msg) if (tradeBot) { if (showMsg && chatWindow) - chatWindow->whisper(nick, chatMsg); + chatWindow->addWhisper(nick, chatMsg); shopWindow->giveList(nick, ShopWindow::SELL); } @@ -193,7 +193,7 @@ void ChatHandler::processWhisper(Net::MessageIn &msg) if (tradeBot) { if (showMsg && chatWindow) - chatWindow->whisper(nick, chatMsg); + chatWindow->addWhisper(nick, chatMsg); shopWindow->giveList(nick, ShopWindow::BUY); } @@ -201,7 +201,7 @@ void ChatHandler::processWhisper(Net::MessageIn &msg) else if (chatMsg.find("!buyitem ") == 0) { if (showMsg && chatWindow) - chatWindow->whisper(nick, chatMsg); + chatWindow->addWhisper(nick, chatMsg); if (tradeBot) { shopWindow->processRequest(nick, chatMsg, @@ -211,7 +211,7 @@ void ChatHandler::processWhisper(Net::MessageIn &msg) else if (chatMsg.find("!sellitem ") == 0) { if (showMsg && chatWindow) - chatWindow->whisper(nick, chatMsg); + chatWindow->addWhisper(nick, chatMsg); if (tradeBot) { shopWindow->processRequest(nick, chatMsg, @@ -223,7 +223,7 @@ void ChatHandler::processWhisper(Net::MessageIn &msg) { chatMsg = chatMsg.erase(0, 2); if (showMsg && chatWindow) - chatWindow->whisper(nick, chatMsg); + chatWindow->addWhisper(nick, chatMsg); if (chatMsg.find("B1") == 0 || chatMsg.find("S1") == 0) { @@ -232,12 +232,12 @@ void ChatHandler::processWhisper(Net::MessageIn &msg) } else if (chatWindow) { - chatWindow->whisper(nick, chatMsg); + chatWindow->addWhisper(nick, chatMsg); } } else if (chatWindow) { - chatWindow->whisper(nick, chatMsg); + chatWindow->addWhisper(nick, chatMsg); } } else @@ -246,7 +246,7 @@ void ChatHandler::processWhisper(Net::MessageIn &msg) || (chatMsg.find("!selllist") != 0 && chatMsg.find("!buylist") != 0))) { - chatWindow->whisper(nick, chatMsg); + chatWindow->addWhisper(nick, chatMsg); } } } diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp index 04c13572f..a202cbc86 100644 --- a/src/net/ea/gamehandler.cpp +++ b/src/net/ea/gamehandler.cpp @@ -46,7 +46,8 @@ GameHandler::GameHandler() listen(Mana::CHANNEL_GAME); } -void GameHandler::event(Mana::Channels channel, const Mana::Event &event) +void GameHandler::processEvent(Mana::Channels channel, + const Mana::Event &event) { if (channel == Mana::CHANNEL_GAME) { diff --git a/src/net/ea/gamehandler.h b/src/net/ea/gamehandler.h index abfaaa6b4..6d8b88bd4 100644 --- a/src/net/ea/gamehandler.h +++ b/src/net/ea/gamehandler.h @@ -43,7 +43,8 @@ class GameHandler : public Net::GameHandler, public Mana::Listener public: GameHandler(); - virtual void event(Mana::Channels channel, const Mana::Event &event); + virtual void processEvent(Mana::Channels channel, + const Mana::Event &event); virtual void who(); diff --git a/src/net/ea/gui/guildtab.cpp b/src/net/ea/gui/guildtab.cpp index ab030be83..9836f5fa9 100644 --- a/src/net/ea/gui/guildtab.cpp +++ b/src/net/ea/gui/guildtab.cpp @@ -101,7 +101,7 @@ bool GuildTab::handleCommand(const std::string &type, const std::string &args) else if (type == "notice" && taGuild) { std::string str1 = args.substr(0, 60); - std::string str2 = ""; + std::string str2(""); if (args.size() > 60) str2 = args.substr(60); Net::getGuildHandler()->changeNotice(taGuild->getId(), str1, str2); diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index 01000f8f1..1de681007 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -434,8 +434,8 @@ void InventoryHandler::processPlayerStorageStatus(Net::MessageIn &msg) if (!mStorage) mStorage = new Inventory(Inventory::STORAGE, size); - Ea::InventoryItems::iterator it = mInventoryItems.begin(); - Ea::InventoryItems::iterator it_end = mInventoryItems.end(); + Ea::InventoryItems::const_iterator it = mInventoryItems.begin(); + Ea::InventoryItems::const_iterator it_end = mInventoryItems.end(); for (; it != it_end; ++it) { mStorage->setItem((*it).slot, (*it).id, (*it).quantity, diff --git a/src/net/ea/inventoryhandler.h b/src/net/ea/inventoryhandler.h index 4be4ddaa6..cb1e84673 100644 --- a/src/net/ea/inventoryhandler.h +++ b/src/net/ea/inventoryhandler.h @@ -114,15 +114,15 @@ class InventoryItem int refine; bool equip; - InventoryItem(int slot, int id, int quantity, int refine, - unsigned char color, bool equip) + InventoryItem(int slot0, int id0, int quantity0, int refine0, + unsigned char color0, bool equip0) { - this->slot = slot; - this->id = id; - this->quantity = quantity; - this->refine = refine; - this->color = color; - this->equip = equip; + slot = slot0; + id = id0; + quantity = quantity0; + refine = refine0; + color = color0; + equip = equip0; } }; diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp index bd6f19d97..e006b9c71 100644 --- a/src/net/ea/partyhandler.cpp +++ b/src/net/ea/partyhandler.cpp @@ -203,7 +203,7 @@ void PartyHandler::processPartyInvited(Net::MessageIn &msg) { int id = msg.readInt32(); std::string partyName = msg.readString(24); - std::string nick = ""; + std::string nick(""); Being *being; if (actorSpriteManager) diff --git a/src/net/manaserv/charhandler.cpp b/src/net/manaserv/charhandler.cpp index 3b2306feb..42db6e621 100644 --- a/src/net/manaserv/charhandler.cpp +++ b/src/net/manaserv/charhandler.cpp @@ -138,7 +138,7 @@ void CharHandler::handleCharacterCreateResponse(Net::MessageIn &msg) if (errMsg != ERRMSG_OK) { // Character creation failed - std::string errorMessage = ""; + std::string errorMessage(""); switch (errMsg) { case ERRMSG_NO_LOGIN: @@ -212,7 +212,7 @@ void CharHandler::handleCharacterDeleteResponse(Net::MessageIn &msg) else { // Character deletion failed - std::string errorMessage = ""; + std::string errorMessage(""); switch (errMsg) { case ERRMSG_NO_LOGIN: diff --git a/src/net/manaserv/chathandler.cpp b/src/net/manaserv/chathandler.cpp index 85323b11a..16552018e 100644 --- a/src/net/manaserv/chathandler.cpp +++ b/src/net/manaserv/chathandler.cpp @@ -231,7 +231,7 @@ void ChatHandler::handlePrivateMessage(Net::MessageIn &msg) std::string userNick = msg.readString(); std::string chatMsg = msg.readString(); - chatWindow->whisper(userNick, chatMsg); + chatWindow->addWhisper(userNick, chatMsg); } void ChatHandler::handleAnnouncement(Net::MessageIn &msg) diff --git a/src/net/manaserv/generalhandler.cpp b/src/net/manaserv/generalhandler.cpp index 7c95033a8..2eea6cdf6 100644 --- a/src/net/manaserv/generalhandler.cpp +++ b/src/net/manaserv/generalhandler.cpp @@ -64,7 +64,7 @@ namespace ManaServ Connection *accountServerConnection = 0; Connection *chatServerConnection = 0; Connection *gameServerConnection = 0; -std::string netToken = ""; +std::string netToken(""); ServerInfo gameServer; ServerInfo chatServer; @@ -176,8 +176,8 @@ void GeneralHandler::clearHandlers() clearNetworkHandlers(); } -void GeneralHandler::event(Mana::Channels channel, - const Mana::Event &event) +void GeneralHandler::processEvent(Mana::Channels channel, + const Mana::Event &event) { if (channel == Mana::CHANNEL_CLIENT) { diff --git a/src/net/manaserv/generalhandler.h b/src/net/manaserv/generalhandler.h index 90587eeb3..ccdddbbe6 100644 --- a/src/net/manaserv/generalhandler.h +++ b/src/net/manaserv/generalhandler.h @@ -56,7 +56,7 @@ class GeneralHandler : public Net::GeneralHandler, public Mana::Listener void clearHandlers(); - void event(Mana::Channels channel, const Mana::Event &event); + void processEvent(Mana::Channels channel, const Mana::Event &event); protected: MessageHandlerPtr mBeingHandler; diff --git a/src/net/manaserv/network.cpp b/src/net/manaserv/network.cpp index 53e83e4ec..b83bc5748 100644 --- a/src/net/manaserv/network.cpp +++ b/src/net/manaserv/network.cpp @@ -45,7 +45,7 @@ namespace ManaServ { typedef std::map<unsigned short, MessageHandler*> MessageHandlers; -typedef MessageHandlers::iterator MessageHandlerIterator; +typedef MessageHandlers::const_iterator MessageHandlerIterator; static MessageHandlers mMessageHandlers; void initialize() @@ -96,17 +96,13 @@ Connection *getConnection() void registerHandler(MessageHandler *handler) { for (const Uint16 *i = handler->handledMessages; *i; i++) - { mMessageHandlers[*i] = handler; - } } void unregisterHandler(MessageHandler *handler) { for (const Uint16 *i = handler->handledMessages; *i; i++) - { mMessageHandlers.erase(*i); - } } void clearNetworkHandlers() diff --git a/src/net/manaserv/npchandler.cpp b/src/net/manaserv/npchandler.cpp index efd2ab2bc..8ff2c5d21 100644 --- a/src/net/manaserv/npchandler.cpp +++ b/src/net/manaserv/npchandler.cpp @@ -60,9 +60,7 @@ void NpcHandler::handleMessage(Net::MessageIn &msg) { Being *being = actorSpriteManager->findBeing(msg.readInt16()); if (!being || being->getType() != ActorSprite::NPC) - { return; - } int npcId = being->getId(); NpcDialogs::iterator diag = mNpcDialogs.find(npcId); diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp index 5bfeefdb6..8f177f906 100644 --- a/src/net/messagein.cpp +++ b/src/net/messagein.cpp @@ -190,12 +190,11 @@ std::string MessageIn::readString(int length) char const *stringEnd = static_cast<char const *>(memchr(stringBeg, '\0', length)); - std::string readString(stringBeg, - stringEnd ? stringEnd - stringBeg : length); + std::string str(stringBeg, stringEnd ? stringEnd - stringBeg : length); mPos += length; PacketCounters::incInBytes(length); - DEBUGLOG("readString: " + readString); - return readString; + DEBUGLOG("readString: " + str); + return str; } std::string MessageIn::readRawString(int length) @@ -215,12 +214,11 @@ std::string MessageIn::readRawString(int length) char const *stringBeg = mData + mPos; char const *stringEnd = static_cast<char const *>(memchr(stringBeg, '\0', length)); - std::string readString(stringBeg, - stringEnd ? stringEnd - stringBeg : length); + std::string str(stringBeg, stringEnd ? stringEnd - stringBeg : length); mPos += length; PacketCounters::incInBytes(length); - DEBUGLOG("readString: " + readString); + DEBUGLOG("readString: " + str); if (stringEnd) { @@ -234,11 +232,11 @@ std::string MessageIn::readRawString(int length) { DEBUGLOG("readString2: " + hiddenPart); - return readString + "|" + hiddenPart; + return str + "|" + hiddenPart; } } - return readString; + return str; } } diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp index a332b04fa..5d5034938 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -89,7 +89,7 @@ void AdminHandler::localAnnounce(const std::string &text) outMsg.writeString(text, static_cast<int>(text.length())); } -void AdminHandler::hide(bool hide A_UNUSED) +void AdminHandler::hide(bool h A_UNUSED) { MessageOut outMsg(CMSG_ADMIN_HIDE); outMsg.writeInt32(0); //unused diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h index 79f41dece..53fd4831f 100644 --- a/src/net/tmwa/adminhandler.h +++ b/src/net/tmwa/adminhandler.h @@ -50,7 +50,7 @@ class AdminHandler : public MessageHandler, public Ea::AdminHandler void localAnnounce(const std::string &text); - void hide(bool hide); + void hide(bool h); void kick(int playerId); }; diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index ce2db733f..845c30f19 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -27,6 +27,7 @@ #include "client.h" #include "effectmanager.h" #include "guild.h" +#include "guildmanager.h" #include "keyboardconfig.h" #include "localplayer.h" #include "logger.h" @@ -444,7 +445,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, int msgType) Being *dstBeing; int hairStyle, hairColor; unsigned char colors[9]; - Uint8 dir; + // An update about a player, potentially including movement. int id = msg.readInt32(); @@ -468,7 +469,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, int msgType) return; } - dir = dstBeing->getDirectionDelayed(); + Uint8 dir = dstBeing->getDirectionDelayed(); if (dir) { if (dir != dstBeing->getDirection()) @@ -505,10 +506,17 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, int msgType) guild = msg.readInt32(); // guild - if (guild == 0) - dstBeing->clearGuilds(); - else - dstBeing->setGuild(Guild::getGuild(static_cast<short>(guild))); + if (!guildManager || !GuildManager::getEnableGuildBot()) + { + if (guild == 0) + { + dstBeing->clearGuilds(); + } + else + { + dstBeing->setGuild(Guild::getGuild(static_cast<short>(guild))); + } + } msg.readInt16(); // emblem msg.readInt16(); // manner @@ -560,10 +568,10 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, int msgType) if (srcX != dstX || srcY != dstY) { - int dir = dstBeing->calcDirection(dstX, dstY); + int d = dstBeing->calcDirection(dstX, dstY); - if (dir && dstBeing->getDirection() != dir) - dstBeing->setDirectionDelayed(static_cast<Uint8>(dir)); + if (d && dstBeing->getDirection() != d) + dstBeing->setDirectionDelayed(static_cast<Uint8>(d)); } if (player_node->getCurrentAction() != Being::STAND) @@ -576,7 +584,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, int msgType) } else { - Uint8 dir; +// Uint8 dir; Uint16 x, y; msg.readCoordinates(x, y, dir); dstBeing->setTileCoords(x, y); diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index e1b565399..c6ebc000c 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -240,8 +240,8 @@ void GeneralHandler::clearHandlers() mNetwork->clearHandlers(); } -void GeneralHandler::event(Mana::Channels channel, - const Mana::Event &event) +void GeneralHandler::processEvent(Mana::Channels channel, + const Mana::Event &event) { if (channel == Mana::CHANNEL_GAME) { diff --git a/src/net/tmwa/generalhandler.h b/src/net/tmwa/generalhandler.h index 27186fcc8..5e6c9f18f 100644 --- a/src/net/tmwa/generalhandler.h +++ b/src/net/tmwa/generalhandler.h @@ -59,7 +59,7 @@ class GeneralHandler : public MessageHandler, public Net::GeneralHandler, void clearHandlers(); - void event(Mana::Channels channel, const Mana::Event &event); + void processEvent(Mana::Channels channel, const Mana::Event &event); void reloadPartially(); diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp index 43271671e..f80dd6e69 100644 --- a/src/net/tmwa/npchandler.cpp +++ b/src/net/tmwa/npchandler.cpp @@ -194,7 +194,7 @@ int NpcHandler::getNpc(Net::MessageIn &msg, bool haveLength) const int npcId = msg.readInt32(); - NpcDialogs::iterator diag = mNpcDialogs.find(npcId); + NpcDialogs::const_iterator diag = mNpcDialogs.find(npcId); mDialog = 0; if (diag == mNpcDialogs.end()) |