From a39f63cdfa5ce15b22f294a8bb1db3a036ce462d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 30 Mar 2012 02:05:40 +0300 Subject: One part of fixes after auto checking. --- src/net/download.cpp | 6 +++--- src/net/ea/inventoryhandler.h | 4 ++-- src/net/manaserv/attributes.cpp | 5 +++-- src/net/manaserv/buysellhandler.cpp | 2 +- src/net/manaserv/inventoryhandler.h | 2 +- src/net/tmwa/charserverhandler.cpp | 21 +++++++++++---------- src/net/tmwa/chathandler.cpp | 9 +++------ src/net/tmwa/generalhandler.cpp | 3 +-- 8 files changed, 25 insertions(+), 27 deletions(-) (limited to 'src/net') diff --git a/src/net/download.cpp b/src/net/download.cpp index bc8ea4f72..355d30eca 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -64,7 +64,7 @@ Download::Download(void *ptr, const std::string &url, mError = static_cast(calloc(CURL_ERROR_SIZE + 1, 1)); mError[0] = 0; - mOptions.cancel = false; + mOptions.cancel = 0; } Download::~Download() @@ -114,7 +114,7 @@ void Download::noCache() void Download::setFile(const std::string &filename, Sint64 adler32) { - mOptions.memoryWrite = false; + mOptions.memoryWrite = 0; mFileName = filename; if (adler32 > -1) @@ -124,7 +124,7 @@ void Download::setFile(const std::string &filename, Sint64 adler32) } else { - mOptions.checkAdler = false; + mOptions.checkAdler = 0; } } diff --git a/src/net/ea/inventoryhandler.h b/src/net/ea/inventoryhandler.h index c2e076751..b868b5dfa 100644 --- a/src/net/ea/inventoryhandler.h +++ b/src/net/ea/inventoryhandler.h @@ -114,8 +114,8 @@ class InventoryItem int slot; int id; int quantity; - unsigned char color; int refine; + unsigned char color; bool equip; InventoryItem(int slot0, int id0, int quantity0, int refine0, @@ -123,8 +123,8 @@ class InventoryItem slot(slot0), id(id0), quantity(quantity0), - color(color0), refine(refine0), + color(color0), equip(equip0) { } diff --git a/src/net/manaserv/attributes.cpp b/src/net/manaserv/attributes.cpp index 9d1e159ff..eb0f72dc5 100644 --- a/src/net/manaserv/attributes.cpp +++ b/src/net/manaserv/attributes.cpp @@ -350,8 +350,9 @@ namespace Attributes continue; } } - logger->log("Found %d tags for %d attributes.", int(tags.size()), - int(attributes.size())); + logger->log("Found %d tags for %d attributes.", + static_cast(tags.size()), + static_casr(attributes.size())); fillLabels(); diff --git a/src/net/manaserv/buysellhandler.cpp b/src/net/manaserv/buysellhandler.cpp index 25db86cf0..e9be139f6 100644 --- a/src/net/manaserv/buysellhandler.cpp +++ b/src/net/manaserv/buysellhandler.cpp @@ -97,7 +97,7 @@ void BuySellHandler::handleMessage(Net::MessageIn &msg) int itemId = msg.readInt16(); int amount = msg.readInt16(); int value = msg.readInt16(); - dialog->addItem(new Item(itemId, amount, 1, false), value); + dialog->addItem(new Item(itemId, amount, 0, 1, false), value); } break; } diff --git a/src/net/manaserv/inventoryhandler.h b/src/net/manaserv/inventoryhandler.h index 88bb0510d..0241bcc7f 100644 --- a/src/net/manaserv/inventoryhandler.h +++ b/src/net/manaserv/inventoryhandler.h @@ -36,7 +36,7 @@ class EquipBackend : public Equipment::Backend { public: EquipBackend() - { memset(mEquipment, 0, sizeof(*mEquipment); } + { memset(mEquipment, 0, sizeof(*mEquipment)); } Item *getEquipment(int index) const { return mEquipment[index]; } diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index 6202070bb..04274a70b 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -174,13 +174,14 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, LocalPlayer *tempPlayer = new LocalPlayer(msg.readInt32(), 0); tempPlayer->setGender(token.sex); - character->data.mAttributes[EXP] = msg.readInt32(); - character->data.mAttributes[MONEY] = msg.readInt32(); - character->data.mStats[JOB].exp = msg.readInt32(); + PlayerInfoBackend &data = character->data; + data.mAttributes[EXP] = msg.readInt32(); + data.mAttributes[MONEY] = msg.readInt32(); + data.mStats[JOB].exp = msg.readInt32(); int temp = msg.readInt32(); - character->data.mStats[JOB].base = temp; - character->data.mStats[JOB].mod = temp; + data.mStats[JOB].base = temp; + data.mStats[JOB].mod = temp; int shoes = msg.readInt16(); int gloves = msg.readInt16(); @@ -192,10 +193,10 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, msg.readInt32(); // manner msg.readInt16(); // character points left - character->data.mAttributes[HP] = msg.readInt16(); - character->data.mAttributes[MAX_HP] = msg.readInt16(); - character->data.mAttributes[MP] = msg.readInt16(); - character->data.mAttributes[MAX_MP] = msg.readInt16(); + data.mAttributes[HP] = msg.readInt16(); + data.mAttributes[MAX_HP] = msg.readInt16(); + data.mAttributes[MP] = msg.readInt16(); + data.mAttributes[MAX_MP] = msg.readInt16(); msg.readInt16(); // speed tempPlayer->setSubtype(msg.readInt16()); // class (used for race) @@ -203,7 +204,7 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, Uint16 weapon = msg.readInt16(); // server not used it. may be need use? tempPlayer->setSprite(SPRITE_WEAPON, weapon, "", 1, true); - character->data.mAttributes[LEVEL] = msg.readInt16(); + data.mAttributes[LEVEL] = msg.readInt16(); msg.readInt16(); // skill point int bottomClothes = msg.readInt16(); diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index 7830d3a81..2323631cb 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -172,12 +172,9 @@ void ChatHandler::sendRaw(const std::string &args) line = line.substr(pos + 1); pos = line.find(" "); } - if (outMsg) - { - if (line != "") - processRaw(*outMsg, line); - delete outMsg; - } + if (line != "") + processRaw(*outMsg, line); + delete outMsg; } void ChatHandler::processRaw(MessageOut &outMsg, std::string &line) diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index 8f2f25d6d..8188efc73 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -215,8 +215,7 @@ void GeneralHandler::reloadPartially() void GeneralHandler::unload() { - if (mNetwork) - mNetwork->clearHandlers(); + clearHandlers(); } void GeneralHandler::flushNetwork() -- cgit v1.2.3-60-g2f50