summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-11-08 00:44:17 +0300
committerAndrei Karas <akaras@inbox.ru>2011-11-08 00:44:17 +0300
commit4cea2a5cd85b8d3ad905eb3b337b28284c62d4fe (patch)
tree714897eca03fbcb764f5b450a29cc1aef8d33433 /src/net
parent9e83411f7e4147d09af5a5006888dcc187ea0ef8 (diff)
downloadmanaplus-4cea2a5cd85b8d3ad905eb3b337b28284c62d4fe.tar.gz
manaplus-4cea2a5cd85b8d3ad905eb3b337b28284c62d4fe.tar.bz2
manaplus-4cea2a5cd85b8d3ad905eb3b337b28284c62d4fe.tar.xz
manaplus-4cea2a5cd85b8d3ad905eb3b337b28284c62d4fe.zip
Fix more gcc 4.7 warnings.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/download.cpp8
-rw-r--r--src/net/ea/beinghandler.cpp4
-rw-r--r--src/net/ea/buysellhandler.cpp2
-rw-r--r--src/net/ea/charserverhandler.cpp4
-rw-r--r--src/net/ea/guildhandler.cpp12
-rw-r--r--src/net/ea/inventoryhandler.cpp24
-rw-r--r--src/net/ea/inventoryhandler.h2
-rw-r--r--src/net/ea/npchandler.cpp2
-rw-r--r--src/net/ea/partyhandler.cpp20
-rw-r--r--src/net/ea/tradehandler.cpp6
-rw-r--r--src/net/messageout.cpp2
-rw-r--r--src/net/tmwa/charserverhandler.cpp6
-rw-r--r--src/net/tmwa/chathandler.cpp2
-rw-r--r--src/net/tmwa/generalhandler.cpp6
-rw-r--r--src/net/tmwa/network.cpp19
-rw-r--r--src/net/tmwa/npchandler.cpp4
16 files changed, 62 insertions, 61 deletions
diff --git a/src/net/download.cpp b/src/net/download.cpp
index dcce218a9..5141c022e 100644
--- a/src/net/download.cpp
+++ b/src/net/download.cpp
@@ -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);
}
@@ -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,7 +329,7 @@ int Download::downloadThread(void *ptr)
if (d->mCurl)
{
curl_easy_cleanup(d->mCurl);
- d->mCurl = 0;
+ d->mCurl = nullptr;
}
if (d->mOptions.cancel)
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/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 72b993c4b..d99e34fc6 100644
--- a/src/net/ea/inventoryhandler.h
+++ b/src/net/ea/inventoryhandler.h
@@ -64,7 +64,7 @@ class EquipBackend : public Equipment::Backend
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/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/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/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/network.cpp b/src/net/tmwa/network.cpp
index 6f26035be..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;
@@ -189,7 +190,7 @@ void Network::disconnect()
{
// 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 1c2654087..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())
{