diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-03-28 00:39:12 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-03-28 11:04:23 +0300 |
commit | 0c35dab0ba366f85b40ef1795125521f1df8c264 (patch) | |
tree | dde6abde3288f543ae96a2468b2275af8a03e704 /src/net | |
parent | 47cc515695fcd0b16467506e4984d2ec38fad4e4 (diff) | |
download | manaplus-0c35dab0ba366f85b40ef1795125521f1df8c264.tar.gz manaplus-0c35dab0ba366f85b40ef1795125521f1df8c264.tar.bz2 manaplus-0c35dab0ba366f85b40ef1795125521f1df8c264.tar.xz manaplus-0c35dab0ba366f85b40ef1795125521f1df8c264.zip |
simplify variables cleanup.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/charserverhandler.h | 5 | ||||
-rw-r--r-- | src/net/ea/guildhandler.cpp | 11 | ||||
-rw-r--r-- | src/net/ea/inventoryhandler.cpp | 11 | ||||
-rw-r--r-- | src/net/ea/partyhandler.cpp | 8 | ||||
-rw-r--r-- | src/net/eathena/generalhandler.cpp | 11 | ||||
-rw-r--r-- | src/net/eathena/network.cpp | 5 | ||||
-rw-r--r-- | src/net/tmwa/generalhandler.cpp | 11 | ||||
-rw-r--r-- | src/net/tmwa/network.cpp | 5 |
8 files changed, 31 insertions, 36 deletions
diff --git a/src/net/charserverhandler.h b/src/net/charserverhandler.h index 625bf57fc..095558cec 100644 --- a/src/net/charserverhandler.h +++ b/src/net/charserverhandler.h @@ -26,6 +26,8 @@ #include "being/localplayer.h" #include "being/playerinfo.h" +#include "utils/delete2.h" + #include <string> #include <vector> @@ -51,8 +53,7 @@ struct Character final ~Character() { - delete dummy; - dummy = nullptr; + delete2(dummy); } int slot; /**< The index in the list of characters */ diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp index 1e56ac75b..fc1ef8def 100644 --- a/src/net/ea/guildhandler.cpp +++ b/src/net/ea/guildhandler.cpp @@ -34,6 +34,8 @@ #include "net/ea/gui/guildtab.h" +#include "utils/delete2.h" + #include "debug.h" namespace Ea @@ -48,8 +50,7 @@ GuildHandler::GuildHandler() : GuildHandler::~GuildHandler() { - delete guildTab; - guildTab = nullptr; + delete2(guildTab); } void GuildHandler::requestAlliance(const int guildId A_UNUSED, @@ -462,8 +463,7 @@ void GuildHandler::processGuildLeave(Net::MessageIn &msg) const taGuild->clearMembers(); } NotifyManager::notify(NotifyManager::GUILD_LEFT); - delete guildTab; - guildTab = nullptr; + delete2(guildTab) if (socialWindow && taGuild) socialWindow->removeTab(taGuild); @@ -506,8 +506,7 @@ void GuildHandler::processGuildExpulsion(Net::MessageIn &msg) const taGuild->clearMembers(); } NotifyManager::notify(NotifyManager::GUILD_KICKED); - delete guildTab; - guildTab = nullptr; + delete2(guildTab) if (socialWindow && taGuild) socialWindow->removeTab(taGuild); diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index 2262a79f9..f3c8040e1 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -33,6 +33,8 @@ #include "net/ea/eaprotocol.h" +#include "utils/delete2.h" + #include "debug.h" extern int serverVersion; @@ -95,14 +97,12 @@ InventoryHandler::~InventoryHandler() mStorageWindow = nullptr; } - delete mStorage; - mStorage = nullptr; + delete2(mStorage); } void InventoryHandler::clear() { - delete mStorage; - mStorage = nullptr; + delete2(mStorage); } bool InventoryHandler::canSplit(const Item *const item A_UNUSED) const @@ -491,8 +491,7 @@ void InventoryHandler::processPlayerStorageClose(Net::MessageIn &msg A_UNUSED) if (mStorage) mStorage->clear(); - delete mStorage; - mStorage = nullptr; + delete2(mStorage); } void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg) diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp index 4e4cac3df..32b08046e 100644 --- a/src/net/ea/partyhandler.cpp +++ b/src/net/ea/partyhandler.cpp @@ -35,6 +35,8 @@ #include "net/ea/gui/partytab.h" +#include "utils/delete2.h" + #include "debug.h" namespace Ea @@ -52,8 +54,7 @@ PartyHandler::PartyHandler() : PartyHandler::~PartyHandler() { - delete partyTab; - partyTab = nullptr; + delete2(partyTab); } void PartyHandler::join(const int partyId A_UNUSED) const @@ -347,8 +348,7 @@ void PartyHandler::processPartyLeave(Net::MessageIn &msg) const Ea::taParty->clearMembers(); } NotifyManager::notify(NotifyManager::PARTY_LEFT); - delete Ea::partyTab; - Ea::partyTab = nullptr; + delete2(Ea::partyTab) if (socialWindow && Ea::taParty) socialWindow->removeTab(Ea::taParty); diff --git a/src/net/eathena/generalhandler.cpp b/src/net/eathena/generalhandler.cpp index 3a18dede9..6243a3878 100644 --- a/src/net/eathena/generalhandler.cpp +++ b/src/net/eathena/generalhandler.cpp @@ -54,6 +54,7 @@ #include "net/eathena/tradehandler.h" #include "net/eathena/skillhandler.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "debug.h" @@ -105,8 +106,7 @@ GeneralHandler::GeneralHandler() : GeneralHandler::~GeneralHandler() { - delete mNetwork; - mNetwork = nullptr; + delete2(mNetwork); } void GeneralHandler::handleMessage(Net::MessageIn &msg) @@ -272,11 +272,8 @@ void GeneralHandler::gameEnded() const socialWindow->removeTab(Ea::taParty); } - delete Ea::guildTab; - Ea::guildTab = nullptr; - - delete Ea::partyTab; - Ea::partyTab = nullptr; + delete2(Ea::guildTab); + delete2(Ea::partyTab); } } // namespace EAthena diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp index 0162d82e8..87d5d4b5a 100644 --- a/src/net/eathena/network.cpp +++ b/src/net/eathena/network.cpp @@ -28,6 +28,8 @@ #include "net/eathena/messagein.h" #include "net/eathena/protocol.h" +#include "utils/delete2.h" + #include "debug.h" namespace EAthena @@ -120,8 +122,7 @@ Network::Network() : Network::~Network() { clearHandlers(); - delete mMessageHandlers; - mMessageHandlers = nullptr; + delete2(mMessageHandlers); mInstance = nullptr; } diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index 46d1d490f..3848fcdd6 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -56,6 +56,7 @@ #include "net/tmwa/skillhandler.h" #include "net/tmwa/questhandler.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "debug.h" @@ -115,8 +116,7 @@ GeneralHandler::GeneralHandler() : GeneralHandler::~GeneralHandler() { - delete mNetwork; - mNetwork = nullptr; + delete2(mNetwork); } void GeneralHandler::handleMessage(Net::MessageIn &msg) @@ -320,11 +320,8 @@ void GeneralHandler::gameEnded() const socialWindow->removeTab(Ea::taParty); } - delete Ea::guildTab; - Ea::guildTab = nullptr; - - delete Ea::partyTab; - Ea::partyTab = nullptr; + delete2(Ea::guildTab); + delete2(Ea::partyTab); } } // namespace TmwAthena diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index cc94b6161..b778d6b31 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -28,6 +28,8 @@ #include "net/tmwa/messagein.h" #include "net/tmwa/protocol.h" +#include "utils/delete2.h" + #include "debug.h" namespace TmwAthena @@ -98,8 +100,7 @@ Network::Network() : Network::~Network() { clearHandlers(); - delete mMessageHandlers; - mMessageHandlers = nullptr; + delete2(mMessageHandlers); mInstance = nullptr; } |