diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-09-02 14:05:30 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-09-02 14:05:30 +0300 |
commit | 962f182fcc989ec587282e44f889188ce241ba31 (patch) | |
tree | da100971ec4952d0c56cb404862099c670bcfe0e /src/net/ea | |
parent | 4df121e6dcdf53436f50ce81dd60096ce0138a2c (diff) | |
download | manaverse-962f182fcc989ec587282e44f889188ce241ba31.tar.gz manaverse-962f182fcc989ec587282e44f889188ce241ba31.tar.bz2 manaverse-962f182fcc989ec587282e44f889188ce241ba31.tar.xz manaverse-962f182fcc989ec587282e44f889188ce241ba31.zip |
Add const to more classes.
Diffstat (limited to 'src/net/ea')
-rw-r--r-- | src/net/ea/beinghandler.cpp | 81 | ||||
-rw-r--r-- | src/net/ea/buysellhandler.cpp | 12 | ||||
-rw-r--r-- | src/net/ea/charserverhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/ea/chathandler.cpp | 22 | ||||
-rw-r--r-- | src/net/ea/gui/partytab.cpp | 6 | ||||
-rw-r--r-- | src/net/ea/guildhandler.cpp | 100 | ||||
-rw-r--r-- | src/net/ea/inventoryhandler.cpp | 36 | ||||
-rw-r--r-- | src/net/ea/itemhandler.cpp | 37 | ||||
-rw-r--r-- | src/net/ea/loginhandler.cpp | 10 | ||||
-rw-r--r-- | src/net/ea/network.cpp | 15 | ||||
-rw-r--r-- | src/net/ea/network.h | 1 | ||||
-rw-r--r-- | src/net/ea/npchandler.cpp | 2 | ||||
-rw-r--r-- | src/net/ea/partyhandler.cpp | 40 | ||||
-rw-r--r-- | src/net/ea/playerhandler.cpp | 40 | ||||
-rw-r--r-- | src/net/ea/specialhandler.cpp | 16 | ||||
-rw-r--r-- | src/net/ea/tradehandler.cpp | 12 |
16 files changed, 218 insertions, 214 deletions
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index d8fd49fe2..1dc98f776 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -79,7 +79,7 @@ Being *BeingHandler::createBeing(int id, short job) else if (job == 45) type = ActorSprite::PORTAL; - Being *being = actorSpriteManager->createBeing(id, type, job); + Being *const being = actorSpriteManager->createBeing(id, type, job); if (type == ActorSprite::PLAYER || type == ActorSprite::NPC) { @@ -212,12 +212,12 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, bool visible) { if (serverVersion > 0) { - int hp = msg.readInt32(); - int maxHP = msg.readInt32(); + const int hp = msg.readInt32(); + const int maxHP = msg.readInt32(); if (hp && maxHP) { dstBeing->setMaxHP(maxHP); - int oldHP = dstBeing->getHP(); + const int oldHP = dstBeing->getHP(); if (!oldHP || oldHP > hp) dstBeing->setHP(hp); } @@ -247,7 +247,7 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, bool visible) dstBeing->setStatusEffectBlock(32, msg.readInt16()); // opt3 if (serverVersion > 0 && dstBeing->getType() == ActorSprite::MONSTER) { - int attackRange = msg.readInt8(); // karma + const int attackRange = msg.readInt8(); // karma dstBeing->setAttackRange(attackRange); } else @@ -310,7 +310,7 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, bool visible) if (job == 45 && socialWindow && outfitWindow) { - int num = socialWindow->getPortalIndex(x, y); + const int num = socialWindow->getPortalIndex(x, y); if (num >= 0) { dstBeing->setName(keyboard.getKeyShortString( @@ -347,7 +347,7 @@ void BeingHandler::processBeingMove2(Net::MessageIn &msg) * later versions of eAthena for both mobs and * players */ - Being *dstBeing = actorSpriteManager->findBeing(msg.readInt32()); + Being *const dstBeing = actorSpriteManager->findBeing(msg.readInt32()); /* * This packet doesn't have enough info to actually @@ -387,8 +387,8 @@ void BeingHandler::processBeingRemove(Net::MessageIn &msg) // A being should be removed or has died - int id = msg.readInt32(); - Being *dstBeing = actorSpriteManager->findBeing(id); + const int id = msg.readInt32(); + Being *const dstBeing = actorSpriteManager->findBeing(id); if (!dstBeing) return; @@ -429,8 +429,8 @@ void BeingHandler::processBeingResurrect(Net::MessageIn &msg) // A being changed mortality status - int id = msg.readInt32(); - Being *dstBeing = actorSpriteManager->findBeing(id); + const int id = msg.readInt32(); + Being *const dstBeing = actorSpriteManager->findBeing(id); if (!dstBeing) return; @@ -452,7 +452,7 @@ void BeingHandler::processSkillDamage(Net::MessageIn &msg) Being *dstBeing; int param1; - int id = msg.readInt16(); // Skill Id + const int id = msg.readInt16(); // Skill Id srcBeing = actorSpriteManager->findBeing(msg.readInt32()); dstBeing = actorSpriteManager->findBeing(msg.readInt32()); msg.readInt32(); // Server tick @@ -482,15 +482,15 @@ void BeingHandler::processBeingAction(Net::MessageIn &msg) if (!actorSpriteManager) return; - Being *srcBeing = actorSpriteManager->findBeing(msg.readInt32()); - Being *dstBeing = actorSpriteManager->findBeing(msg.readInt32()); + Being *const srcBeing = actorSpriteManager->findBeing(msg.readInt32()); + Being *const dstBeing = actorSpriteManager->findBeing(msg.readInt32()); msg.readInt32(); // server tick - int srcSpeed = msg.readInt32(); // src speed + const int srcSpeed = msg.readInt32(); // src speed msg.readInt32(); // dst speed - int param1 = msg.readInt16(); + const int param1 = msg.readInt16(); msg.readInt16(); // param 2 - int type = msg.readInt8(); + const int type = msg.readInt8(); msg.readInt16(); // param 3 switch (type) @@ -565,14 +565,12 @@ void BeingHandler::processBeingSelfEffect(Net::MessageIn &msg) if (!effectManager || !actorSpriteManager) return; - int id; - - id = static_cast<uint32_t>(msg.readInt32()); - Being* being = actorSpriteManager->findBeing(id); + int id = static_cast<uint32_t>(msg.readInt32()); + Being *const being = actorSpriteManager->findBeing(id); if (!being) return; - int effectType = msg.readInt32(); + const int effectType = msg.readInt32(); effectManager->trigger(effectType, being); @@ -597,7 +595,7 @@ void BeingHandler::processBeingEmotion(Net::MessageIn &msg) if (player_relations.hasPermission(dstBeing, PlayerRelation::EMOTE)) { - unsigned char emote = msg.readInt8(); + const unsigned char emote = msg.readInt8(); if (emote) { dstBeing->setEmote(emote, EMOTION_TIME); @@ -615,7 +613,7 @@ void BeingHandler::processNameResponse(Net::MessageIn &msg) Being *dstBeing; - int beingId = msg.readInt32(); + const int beingId = msg.readInt32(); if ((dstBeing = actorSpriteManager->findBeing(beingId))) { if (beingId == player_node->getId()) @@ -633,10 +631,11 @@ void BeingHandler::processNameResponse(Net::MessageIn &msg) if (player_node) { - Party *party = player_node->getParty(); + const Party *const party = player_node->getParty(); if (party && party->isMember(dstBeing->getId())) { - PartyMember *member = party->getMember(dstBeing->getId()); + PartyMember *const member = party->getMember( + dstBeing->getId()); if (member) member->setName(dstBeing->getName()); @@ -691,7 +690,7 @@ void BeingHandler::processBeingChangeDirection(Net::MessageIn &msg) msg.readInt16(); // unused - unsigned char dir = msg.readInt8(); + const unsigned char dir = msg.readInt8(); dstBeing->setDirection(dir); if (player_node) player_node->imitateDirection(dstBeing, dir); @@ -714,11 +713,11 @@ void BeingHandler::processPlayerStop(Net::MessageIn &msg) * of the config setting. */ - int id = msg.readInt32(); + const int id = msg.readInt32(); if (mSync || id != player_node->getId()) { - Being *dstBeing = actorSpriteManager->findBeing(id); + Being *const dstBeing = actorSpriteManager->findBeing(id); if (dstBeing) { uint16_t x, y; @@ -750,12 +749,12 @@ void BeingHandler::processPlaterStatusChange(Net::MessageIn &msg) // Change in players' flags - int id = msg.readInt32(); - Being *dstBeing = actorSpriteManager->findBeing(id); + const int id = msg.readInt32(); + Being *const dstBeing = actorSpriteManager->findBeing(id); if (!dstBeing) return; - uint16_t stunMode = msg.readInt16(); + const uint16_t stunMode = msg.readInt16(); uint32_t statusEffects = msg.readInt16(); statusEffects |= (static_cast<uint32_t>(msg.readInt16())) << 16; msg.readInt8(); // Unused? @@ -773,11 +772,11 @@ void BeingHandler::processBeingStatusChange(Net::MessageIn &msg) return; // Status change - uint16_t status = msg.readInt16(); - int id = msg.readInt32(); - int flag = msg.readInt8(); // 0: stop, 1: start + const uint16_t status = msg.readInt16(); + const int id = msg.readInt32(); + const int flag = msg.readInt8(); // 0: stop, 1: start - Being *dstBeing = actorSpriteManager->findBeing(id); + Being *const dstBeing = actorSpriteManager->findBeing(id); if (dstBeing) dstBeing->setStatusEffect(status, flag); } @@ -804,23 +803,23 @@ void BeingHandler::processSkillNoDamage(Net::MessageIn &msg) void BeingHandler::processPvpMapMode(Net::MessageIn &msg) { - Game *game = Game::instance(); + const Game *const game = Game::instance(); if (!game) return; - Map *map = game->getCurrentMap(); + Map *const map = game->getCurrentMap(); if (map) map->setPvpMode(msg.readInt16()); } void BeingHandler::processPvpSet(Net::MessageIn &msg) { - int id = msg.readInt32(); // id - int rank = msg.readInt32(); // rank + const int id = msg.readInt32(); // id + const int rank = msg.readInt32(); // rank msg.readInt32(); // num if (actorSpriteManager) { - Being *dstBeing = actorSpriteManager->findBeing(id); + Being *const dstBeing = actorSpriteManager->findBeing(id); if (dstBeing) dstBeing->setPvpRank(rank); } diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp index 8566bcab7..9cee4d434 100644 --- a/src/net/ea/buysellhandler.cpp +++ b/src/net/ea/buysellhandler.cpp @@ -139,19 +139,19 @@ void BuySellHandler::processNpcBuySellChoice(Net::MessageIn &msg) void BuySellHandler::processNpcSell(Net::MessageIn &msg, int offset) { msg.readInt16(); // length - int n_items = (msg.getLength() - 4) / 10; + const int n_items = (msg.getLength() - 4) / 10; if (n_items > 0) { - SellDialog *dialog = new SellDialog(mNpcId); + SellDialog *const dialog = new SellDialog(mNpcId); dialog->setMoney(PlayerInfo::getAttribute(PlayerInfo::MONEY)); for (int k = 0; k < n_items; k++) { - int index = msg.readInt16() - offset; - int value = msg.readInt32(); - msg.readInt32(); // OCvalue + const int index = msg.readInt16() - offset; + const int value = msg.readInt32(); + msg.readInt32(); // value - Item *item = PlayerInfo::getInventory()->getItem(index); + const Item *const item = PlayerInfo::getInventory()->getItem(index); if (item && !(item->isEquipped())) dialog->addItem(item, value); diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp index 62c9090e9..7e0a5106d 100644 --- a/src/net/ea/charserverhandler.cpp +++ b/src/net/ea/charserverhandler.cpp @@ -124,7 +124,7 @@ void CharServerHandler::processCharLoginError(Net::MessageIn &msg) void CharServerHandler::processCharCreate(Net::MessageIn &msg, bool withColors) { - Net::Character *character = new Net::Character; + Net::Character *const character = new Net::Character; readPlayerData(msg, character, withColors); mCharacters.push_back(character); diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp index 6aea0e2f8..4d761a1ce 100644 --- a/src/net/ea/chathandler.cpp +++ b/src/net/ea/chathandler.cpp @@ -113,7 +113,7 @@ void ChatHandler::processWhisperResponse(Net::MessageIn &msg) mSentWhispers.pop(); } - int type = msg.readInt8(); + const int type = msg.readInt8(); switch (type) { case 0x00: @@ -147,7 +147,7 @@ void ChatHandler::processWhisperResponse(Net::MessageIn &msg) void ChatHandler::processWhisper(Net::MessageIn &msg) { - int chatMsgLength = msg.readInt16() - 28; + const int chatMsgLength = msg.readInt16() - 28; std::string nick = msg.readString(24); if (chatMsgLength <= 0) @@ -171,8 +171,8 @@ void ChatHandler::processWhisper(Net::MessageIn &msg) if (player_relations.hasPermission(nick, PlayerRelation::WHISPER)) { - bool tradeBot = config.getBoolValue("tradebot"); - bool showMsg = !config.getBoolValue("hideShopMessages"); + const bool tradeBot = config.getBoolValue("tradebot"); + const bool showMsg = !config.getBoolValue("hideShopMessages"); if (player_relations.hasPermission(nick, PlayerRelation::TRADE)) { if (shopWindow) @@ -255,8 +255,8 @@ void ChatHandler::processBeingChat(Net::MessageIn &msg) if (!actorSpriteManager) return; - int chatMsgLength = msg.readInt16() - 8; - Being *being = actorSpriteManager->findBeing(msg.readInt32()); + const int chatMsgLength = msg.readInt16() - 8; + Being *const being = actorSpriteManager->findBeing(msg.readInt32()); if (!being || chatMsgLength <= 0) return; @@ -301,7 +301,7 @@ void ChatHandler::processBeingChat(Net::MessageIn &msg) void ChatHandler::processChat(Net::MessageIn &msg, bool normalChat) { - int chatMsgLength = msg.readInt16() - 4; + const int chatMsgLength = msg.readInt16() - 4; if (chatMsgLength <= 0) return; @@ -338,10 +338,10 @@ void ChatHandler::processChat(Net::MessageIn &msg, bool normalChat) void ChatHandler::processMVP(Net::MessageIn &msg) { // Display MVP player - int id = msg.readInt32(); // id + const int id = msg.readInt32(); // id if (localChatTab && actorSpriteManager && config.getBoolValue("showMVP")) { - Being *being = actorSpriteManager->findBeing(id); + const Being *const being = actorSpriteManager->findBeing(id); if (!being) { localChatTab->chatLog(_("MVP player."), BY_SERVER); @@ -356,8 +356,8 @@ void ChatHandler::processMVP(Net::MessageIn &msg) void ChatHandler::processIgnoreAllResponse(Net::MessageIn &msg) { - int action = msg.readInt8(); - int fail = msg.readInt8(); + const int action = msg.readInt8(); + const int fail = msg.readInt8(); if (!localChatTab) return; diff --git a/src/net/ea/gui/partytab.cpp b/src/net/ea/gui/partytab.cpp index edbd867d9..9441f15b3 100644 --- a/src/net/ea/gui/partytab.cpp +++ b/src/net/ea/gui/partytab.cpp @@ -160,7 +160,7 @@ bool PartyTab::handleCommand(const std::string &type, const std::string &args) } } - char opt = CommandHandler::parseBoolean(args); + const char opt = CommandHandler::parseBoolean(args); switch (opt) { @@ -199,7 +199,7 @@ bool PartyTab::handleCommand(const std::string &type, const std::string &args) } } - char opt = CommandHandler::parseBoolean(args); + const char opt = CommandHandler::parseBoolean(args); switch (opt) { @@ -228,7 +228,7 @@ void PartyTab::getAutoCompleteList(StringVect &names) const if (!player_node) return; - Party *p = player_node->getParty(); + const Party *const p = player_node->getParty(); if (p) p->getNames(names); diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp index fb14540cb..9d4126106 100644 --- a/src/net/ea/guildhandler.cpp +++ b/src/net/ea/guildhandler.cpp @@ -71,7 +71,7 @@ bool GuildHandler::isSupported() void GuildHandler::processGuildCreateResponse(Net::MessageIn &msg) { - int flag = msg.readInt8(); + const int flag = msg.readInt8(); switch (flag) { @@ -104,14 +104,14 @@ void GuildHandler::processGuildCreateResponse(Net::MessageIn &msg) void GuildHandler::processGuildPositionInfo(Net::MessageIn &msg) { - int guildId = msg.readInt32(); - int emblem = msg.readInt32(); - int posMode = msg.readInt32(); + const int guildId = msg.readInt32(); + const int emblem = msg.readInt32(); + const int posMode = msg.readInt32(); msg.readInt32(); // Unused msg.readInt8(); // Unused std::string guildName = msg.readString(24); - Guild *g = Guild::getGuild(static_cast<short int>(guildId)); + Guild *const g = Guild::getGuild(static_cast<short int>(guildId)); if (!g) return; @@ -140,12 +140,12 @@ void GuildHandler::processGuildPositionInfo(Net::MessageIn &msg) void GuildHandler::processGuildMemberLogin(Net::MessageIn &msg) { - int accountId = msg.readInt32(); // Account ID - int charId = msg.readInt32(); // Char ID - int online = msg.readInt32(); // Flag + const int accountId = msg.readInt32(); // Account ID + const int charId = msg.readInt32(); // Char ID + const int online = msg.readInt32(); // Flag if (taGuild) { - GuildMember *m = taGuild->getMember(accountId, charId); + GuildMember *const m = taGuild->getMember(accountId, charId); if (m) m->setOnline(online); } @@ -158,13 +158,13 @@ void GuildHandler::processGuildMasterOrMember(Net::MessageIn &msg) void GuildHandler::processGuildBasicInfo(Net::MessageIn &msg) { - int guildId = msg.readInt32(); // Guild ID - int level = msg.readInt32(); // Guild level - int members = msg.readInt32(); // 'Connect member' - int maxMembers = msg.readInt32(); // 'Max member' - int avgLevel = msg.readInt32(); // Average level - int exp = msg.readInt32(); // Exp - int nextExp = msg.readInt32(); // Next exp + const int guildId = msg.readInt32(); // Guild ID + const int level = msg.readInt32(); // Guild level + const int members = msg.readInt32(); // 'Connect member' + const int maxMembers = msg.readInt32(); // 'Max member' + const int avgLevel = msg.readInt32(); // Average level + const int exp = msg.readInt32(); // Exp + const int nextExp = msg.readInt32(); // Next exp msg.skip(16); // 0 unused std::string name = msg.readString(24); // Name std::string master = msg.readString(24); // Master's name @@ -192,7 +192,7 @@ void GuildHandler::processGuildBasicInfo(Net::MessageIn &msg) castle.c_str()), BY_SERVER); } - Guild *g = Guild::getGuild(static_cast<short int>(guildId)); + Guild *const g = Guild::getGuild(static_cast<short int>(guildId)); if (!g) return; g->setName(name); @@ -200,10 +200,10 @@ void GuildHandler::processGuildBasicInfo(Net::MessageIn &msg) void GuildHandler::processGuildAlianceInfo(Net::MessageIn &msg) { - int length = msg.readInt16(); + const int length = msg.readInt16(); if (length < 4) return; - int count = (length - 4) / 32; + const int count = (length - 4) / 32; for (int i = 0; i < count; i++) { @@ -215,10 +215,10 @@ void GuildHandler::processGuildAlianceInfo(Net::MessageIn &msg) void GuildHandler::processGuildMemberList(Net::MessageIn &msg) { - int length = msg.readInt16(); + const int length = msg.readInt16(); if (length < 4) return; - int count = (length - 4) / 104; + const int count = (length - 4) / 104; if (!taGuild) { logger->log1("!taGuild"); @@ -229,20 +229,20 @@ void GuildHandler::processGuildMemberList(Net::MessageIn &msg) for (int i = 0; i < count; i++) { - int id = msg.readInt32(); // Account ID - int charId = msg.readInt32(); // Char ID + const int id = msg.readInt32(); // Account ID + const int charId = msg.readInt32(); // Char ID msg.readInt16(); // Hair msg.readInt16(); // Hair color - int gender = msg.readInt16(); // Gender - int race = msg.readInt16(); // Class - int level = msg.readInt16(); // Level - int exp = msg.readInt32(); // Exp - int online = msg.readInt32(); // Online - int pos = msg.readInt32(); // Position + const int gender = msg.readInt16(); // Gender + const int race = msg.readInt16(); // Class + const int level = msg.readInt16(); // Level + const int exp = msg.readInt32(); // Exp + const int online = msg.readInt32(); // Online + const int pos = msg.readInt32(); // Position msg.skip(50); // 0 unused std::string name = msg.readString(24); // Name - GuildMember *m = taGuild->addMember(id, charId, name); + GuildMember *const m = taGuild->addMember(id, charId, name); if (m) { m->setOnline(online); @@ -255,7 +255,7 @@ void GuildHandler::processGuildMemberList(Net::MessageIn &msg) m->setRace(race); if (actorSpriteManager) { - Being *being = actorSpriteManager->findBeingByName( + Being *const being = actorSpriteManager->findBeingByName( name, Being::PLAYER); if (being) { @@ -285,14 +285,14 @@ void GuildHandler::processGuildPosNameList(Net::MessageIn &msg) return; } - int length = msg.readInt16(); + const int length = msg.readInt16(); if (length < 4) return; - int count = (length - 4) / 28; + const int count = (length - 4) / 28; for (int i = 0; i < count; i++) { - int id = msg.readInt32(); // ID + const int id = msg.readInt32(); // ID std::string name = msg.readString(24); // Position name taGuild->addPos(id, name); } @@ -300,10 +300,10 @@ void GuildHandler::processGuildPosNameList(Net::MessageIn &msg) void GuildHandler::processGuildPosInfoList(Net::MessageIn &msg) { - int length = msg.readInt16(); + const int length = msg.readInt16(); if (length < 4) return; - int count = (length - 4) / 16; + const int count = (length - 4) / 16; for (int i = 0; i < count; i++) { @@ -327,12 +327,12 @@ void GuildHandler::processGuildPositionChanged(Net::MessageIn &msg) void GuildHandler::processGuildMemberPosChange(Net::MessageIn &msg) { msg.readInt16(); // Always 16 - int accountId = msg.readInt32(); // Account ID - int charId = msg.readInt32(); // Char ID - int pos = msg.readInt32(); // Position + const int accountId = msg.readInt32(); // Account ID + const int charId = msg.readInt32(); // Char ID + const int pos = msg.readInt32(); // Position if (taGuild) { - GuildMember *m = taGuild->getMember(accountId, charId); + GuildMember *const m = taGuild->getMember(accountId, charId); if (m) m->setPos(pos); } @@ -340,7 +340,7 @@ void GuildHandler::processGuildMemberPosChange(Net::MessageIn &msg) void GuildHandler::processGuildEmblem(Net::MessageIn &msg) { - int length = msg.readInt16(); + const int length = msg.readInt16(); msg.readInt32(); // Guild ID msg.readInt32(); // Emblem ID @@ -351,8 +351,8 @@ void GuildHandler::processGuildEmblem(Net::MessageIn &msg) void GuildHandler::processGuildSkillInfo(Net::MessageIn &msg) { - int length = msg.readInt16(); - int count = (length - 6) / 37; + const int length = msg.readInt16(); + const int count = (length - 6) / 37; msg.readInt16(); // 'Skill point' @@ -384,7 +384,7 @@ void GuildHandler::processGuildNotice(Net::MessageIn &msg) void GuildHandler::processGuildInvite(Net::MessageIn &msg) { - int guildId = msg.readInt32(); + const int guildId = msg.readInt32(); std::string guildName = msg.readString(24); if (socialWindow) @@ -393,7 +393,7 @@ void GuildHandler::processGuildInvite(Net::MessageIn &msg) void GuildHandler::processGuildInviteAck(Net::MessageIn &msg) { - int flag = msg.readInt8(); + const int flag = msg.readInt8(); if (!guildTab) return; @@ -457,7 +457,7 @@ void GuildHandler::processGuildLeave(Net::MessageIn &msg) } if (actorSpriteManager) { - Being *b = actorSpriteManager->findBeingByName( + Being *const b = actorSpriteManager->findBeingByName( nick, Being::PLAYER); if (b) @@ -506,7 +506,7 @@ void GuildHandler::processGuildExpulsion(Net::MessageIn &msg) if (actorSpriteManager) { - Being *b = actorSpriteManager->findBeingByName( + Being *const b = actorSpriteManager->findBeingByName( nick, Being::PLAYER); if (b) @@ -519,11 +519,11 @@ void GuildHandler::processGuildExpulsion(Net::MessageIn &msg) void GuildHandler::processGuildExpulsionList(Net::MessageIn &msg) { - int length = msg.readInt16(); + const int length = msg.readInt16(); if (length < 4) return; - int count = (length - 4) / 88; + const int count = (length - 4) / 88; for (int i = 0; i < count; i++) { @@ -535,7 +535,7 @@ void GuildHandler::processGuildExpulsionList(Net::MessageIn &msg) void GuildHandler::processGuildMessage(Net::MessageIn &msg) { - int msgLength = msg.readInt16() - 4; + const int msgLength = msg.readInt16() - 4; if (msgLength <= 0) return; diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index 6a4818129..1da1fe4ea 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -185,7 +185,7 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg, } msg.readInt16(); // length - int number = (msg.getLength() - 4) / 18; + const int number = (msg.getLength() - 4) / 18; for (int loop = 0; loop < number; loop++) { @@ -214,7 +214,7 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg, if (playerInvintory) { // Trick because arrows are not considered equipment - bool isEquipment = arrow & 0x8000; + const bool isEquipment = arrow & 0x8000; if (inventory) { @@ -237,7 +237,7 @@ void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg) unsigned char identified; msg.readInt16(); // length - int number = (msg.getLength() - 4) / 20; + const int number = (msg.getLength() - 4) / 20; for (int loop = 0; loop < number; loop++) { @@ -300,7 +300,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg) const ItemInfo &itemInfo = ItemDB::get(itemId); - unsigned char err = msg.readInt8(); + const unsigned char err = msg.readInt8(); if (mSentPickups.empty()) { floorId = 0; @@ -326,7 +326,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg) if (inventory) { - Item *item = inventory->getItem(index); + const Item *const item = inventory->getItem(index); if (item && item->getId() == itemId) amount += item->getQuantity(); @@ -351,7 +351,7 @@ void InventoryHandler::processPlayerInventoryRemove(Net::MessageIn &msg) amount = msg.readInt16(); if (inventory) { - if (Item *item = inventory->getItem(index)) + if (Item *const item = inventory->getItem(index)) { item->increaseQuantity(-amount); if (item->getQuantity() == 0) @@ -377,7 +377,7 @@ void InventoryHandler::processPlayerInventoryUse(Net::MessageIn &msg) if (inventory) { - if (Item *item = inventory->getItem(index)) + if (Item *const item = inventory->getItem(index)) { if (amount) item->setQuantity(amount); @@ -405,7 +405,7 @@ void InventoryHandler::processItemUseResponse(Net::MessageIn &msg) { if (inventory) { - if (Item *item = inventory->getItem(index)) + if (Item *const item = inventory->getItem(index)) { if (amount) item->setQuantity(amount); @@ -424,7 +424,7 @@ void InventoryHandler::processPlayerStorageStatus(Net::MessageIn &msg) * packets that update storage contents. */ msg.readInt16(); // Used count - int size = msg.readInt16(); // Max size + const int size = msg.readInt16(); // Max size if (!mStorage) mStorage = new Inventory(Inventory::STORAGE, size); @@ -456,7 +456,7 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg) for (int i = 0; i < 4; i++) msg.readInt16(); // card i - if (Item *item = mStorage->getItem(index)) + if (Item *const item = mStorage->getItem(index)) { item->setId(itemId, identified); item->increaseQuantity(amount); @@ -483,7 +483,7 @@ void InventoryHandler::processPlayerStorageRemove(Net::MessageIn &msg) amount = msg.readInt16(); if (mStorage) { - if (Item *item = mStorage->getItem(index)) + if (Item *const item = mStorage->getItem(index)) { item->increaseQuantity(-amount); if (item->getQuantity() == 0) @@ -528,7 +528,7 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg) { index = msg.readInt16() - INVENTORY_OFFSET; itemId = msg.readInt16(); - int itemType = msg.readInt8(); // type + const int itemType = msg.readInt8(); // type identified = msg.readInt8(); // identify flag msg.readInt16(); // equip type @@ -561,9 +561,9 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg) void InventoryHandler::processPlayerEquip(Net::MessageIn &msg) { - int index = msg.readInt16() - INVENTORY_OFFSET; - int equipType = msg.readInt16(); - int flag = msg.readInt8(); + const int index = msg.readInt16() - INVENTORY_OFFSET; + const int equipType = msg.readInt16(); + const int flag = msg.readInt8(); if (!flag) SERVER_NOTICE(_("Unable to equip.")) @@ -574,8 +574,8 @@ void InventoryHandler::processPlayerEquip(Net::MessageIn &msg) void InventoryHandler::processPlayerUnEquip(Net::MessageIn &msg) { msg.readInt16(); // inder val - INVENTORY_OFFSET; - int equipType = msg.readInt16(); - int flag = msg.readInt8(); + const int equipType = msg.readInt16(); + const int flag = msg.readInt8(); if (flag) mEquips.setEquipment(getSlot(equipType), -1); @@ -585,7 +585,7 @@ void InventoryHandler::processPlayerUnEquip(Net::MessageIn &msg) void InventoryHandler::processPlayerAttackRange(Net::MessageIn &msg) { - int range = msg.readInt16(); + const int range = msg.readInt16(); if (player_node) player_node->setAttackRange(range); PlayerInfo::setStatBase(PlayerInfo::ATTACK_RANGE, range); diff --git a/src/net/ea/itemhandler.cpp b/src/net/ea/itemhandler.cpp index f4954d3d5..f216fe01a 100644 --- a/src/net/ea/itemhandler.cpp +++ b/src/net/ea/itemhandler.cpp @@ -35,14 +35,14 @@ ItemHandler::ItemHandler() void ItemHandler::processItemVisible(Net::MessageIn &msg) { - int id = msg.readInt32(); - int itemId = msg.readInt16(); - unsigned char identify = msg.readInt8(); // identify flag - int x = msg.readInt16(); - int y = msg.readInt16(); - int amount = msg.readInt16(); - int subX = msg.readInt8(); - int subY = msg.readInt8(); + const int id = msg.readInt32(); + const int itemId = msg.readInt16(); + const unsigned char identify = msg.readInt8(); // identify flag + const int x = msg.readInt16(); + const int y = msg.readInt16(); + const int amount = msg.readInt16(); + const int subX = msg.readInt8(); + const int subY = msg.readInt8(); if (actorSpriteManager) { @@ -53,14 +53,14 @@ void ItemHandler::processItemVisible(Net::MessageIn &msg) void ItemHandler::processItemDropped(Net::MessageIn &msg) { - int id = msg.readInt32(); - int itemId = msg.readInt16(); - unsigned char identify = msg.readInt8(); // identify flag - int x = msg.readInt16(); - int y = msg.readInt16(); - int subX = msg.readInt8(); - int subY = msg.readInt8(); - int amount = msg.readInt16(); + const int id = msg.readInt32(); + const int itemId = msg.readInt16(); + const unsigned char identify = msg.readInt8(); // identify flag + const int x = msg.readInt16(); + const int y = msg.readInt16(); + const int subX = msg.readInt8(); + const int subY = msg.readInt8(); + const int amount = msg.readInt16(); if (actorSpriteManager) { @@ -73,8 +73,11 @@ void ItemHandler::processItemRemove(Net::MessageIn &msg) { if (actorSpriteManager) { - if (FloorItem *item = actorSpriteManager->findItem(msg.readInt32())) + if (FloorItem *const item = actorSpriteManager + ->findItem(msg.readInt32())) + { actorSpriteManager->destroy(item); + } } } diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp index 18cc26351..09a4066e0 100644 --- a/src/net/ea/loginhandler.cpp +++ b/src/net/ea/loginhandler.cpp @@ -78,7 +78,7 @@ void LoginHandler::chooseServer(unsigned int server) if (server >= mWorlds.size() || !mWorlds[server]) return; - ServerInfo *charServer = getCharServer(); + ServerInfo *const charServer = getCharServer(); if (charServer) { if (config.getBoolValue("usePersistentIP")) @@ -130,7 +130,7 @@ void LoginHandler::clearWorlds() void LoginHandler::procecessCharPasswordResponse(Net::MessageIn &msg) { // 0: acc not found, 1: success, 2: password mismatch, 3: pass too short - int errMsg = msg.readInt8(); + const int errMsg = msg.readInt8(); // Successful pass change if (errMsg == 1) { @@ -184,7 +184,7 @@ void LoginHandler::processLoginData(Net::MessageIn &msg) clearWorlds(); - int worldCount = (msg.getLength() - 47) / 32; + const int worldCount = (msg.getLength() - 47) / 32; mToken.session_ID1 = msg.readInt32(); mToken.account_ID = msg.readInt32(); @@ -199,7 +199,7 @@ void LoginHandler::processLoginData(Net::MessageIn &msg) for (int i = 0; i < worldCount; i++) { - WorldInfo *world = new WorldInfo; + WorldInfo *const world = new WorldInfo; world->address = msg.readInt32(); world->port = msg.readInt16(); @@ -220,7 +220,7 @@ void LoginHandler::processLoginData(Net::MessageIn &msg) void LoginHandler::processLoginError(Net::MessageIn &msg) { - int code = msg.readInt8(); + const int code = msg.readInt8(); logger->log("Login::error code: %i", code); switch (code) diff --git a/src/net/ea/network.cpp b/src/net/ea/network.cpp index fc50c0971..679ff450d 100644 --- a/src/net/ea/network.cpp +++ b/src/net/ea/network.cpp @@ -44,7 +44,7 @@ const unsigned int BUFFER_LIMIT = 930000; int networkThread(void *data) { - Network *network = static_cast<Network*>(data); + Network *const network = static_cast<Network *const>(data); if (!network || !network->realConnect()) return -1; @@ -62,11 +62,12 @@ Network::Network() : mOutSize(0), mToSkip(0), mState(IDLE), - mWorkerThread(nullptr) + mWorkerThread(nullptr), + mMutex(SDL_CreateMutex()), + mSleep(config.getIntValue("networksleep")) { SDLNet_Init(); - mMutex = SDL_CreateMutex(); } Network::~Network() @@ -135,9 +136,8 @@ void Network::disconnect() // need call SDLNet_TCP_DelSocket? SDLNet_TCP_Close(mSocket); mSocket = nullptr; - int sleep = config.getIntValue("networksleep"); - if (sleep > 0) - SDL_Delay(sleep); + if (mSleep > 0) + SDL_Delay(mSleep); } } @@ -237,7 +237,8 @@ void Network::receive() { // TODO Try to get this to block all the time while still being able // to escape the loop - int numReady = SDLNet_CheckSockets(set, (static_cast<uint32_t>(500))); + const int numReady = SDLNet_CheckSockets( + set, (static_cast<uint32_t>(500))); int ret; switch (numReady) { diff --git a/src/net/ea/network.h b/src/net/ea/network.h index 2fe2037a9..913af7e6b 100644 --- a/src/net/ea/network.h +++ b/src/net/ea/network.h @@ -104,6 +104,7 @@ class Network SDL_Thread *mWorkerThread; SDL_mutex *mMutex; + int mSleep; }; } // namespace Ea diff --git a/src/net/ea/npchandler.cpp b/src/net/ea/npchandler.cpp index 9ce72fd96..155a1f36f 100644 --- a/src/net/ea/npchandler.cpp +++ b/src/net/ea/npchandler.cpp @@ -54,7 +54,7 @@ void NpcHandler::endShopping(int beingId A_UNUSED) void NpcHandler::clearDialogs() { NpcDialogs::iterator it = mNpcDialogs.begin(); - NpcDialogs::iterator it_end = mNpcDialogs.end(); + const NpcDialogs::iterator it_end = mNpcDialogs.end(); while (it != it_end) { delete (*it).second.dialog; diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp index fa853bb4b..70207ec2a 100644 --- a/src/net/ea/partyhandler.cpp +++ b/src/net/ea/partyhandler.cpp @@ -103,11 +103,11 @@ void PartyHandler::processPartyInfo(Net::MessageIn &msg) if (Ea::taParty) Ea::taParty->clearMembers(); - int length = msg.readInt16(); + const int length = msg.readInt16(); if (Ea::taParty) Ea::taParty->setName(msg.readString(24)); - int count = (length - 28) / 46; + const int count = (length - 28) / 46; if (player_node && Ea::taParty) { player_node->setParty(Ea::taParty); @@ -116,11 +116,11 @@ void PartyHandler::processPartyInfo(Net::MessageIn &msg) for (int i = 0; i < count; i++) { - int id = msg.readInt32(); + const int id = msg.readInt32(); std::string nick = msg.readString(24); std::string map = msg.readString(16); - bool leader = msg.readInt8() == 0; - bool online = msg.readInt8() == 0; + const bool leader = msg.readInt8() == 0; + const bool online = msg.readInt8() == 0; if (Ea::taParty) { @@ -195,10 +195,10 @@ void PartyHandler::processPartyInviteResponse(Net::MessageIn &msg) void PartyHandler::processPartyInvited(Net::MessageIn &msg) { - int id = msg.readInt32(); + const int id = msg.readInt32(); std::string partyName = msg.readString(24); std::string nick(""); - Being *being; + const Being *being; if (actorSpriteManager) { @@ -225,8 +225,8 @@ void PartyHandler::processPartySettings(Net::MessageIn &msg) } // These seem to indicate the sharing mode for exp and items - short exp = msg.readInt16(); - short item = msg.readInt16(); + const short exp = msg.readInt16(); + const short item = msg.readInt16(); if (!Ea::partyTab) return; @@ -310,7 +310,7 @@ void PartyHandler::processPartySettings(Net::MessageIn &msg) void PartyHandler::processPartyMove(Net::MessageIn &msg) { - int id = msg.readInt32(); // id + const int id = msg.readInt32(); // id PartyMember *m = nullptr; if (Ea::taParty) m = Ea::taParty->getMember(id); @@ -338,7 +338,7 @@ void PartyHandler::processPartyMove(Net::MessageIn &msg) void PartyHandler::processPartyLeave(Net::MessageIn &msg) { - int id = msg.readInt32(); + const int id = msg.readInt32(); std::string nick = msg.readString(24); msg.readInt8(); // fail if (!player_node) @@ -369,7 +369,7 @@ void PartyHandler::processPartyLeave(Net::MessageIn &msg) } if (actorSpriteManager) { - Being *b = actorSpriteManager->findBeing(id); + Being *const b = actorSpriteManager->findBeing(id); if (b && b->getType() == Being::PLAYER) { b->setParty(nullptr); @@ -383,9 +383,9 @@ void PartyHandler::processPartyLeave(Net::MessageIn &msg) void PartyHandler::processPartyUpdateHp(Net::MessageIn &msg) { - int id = msg.readInt32(); - int hp = msg.readInt16(); - int maxhp = msg.readInt16(); + const int id = msg.readInt32(); + const int hp = msg.readInt16(); + const int maxhp = msg.readInt16(); PartyMember *m = nullptr; if (Ea::taParty) m = Ea::taParty->getMember(id); @@ -399,14 +399,14 @@ void PartyHandler::processPartyUpdateHp(Net::MessageIn &msg) // lets make sure they get the party hilight. if (actorSpriteManager && Ea::taParty) { - if (Being *b = actorSpriteManager->findBeing(id)) + if (Being *const b = actorSpriteManager->findBeing(id)) b->setParty(Ea::taParty); } } void PartyHandler::processPartyUpdateCoords(Net::MessageIn &msg) { - int id = msg.readInt32(); // id + const int id = msg.readInt32(); // id PartyMember *m = nullptr; if (Ea::taParty) m = Ea::taParty->getMember(id); @@ -424,16 +424,16 @@ void PartyHandler::processPartyUpdateCoords(Net::MessageIn &msg) void PartyHandler::processPartyMessage(Net::MessageIn &msg) { - int msgLength = msg.readInt16() - 8; + const int msgLength = msg.readInt16() - 8; if (msgLength <= 0) return; - int id = msg.readInt32(); + const int id = msg.readInt32(); std::string chatMsg = msg.readString(msgLength); if (Ea::taParty && Ea::partyTab) { - PartyMember *member = Ea::taParty->getMember(id); + const PartyMember *const member = Ea::taParty->getMember(id); if (member) { Ea::partyTab->chatLog(member->getName(), chatMsg); diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index b73782d3e..de687e96b 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -79,7 +79,7 @@ namespace if (viewport) viewport->closePopupMenu(); - Net::NpcHandler *handler = Net::getNpcHandler(); + Net::NpcHandler *const handler = Net::getNpcHandler(); if (handler) handler->clearDialogs(); if (player_node) @@ -205,10 +205,10 @@ void PlayerHandler::processPlayerWarp(Net::MessageIn &msg) if (player_node) player_node->stopAttack(); - Game *game = Game::instance(); + Game *const game = Game::instance(); const std::string ¤tMapName = game->getCurrentMapName(); - bool sameMap = (currentMapName == mapPath); + const bool sameMap = (currentMapName == mapPath); // Switch the actual map, deleting the previous one if necessary mapPath = mapPath.substr(0, mapPath.rfind(".")); @@ -219,7 +219,7 @@ void PlayerHandler::processPlayerWarp(Net::MessageIn &msg) if (player_node) { - Map *map = game->getCurrentMap(); + const Map *const map = game->getCurrentMap(); if (map) { if (x >= map->getWidth()) @@ -262,8 +262,8 @@ void PlayerHandler::processPlayerWarp(Net::MessageIn &msg) void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg) { - int type = msg.readInt16(); - int value = msg.readInt32(); + const int type = msg.readInt16(); + const int value = msg.readInt32(); if (!player_node) return; @@ -280,7 +280,7 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg) PlayerInfo::setAttribute(PlayerInfo::HP, value); if (player_node->isInParty() && Party::getParty(1)) { - PartyMember *m = Party::getParty(1) + PartyMember *const m = Party::getParty(1) ->getMember(player_node->getId()); if (m) { @@ -294,7 +294,7 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg) if (player_node->isInParty() && Party::getParty(1)) { - PartyMember *m = Party::getParty(1)->getMember( + PartyMember *const m = Party::getParty(1)->getMember( player_node->getId()); if (m) { @@ -453,7 +453,7 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg) void PlayerHandler::processPlayerStatUpdate2(Net::MessageIn &msg) { - int type = msg.readInt16(); + const int type = msg.readInt16(); switch (type) { case 0x0001: @@ -467,8 +467,8 @@ void PlayerHandler::processPlayerStatUpdate2(Net::MessageIn &msg) break; case 0x0014: { - int oldMoney = PlayerInfo::getAttribute(PlayerInfo::MONEY); - int newMoney = msg.readInt32(); + const int oldMoney = PlayerInfo::getAttribute(PlayerInfo::MONEY); + const int newMoney = msg.readInt32(); if (newMoney > oldMoney) { SERVER_NOTICE(strprintf(_("You picked up %s."), @@ -500,9 +500,9 @@ void PlayerHandler::processPlayerStatUpdate2(Net::MessageIn &msg) void PlayerHandler::processPlayerStatUpdate3(Net::MessageIn &msg) { - int type = msg.readInt32(); - int base = msg.readInt32(); - int bonus = msg.readInt32(); + const int type = msg.readInt32(); + const int base = msg.readInt32(); + const int bonus = msg.readInt32(); PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>( type), base, false); @@ -514,13 +514,13 @@ void PlayerHandler::processPlayerStatUpdate3(Net::MessageIn &msg) void PlayerHandler::processPlayerStatUpdate4(Net::MessageIn &msg) { - int type = msg.readInt16(); - int ok = msg.readInt8(); - int value = msg.readInt8(); + const int type = msg.readInt16(); + const int ok = msg.readInt8(); + const int value = msg.readInt8(); if (ok != 1) { - int oldValue = PlayerInfo::getStatBase( + const int oldValue = PlayerInfo::getStatBase( static_cast<PlayerInfo::Attribute>(type)); int points = PlayerInfo::getAttribute(PlayerInfo::CHAR_POINTS); points += oldValue - value; @@ -616,7 +616,7 @@ void PlayerHandler::processPlayerStatUpdate5(Net::MessageIn &msg) void PlayerHandler::processPlayerStatUpdate6(Net::MessageIn &msg) { - int type = msg.readInt16(); + const int type = msg.readInt16(); if (statusWindow) { switch (type) @@ -649,7 +649,7 @@ void PlayerHandler::processPlayerStatUpdate6(Net::MessageIn &msg) void PlayerHandler::processPlayerArrowMessage(Net::MessageIn &msg) { - int type = msg.readInt16(); + const int type = msg.readInt16(); switch (type) { diff --git a/src/net/ea/specialhandler.cpp b/src/net/ea/specialhandler.cpp index 226531a11..7bb69954f 100644 --- a/src/net/ea/specialhandler.cpp +++ b/src/net/ea/specialhandler.cpp @@ -84,14 +84,14 @@ void SpecialHandler::processPlayerSkills(Net::MessageIn &msg) for (int k = 0; k < skillCount; k++) { - int skillId = msg.readInt16(); + const int skillId = msg.readInt16(); msg.readInt16(); // target type msg.skip(2); // skill pool flags - int level = msg.readInt16(); + const int level = msg.readInt16(); msg.readInt16(); // sp - int range = msg.readInt16(); + const int range = msg.readInt16(); msg.skip(24); // 0 unused - int up = msg.readInt8(); + const int up = msg.readInt8(); PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>( skillId), level); @@ -108,8 +108,8 @@ void SpecialHandler::processPlayerSkillUp(Net::MessageIn &msg) const int skillId = msg.readInt16(); const int level = msg.readInt16(); msg.readInt16(); // sp - int range = msg.readInt16(); - int up = msg.readInt8(); + const int range = msg.readInt16(); + const int up = msg.readInt8(); PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>( skillId), level); @@ -127,8 +127,8 @@ void SpecialHandler::processSkillFailed(Net::MessageIn &msg) const int skillId = msg.readInt16(); const short bskill = msg.readInt16(); msg.readInt16(); // btype - char success = msg.readInt8(); - char reason = msg.readInt8(); + const char success = msg.readInt8(); + const char reason = msg.readInt8(); if (success != static_cast<int>(SKILL_FAILED) && bskill == static_cast<int>(BSKILL_EMOTE)) { diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp index fb49bdc62..32ddcfb98 100644 --- a/src/net/ea/tradehandler.cpp +++ b/src/net/ea/tradehandler.cpp @@ -177,11 +177,11 @@ void TradeHandler::processTradeResponse(Net::MessageIn &msg) void TradeHandler::processTradeItemAdd(Net::MessageIn &msg) { - int amount = msg.readInt32(); - int type = msg.readInt16(); - int identify = msg.readInt8(); // identified flag + const int amount = msg.readInt32(); + const int type = msg.readInt16(); + const int identify = msg.readInt8(); // identified flag msg.readInt8(); // attribute - int refine = msg.readInt8(); // refine + const int refine = msg.readInt8(); // refine msg.skip(8); // card (4 shorts) // TODO: handle also identified, etc @@ -213,9 +213,9 @@ void TradeHandler::processTradeItemAddResponse(Net::MessageIn &msg) tradeWindow->receivedOk(true); return; } - int quantity = msg.readInt16(); + const int quantity = msg.readInt16(); - int res = msg.readInt8(); + const int res = msg.readInt8(); switch (res) { case 0: |