diff options
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/download.cpp | 28 | ||||
-rw-r--r-- | src/net/ea/beinghandler.cpp | 4 | ||||
-rw-r--r-- | src/net/ea/buysellhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/ea/charserverhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/ea/gamehandler.cpp | 2 | ||||
-rw-r--r-- | src/net/ea/guildhandler.cpp | 12 | ||||
-rw-r--r-- | src/net/ea/inventoryhandler.cpp | 24 | ||||
-rw-r--r-- | src/net/ea/inventoryhandler.h | 5 | ||||
-rw-r--r-- | src/net/ea/npchandler.cpp | 2 | ||||
-rw-r--r-- | src/net/ea/partyhandler.cpp | 20 | ||||
-rw-r--r-- | src/net/ea/playerhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/ea/tradehandler.cpp | 6 | ||||
-rw-r--r-- | src/net/manaserv/chathandler.cpp | 11 | ||||
-rw-r--r-- | src/net/manaserv/chathandler.h | 4 | ||||
-rw-r--r-- | src/net/manaserv/network.cpp | 6 | ||||
-rw-r--r-- | src/net/manaserv/partyhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/messageout.cpp | 2 | ||||
-rw-r--r-- | src/net/net.cpp | 34 | ||||
-rw-r--r-- | src/net/tmwa/charserverhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/tmwa/chathandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/generalhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/tmwa/messagehandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/network.cpp | 23 | ||||
-rw-r--r-- | src/net/tmwa/npchandler.cpp | 6 |
24 files changed, 118 insertions, 101 deletions
diff --git a/src/net/download.cpp b/src/net/download.cpp index 969318b19..5141c022e 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -53,12 +53,12 @@ Download::Download(void *ptr, const std::string &url, mPtr(ptr), mUrl(url), mFileName(""), - mWriteFunction(NULL), + mWriteFunction(nullptr), mAdler(0), mUpdateFunction(updateFunction), - mThread(NULL), - mCurl(NULL), - mHeaders(NULL), + mThread(nullptr), + mCurl(nullptr), + mHeaders(nullptr), mIgnoreError(ignoreError) { mError = static_cast<char*>(calloc(CURL_ERROR_SIZE + 1, 1)); @@ -72,11 +72,11 @@ Download::~Download() if (mHeaders) curl_slist_free_all(mHeaders); - mHeaders = 0; + mHeaders = nullptr; int status; if (mThread && SDL_GetThreadID(mThread)) SDL_WaitThread(mThread, &status); - mThread = 0; + mThread = nullptr; free(mError); } @@ -158,9 +158,9 @@ void Download::cancel() mOptions.cancel = true; if (mThread && SDL_GetThreadID(mThread)) - SDL_WaitThread(mThread, NULL); + SDL_WaitThread(mThread, nullptr); - mThread = NULL; + mThread = nullptr; } char *Download::getError() @@ -204,14 +204,14 @@ int Download::downloadThread(void *ptr) while (attempts < 3 && !complete && !d->mOptions.cancel) { - FILE *file = NULL; + FILE *file = nullptr; d->mUpdateFunction(d->mPtr, DOWNLOAD_STATUS_STARTING, 0, 0); if (d->mOptions.cancel) { //need terminate thread? - d->mThread = NULL; + d->mThread = nullptr; return 0; } @@ -281,7 +281,7 @@ int Download::downloadThread(void *ptr) } curl_easy_cleanup(d->mCurl); - d->mCurl = 0; + d->mCurl = nullptr; if (!d->mOptions.memoryWrite) { @@ -329,13 +329,13 @@ int Download::downloadThread(void *ptr) if (d->mCurl) { curl_easy_cleanup(d->mCurl); - d->mCurl = 0; + d->mCurl = nullptr; } if (d->mOptions.cancel) { //need ternibate thread? - d->mThread = NULL; + d->mThread = nullptr; return 0; } attempts++; @@ -354,7 +354,7 @@ int Download::downloadThread(void *ptr) d->mUpdateFunction(d->mPtr, DOWNLOAD_STATUS_COMPLETE, 0, 0); } - d->mThread = NULL; + d->mThread = nullptr; return 0; } diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index 8fca76353..5c3c694b3 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -67,7 +67,7 @@ BeingHandler::BeingHandler(bool enableSync) : Being *BeingHandler::createBeing(int id, short job) { if (!actorSpriteManager) - return 0; + return nullptr; ActorSprite::Type type = ActorSprite::UNKNOWN; if (job <= 25 || (job >= 4001 && job <= 4049)) @@ -143,7 +143,7 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, bool visible) { actorSpriteManager->destroy(dstBeing); actorSpriteManager->erase(dstBeing); - dstBeing = 0; + dstBeing = nullptr; } if (!dstBeing) diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp index f38d17a59..28584d97f 100644 --- a/src/net/ea/buysellhandler.cpp +++ b/src/net/ea/buysellhandler.cpp @@ -51,7 +51,7 @@ namespace Ea BuySellHandler::BuySellHandler() : mNpcId(0), - mBuyDialog(0) + mBuyDialog(nullptr) { } diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp index 08c9a43c8..0c01959f2 100644 --- a/src/net/ea/charserverhandler.cpp +++ b/src/net/ea/charserverhandler.cpp @@ -124,7 +124,7 @@ void CharServerHandler::processCharCreate(Net::MessageIn &msg, bool withColors) if (mCharCreateDialog) { mCharCreateDialog->scheduleDelete(); - mCharCreateDialog = 0; + mCharCreateDialog = nullptr; } } @@ -160,7 +160,7 @@ void CharServerHandler::processCharDelete(Net::MessageIn &msg A_UNUSED) { delete mSelectedCharacter; mCharacters.remove(mSelectedCharacter); - mSelectedCharacter = 0; + mSelectedCharacter = nullptr; updateCharSelectDialog(); unlockCharSelectDialog(); new OkDialog(_("Info"), _("Character deleted.")); diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp index a202cbc86..b74f2384d 100644 --- a/src/net/ea/gamehandler.cpp +++ b/src/net/ea/gamehandler.cpp @@ -96,7 +96,7 @@ void GameHandler::processCharSwitchResponse(Net::MessageIn &msg) void GameHandler::processMapQuitResponse(Net::MessageIn &msg) { if (msg.readInt8()) - new OkDialog(_("Game"), _("Request to quit denied!"), NULL); + new OkDialog(_("Game"), _("Request to quit denied!"), nullptr); } } // namespace Ea diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp index 66488d5fb..907fa13db 100644 --- a/src/net/ea/guildhandler.cpp +++ b/src/net/ea/guildhandler.cpp @@ -35,8 +35,8 @@ namespace Ea { -GuildTab *guildTab = 0; -Guild *taGuild = 0; +GuildTab *guildTab = nullptr; +Guild *taGuild = nullptr; GuildHandler::GuildHandler() : showBasicInfo(false) @@ -46,7 +46,7 @@ GuildHandler::GuildHandler() : GuildHandler::~GuildHandler() { delete guildTab; - guildTab = 0; + guildTab = nullptr; } void GuildHandler::requestAlliance(int guildId A_UNUSED, @@ -450,7 +450,7 @@ void GuildHandler::processGuildLeave(Net::MessageIn &msg) } SERVER_NOTICE(_("You have left the guild.")) delete guildTab; - guildTab = 0; + guildTab = nullptr; if (socialWindow && taGuild) socialWindow->removeTab(taGuild); @@ -497,7 +497,7 @@ void GuildHandler::processGuildExpulsion(Net::MessageIn &msg) } SERVER_NOTICE(_("You was kicked from guild.")); delete guildTab; - guildTab = 0; + guildTab = nullptr; if (socialWindow && taGuild) socialWindow->removeTab(taGuild); @@ -607,7 +607,7 @@ void GuildHandler::processGuildBroken(Net::MessageIn &msg) void GuildHandler::clear() { - taGuild = 0; + taGuild = nullptr; } } // namespace Ea diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index 788b7f0fc..d2a1fb4f0 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -78,8 +78,8 @@ namespace Ea InventoryHandler::InventoryHandler() { - mStorage = 0; - mStorageWindow = 0; + mStorage = nullptr; + mStorageWindow = nullptr; mDebugInventory = true; } @@ -88,11 +88,11 @@ InventoryHandler::~InventoryHandler() if (mStorageWindow) { mStorageWindow->close(); - mStorageWindow = 0; + mStorageWindow = nullptr; } delete mStorage; - mStorage = 0; + mStorage = nullptr; } bool InventoryHandler::canSplit(const Item *item A_UNUSED) const @@ -164,7 +164,7 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg, int index, amount, itemId, arrow; int cards[4], itemType; unsigned char identified; - Inventory *inventory = 0; + Inventory *inventory = nullptr; if (player_node) inventory = PlayerInfo::getInventory(); @@ -279,7 +279,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg) unsigned char identified; int floorId; - Inventory *inventory = 0; + Inventory *inventory = nullptr; if (player_node) inventory = PlayerInfo::getInventory(); @@ -345,7 +345,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg) void InventoryHandler::processPlayerInventoryRemove(Net::MessageIn &msg) { int index, amount; - Inventory *inventory = 0; + Inventory *inventory = nullptr; if (player_node) inventory = PlayerInfo::getInventory(); @@ -367,7 +367,7 @@ void InventoryHandler::processPlayerInventoryRemove(Net::MessageIn &msg) void InventoryHandler::processPlayerInventoryUse(Net::MessageIn &msg) { int index, amount; - Inventory *inventory = 0; + Inventory *inventory = nullptr; if (player_node) inventory = PlayerInfo::getInventory(); @@ -392,7 +392,7 @@ void InventoryHandler::processPlayerInventoryUse(Net::MessageIn &msg) void InventoryHandler::processItemUseResponse(Net::MessageIn &msg) { int index, amount; - Inventory *inventory = 0; + Inventory *inventory = nullptr; if (player_node) inventory = PlayerInfo::getInventory(); @@ -499,13 +499,13 @@ void InventoryHandler::processPlayerStorageClose(Net::MessageIn &msg A_UNUSED) { // Storage access has been closed // Storage window deletes itself - mStorageWindow = 0; + mStorageWindow = nullptr; if (mStorage) mStorage->clear(); delete mStorage; - mStorage = 0; + mStorage = nullptr; } void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg) @@ -514,7 +514,7 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg) int number; unsigned char identified; - Inventory *inventory = 0; + Inventory *inventory = nullptr; if (player_node) inventory = PlayerInfo::getInventory(); diff --git a/src/net/ea/inventoryhandler.h b/src/net/ea/inventoryhandler.h index 3a99bc47f..d99e34fc6 100644 --- a/src/net/ea/inventoryhandler.h +++ b/src/net/ea/inventoryhandler.h @@ -25,6 +25,7 @@ #include "equipment.h" #include "inventory.h" +#include "localconsts.h" #include "logger.h" #include "playerinfo.h" @@ -58,12 +59,12 @@ class EquipBackend : public Equipment::Backend { int invyIndex = mEquipment[index]; if (invyIndex == -1) - return NULL; + return nullptr; if (PlayerInfo::getInventory()) return PlayerInfo::getInventory()->getItem(invyIndex); else - return 0; + return nullptr; } void clear() diff --git a/src/net/ea/npchandler.cpp b/src/net/ea/npchandler.cpp index 9a37ccc26..e8e1014d4 100644 --- a/src/net/ea/npchandler.cpp +++ b/src/net/ea/npchandler.cpp @@ -33,7 +33,7 @@ namespace Ea { NpcHandler::NpcHandler() : - mDialog(0) + mDialog(nullptr) { } diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp index 35cc77fbf..5fa0df29b 100644 --- a/src/net/ea/partyhandler.cpp +++ b/src/net/ea/partyhandler.cpp @@ -37,8 +37,8 @@ namespace Ea { -PartyTab *partyTab = 0; -Party *taParty = 0; +PartyTab *partyTab = nullptr; +Party *taParty = nullptr; PartyHandler::PartyHandler() : mShareExp(PARTY_SHARE_UNKNOWN), @@ -50,7 +50,7 @@ PartyHandler::PartyHandler() : PartyHandler::~PartyHandler() { delete partyTab; - partyTab = 0; + partyTab = nullptr; } void PartyHandler::join(int partyId A_UNUSED) @@ -71,7 +71,7 @@ void PartyHandler::reload() void PartyHandler::clear() { - taParty = 0; + taParty = nullptr; } void PartyHandler::processPartyCreate(Net::MessageIn &msg) @@ -128,7 +128,7 @@ void PartyHandler::processPartyInfo(Net::MessageIn &msg) if (Ea::taParty) { - PartyMember *member = 0; + PartyMember *member = nullptr; if (oldParty) { //member = Ea::taParty->getMember(id); @@ -314,7 +314,7 @@ void PartyHandler::processPartySettings(Net::MessageIn &msg) void PartyHandler::processPartyMove(Net::MessageIn &msg) { int id = msg.readInt32(); // id - PartyMember *m = 0; + PartyMember *m = nullptr; if (Ea::taParty) m = Ea::taParty->getMember(id); if (m) @@ -356,7 +356,7 @@ void PartyHandler::processPartyLeave(Net::MessageIn &msg) } SERVER_NOTICE(_("You have left the party.")) delete Ea::partyTab; - Ea::partyTab = 0; + Ea::partyTab = nullptr; if (socialWindow && Ea::taParty) socialWindow->removeTab(Ea::taParty); @@ -375,7 +375,7 @@ void PartyHandler::processPartyLeave(Net::MessageIn &msg) Being *b = actorSpriteManager->findBeing(id); if (b && b->getType() == Being::PLAYER) { - b->setParty(0); + b->setParty(nullptr); b->setPartyName(""); } } @@ -389,7 +389,7 @@ void PartyHandler::processPartyUpdateHp(Net::MessageIn &msg) int id = msg.readInt32(); int hp = msg.readInt16(); int maxhp = msg.readInt16(); - PartyMember *m = 0; + PartyMember *m = nullptr; if (Ea::taParty) m = Ea::taParty->getMember(id); if (m) @@ -410,7 +410,7 @@ void PartyHandler::processPartyUpdateHp(Net::MessageIn &msg) void PartyHandler::processPartyUpdateCoords(Net::MessageIn &msg) { int id = msg.readInt32(); // id - PartyMember *m = 0; + PartyMember *m = nullptr; if (Ea::taParty) m = Ea::taParty->getMember(id); if (m) diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 81e520415..02af3dbb4 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -59,7 +59,7 @@ namespace { void action(const gcn::ActionEvent &event A_UNUSED) { - weightNotice = NULL; + weightNotice = nullptr; } } weightListener; @@ -72,9 +72,9 @@ namespace { if (Net::getPlayerHandler()) Net::getPlayerHandler()->respawn(); - deathNotice = NULL; + deathNotice = nullptr; - Client::closeDialogs(); + Game::closeDialogs(); if (viewport) viewport->closePopupMenu(); diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp index 19aa474e3..5aaa09f91 100644 --- a/src/net/ea/tradehandler.cpp +++ b/src/net/ea/tradehandler.cpp @@ -53,7 +53,7 @@ namespace { void action(const gcn::ActionEvent &event) { - confirmDlg = 0; + confirmDlg = nullptr; if (event.getId() == "ignore") player_relations.ignoreTrade(tradePartnerName); Net::getTradeHandler()->respond(event.getId() == "yes"); @@ -66,7 +66,7 @@ namespace Ea TradeHandler::TradeHandler() { - confirmDlg = 0; + confirmDlg = nullptr; } void TradeHandler::removeItem(int slotNum A_UNUSED, int amount A_UNUSED) @@ -204,7 +204,7 @@ void TradeHandler::processTradeItemAddResponse(Net::MessageIn &msg) { // Trade: New Item add response (was 0x00ea, now 01b1) const int index = msg.readInt16() - INVENTORY_OFFSET; - Item *item = 0; + Item *item = nullptr; if (PlayerInfo::getInventory()) item = PlayerInfo::getInventory()->getItem(index); diff --git a/src/net/manaserv/chathandler.cpp b/src/net/manaserv/chathandler.cpp index 16552018e..1757b565d 100644 --- a/src/net/manaserv/chathandler.cpp +++ b/src/net/manaserv/chathandler.cpp @@ -470,4 +470,15 @@ void ChatHandler::sendRaw(const std::string &args A_UNUSED) { } + +void ChatHandler::ignoreAll() +{ + +} + +void ChatHandler::unIgnoreAll() +{ + +} + } // namespace ManaServ diff --git a/src/net/manaserv/chathandler.h b/src/net/manaserv/chathandler.h index beea40423..3ed7717ad 100644 --- a/src/net/manaserv/chathandler.h +++ b/src/net/manaserv/chathandler.h @@ -134,9 +134,9 @@ class ChatHandler : public MessageHandler, public Net::ChatHandler */ void handleWhoResponse(Net::MessageIn &msg); - void ignoreAll() + void ignoreAll(); - void unIgnoreAll() + void unIgnoreAll(); }; } // namespace ManaServ diff --git a/src/net/manaserv/network.cpp b/src/net/manaserv/network.cpp index b83bc5748..44478fb4c 100644 --- a/src/net/manaserv/network.cpp +++ b/src/net/manaserv/network.cpp @@ -33,6 +33,8 @@ #include <map> +#include "debug.h" + /** * The local host which is shared for all outgoing connections. */ @@ -56,9 +58,9 @@ void initialize() } #if defined(ENET_VERSION) && ENET_VERSION >= ENET_CUTOFF - client = enet_host_create(NULL, 3, 0, 0, 0); + client = enet_host_create(nullptr, 3, 0, 0, 0); #else - client = enet_host_create(NULL, 3, 0, 0); + client = enet_host_create(nullptr, 3, 0, 0); #endif if (!client) diff --git a/src/net/manaserv/partyhandler.cpp b/src/net/manaserv/partyhandler.cpp index 987a40dc5..660657f44 100644 --- a/src/net/manaserv/partyhandler.cpp +++ b/src/net/manaserv/partyhandler.cpp @@ -96,7 +96,7 @@ void PartyHandler::handleMessage(Net::MessageIn &msg) if (msg.readInt8() == ERRMSG_OK) { mParty->clearMembers(); - player_node->setParty(NULL); + player_node->setParty(nullptr); } } break; diff --git a/src/net/messageout.cpp b/src/net/messageout.cpp index f18f65a93..b1e0c2295 100644 --- a/src/net/messageout.cpp +++ b/src/net/messageout.cpp @@ -37,7 +37,7 @@ namespace Net { MessageOut::MessageOut(short id A_UNUSED): - mData(0), + mData(nullptr), mDataSize(0), mPos(0) { diff --git a/src/net/net.cpp b/src/net/net.cpp index 49bb58903..933f7686b 100644 --- a/src/net/net.cpp +++ b/src/net/net.cpp @@ -48,21 +48,21 @@ #include "debug.h" -Net::AdminHandler *adminHandler = NULL; -Net::CharHandler *charHandler = NULL; -Net::ChatHandler *chatHandler = NULL; -Net::GeneralHandler *generalHandler = NULL; -Net::InventoryHandler *inventoryHandler = NULL; -Net::LoginHandler *loginHandler = NULL; -Net::GameHandler *gameHandler = NULL; -Net::GuildHandler *guildHandler = NULL; -Net::NpcHandler *npcHandler = NULL; -Net::PartyHandler *partyHandler = NULL; -Net::PlayerHandler *playerHandler = NULL; -Net::SpecialHandler *specialHandler = NULL; -Net::TradeHandler *tradeHandler = NULL; -Net::BeingHandler *beingHandler = NULL; -Net::BuySellHandler *buySellHandler = NULL; +Net::AdminHandler *adminHandler = nullptr; +Net::CharHandler *charHandler = nullptr; +Net::ChatHandler *chatHandler = nullptr; +Net::GeneralHandler *generalHandler = nullptr; +Net::InventoryHandler *inventoryHandler = nullptr; +Net::LoginHandler *loginHandler = nullptr; +Net::GameHandler *gameHandler = nullptr; +Net::GuildHandler *guildHandler = nullptr; +Net::NpcHandler *npcHandler = nullptr; +Net::PartyHandler *partyHandler = nullptr; +Net::PlayerHandler *playerHandler = nullptr; +Net::SpecialHandler *specialHandler = nullptr; +Net::TradeHandler *tradeHandler = nullptr; +Net::BeingHandler *beingHandler = nullptr; +Net::BuySellHandler *buySellHandler = nullptr; Net::AdminHandler *Net::getAdminHandler() { @@ -151,13 +151,13 @@ void connectToServer(const ServerInfo &server) // that } - if (networkType == server.type && getGeneralHandler() != NULL) + if (networkType == server.type && getGeneralHandler()) { getGeneralHandler()->reload(); } else { - if (networkType != ServerInfo::UNKNOWN && getGeneralHandler() != NULL) + if (networkType != ServerInfo::UNKNOWN && getGeneralHandler()) getGeneralHandler()->unload(); switch (server.type) diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index 03b63aa16..69f7165ec 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -123,7 +123,7 @@ void CharServerHandler::handleMessage(Net::MessageIn &msg) player_node = mSelectedCharacter->dummy; PlayerInfo::setBackend(mSelectedCharacter->data); - mSelectedCharacter->dummy = 0; + mSelectedCharacter->dummy = nullptr; delete_all(mCharacters); mCharacters.clear(); @@ -151,7 +151,7 @@ void CharServerHandler::handleMessage(Net::MessageIn &msg) if (player_node) { player_node->setTileCoords(x, y); - player_node->setMap(0); + player_node->setMap(nullptr); } } break; @@ -271,7 +271,7 @@ void CharServerHandler::chooseCharacter(Net::Character *character) return; mSelectedCharacter = character; - mCharSelectDialog = 0; + mCharSelectDialog = nullptr; MessageOut outMsg(CMSG_CHAR_SELECT); outMsg.writeInt8(static_cast<unsigned char>(mSelectedCharacter->slot)); diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index fe6592d93..5af248e5c 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -145,7 +145,7 @@ void ChatHandler::sendRaw(const std::string &args) { std::string line = args; std::string str; - MessageOut *outMsg = 0; + MessageOut *outMsg = nullptr; if (line == "") return; diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index 0a9541477..293986bde 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -120,7 +120,7 @@ GeneralHandler::GeneralHandler(): GeneralHandler::~GeneralHandler() { delete mNetwork; - mNetwork = 0; + mNetwork = nullptr; } void GeneralHandler::handleMessage(Net::MessageIn &msg) @@ -294,10 +294,10 @@ void GeneralHandler::processEvent(Mana::Channels channel, } delete Ea::guildTab; - Ea::guildTab = 0; + Ea::guildTab = nullptr; delete Ea::partyTab; - Ea::partyTab = 0; + Ea::partyTab = nullptr; } } } diff --git a/src/net/tmwa/messagehandler.cpp b/src/net/tmwa/messagehandler.cpp index 843339718..830b3bc4f 100644 --- a/src/net/tmwa/messagehandler.cpp +++ b/src/net/tmwa/messagehandler.cpp @@ -32,7 +32,7 @@ namespace TmwAthena { MessageHandler::MessageHandler() - : mNetwork(NULL) + : mNetwork(nullptr) { } diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index e26f48324..3181ec898 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -104,16 +104,17 @@ int networkThread(void *data) return 0; } -Network *Network::mInstance = 0; +Network *Network::mInstance = nullptr; Network::Network() : - mSocket(0), + mSocket(nullptr), mInBuffer(new char[BUFFER_SIZE]), mOutBuffer(new char[BUFFER_SIZE]), - mInSize(0), mOutSize(0), + mInSize(0), + mOutSize(0), mToSkip(0), mState(IDLE), - mWorkerThread(0) + mWorkerThread(nullptr) { SDLNet_Init(); @@ -129,8 +130,8 @@ Network::~Network() disconnect(); SDL_DestroyMutex(mMutex); - mMutex = 0; - mInstance = 0; + mMutex = nullptr; + mInstance = nullptr; delete[] mInBuffer; delete[] mOutBuffer; @@ -181,15 +182,15 @@ void Network::disconnect() if (mWorkerThread && SDL_GetThreadID(mWorkerThread)) { - SDL_WaitThread(mWorkerThread, NULL); - mWorkerThread = NULL; + SDL_WaitThread(mWorkerThread, nullptr); + mWorkerThread = nullptr; } if (mSocket) { // need call SDLNet_TCP_DelSocket? SDLNet_TCP_Close(mSocket); - mSocket = 0; + mSocket = nullptr; } } @@ -212,7 +213,7 @@ void Network::unregisterHandler(MessageHandler *handler) for (const Uint16 *i = handler->handledMessages; *i; ++i) mMessageHandlers.erase(*i); - handler->setNetwork(0); + handler->setNetwork(nullptr); } void Network::clearHandlers() @@ -221,7 +222,7 @@ void Network::clearHandlers() for (i = mMessageHandlers.begin(); i != mMessageHandlers.end(); ++i) { if (i->second) - i->second->setNetwork(0); + i->second->setNetwork(nullptr); } mMessageHandlers.clear(); } diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp index f80dd6e69..6b6ffcbb6 100644 --- a/src/net/tmwa/npchandler.cpp +++ b/src/net/tmwa/npchandler.cpp @@ -92,7 +92,7 @@ void NpcHandler::handleMessage(Net::MessageIn &msg) break; } - mDialog = 0; + mDialog = nullptr; } void NpcHandler::talk(int npcId) @@ -195,7 +195,7 @@ int NpcHandler::getNpc(Net::MessageIn &msg, bool haveLength) const int npcId = msg.readInt32(); NpcDialogs::const_iterator diag = mNpcDialogs.find(npcId); - mDialog = 0; + mDialog = nullptr; if (diag == mNpcDialogs.end()) { @@ -213,6 +213,8 @@ int NpcHandler::getNpc(Net::MessageIn &msg, bool haveLength) else { mDialog = new NpcDialog(npcId); + if (player_node) + player_node->stopWalking(false); Wrapper wrap; wrap.dialog = mDialog; mNpcDialogs[npcId] = wrap; |