diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-07-17 23:26:59 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-07-17 23:26:59 +0300 |
commit | 7e0a97d2521b9ce57003176e82a0b5564aa003c2 (patch) | |
tree | 5b2cfe1afe09bea1063f783050c1fb549daee76d /src/net/ea | |
parent | f68cbf700a99f2f184715a5b8025bcb4b6525391 (diff) | |
download | plus-7e0a97d2521b9ce57003176e82a0b5564aa003c2.tar.gz plus-7e0a97d2521b9ce57003176e82a0b5564aa003c2.tar.bz2 plus-7e0a97d2521b9ce57003176e82a0b5564aa003c2.tar.xz plus-7e0a97d2521b9ce57003176e82a0b5564aa003c2.zip |
Fix more code style and additional warnings.
Diffstat (limited to 'src/net/ea')
-rw-r--r-- | src/net/ea/beinghandler.cpp | 10 | ||||
-rw-r--r-- | src/net/ea/guildhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/ea/loginhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/ea/playerhandler.cpp | 119 | ||||
-rw-r--r-- | src/net/ea/playerhandler.h | 4 | ||||
-rw-r--r-- | src/net/ea/specialhandler.cpp | 6 |
6 files changed, 89 insertions, 54 deletions
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index c5d722db5..0e4fefa21 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -116,7 +116,8 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, bool visible) return; int id; - short job, speed, gender; + short job, speed; + uint8_t gender; uint16_t headTop, headMid, headBottom; uint16_t shoes, gloves; uint16_t weapon, shield; @@ -335,8 +336,8 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, bool visible) dstBeing->setStunMode(stunMode); dstBeing->setStatusEffectBlock(0, static_cast<uint16_t>( (statusEffects >> 16) & 0xffff)); - dstBeing->setStatusEffectBlock(16, statusEffects & 0xffff); - + dstBeing->setStatusEffectBlock(16, static_cast<uint16_t>( + statusEffects & 0xffff)); } void BeingHandler::processBeingMove2(Net::MessageIn &msg) @@ -761,7 +762,8 @@ void BeingHandler::processPlaterStatusChange(Net::MessageIn &msg) dstBeing->setStunMode(stunMode); dstBeing->setStatusEffectBlock(0, static_cast<uint16_t>( (statusEffects >> 16) & 0xffff)); - dstBeing->setStatusEffectBlock(16, statusEffects & 0xffff); + dstBeing->setStatusEffectBlock(16, static_cast<uint16_t>( + statusEffects & 0xffff)); } void BeingHandler::processBeingStatusChange(Net::MessageIn &msg) diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp index 75fc5af56..7c2361531 100644 --- a/src/net/ea/guildhandler.cpp +++ b/src/net/ea/guildhandler.cpp @@ -251,7 +251,7 @@ void GuildHandler::processGuildMemberList(Net::MessageIn &msg) m->setOnline(online); m->setID(id); m->setCharId(charId); - m->setGender(Being::intToGender(gender)); + m->setGender(Being::intToGender(static_cast<uint8_t>(gender))); m->setLevel(level); m->setExp(exp); m->setPos(pos); diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp index d35e5a0d5..2a7afb189 100644 --- a/src/net/ea/loginhandler.cpp +++ b/src/net/ea/loginhandler.cpp @@ -195,7 +195,7 @@ void LoginHandler::processLoginData(Net::MessageIn &msg) // msg.skip(30); // unknown // reserve bits for future usage - mToken.sex = Being::intToGender(msg.readInt8() & 3); + mToken.sex = Being::intToGender(static_cast<uint8_t>(msg.readInt8() & 3)); for (int i = 0; i < worldCount; i++) { diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 4c6e894c9..130b31046 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -362,48 +362,60 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg) break; case 0x0029: - PlayerInfo::setStatBase(EA_ATK, value); + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>( + EA_ATK), value); PlayerInfo::updateAttrs(); break; case 0x002a: - PlayerInfo::setStatMod(EA_ATK, value); + PlayerInfo::setStatMod(static_cast<PlayerInfo::Attribute>( + EA_ATK), value); PlayerInfo::updateAttrs(); break; case 0x002b: - PlayerInfo::setStatBase(EA_MATK, value); + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>( + EA_MATK), value); break; case 0x002c: - PlayerInfo::setStatMod(EA_MATK, value); + PlayerInfo::setStatMod(static_cast<PlayerInfo::Attribute>( + EA_MATK), value); break; case 0x002d: - PlayerInfo::setStatBase(EA_DEF, value); + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>( + EA_DEF), value); break; case 0x002e: - PlayerInfo::setStatMod(EA_DEF, value); + PlayerInfo::setStatMod(static_cast<PlayerInfo::Attribute>( + EA_DEF), value); break; case 0x002f: - PlayerInfo::setStatBase(EA_MDEF, value); + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>( + EA_MDEF), value); break; case 0x0030: - PlayerInfo::setStatMod(EA_MDEF, value); + PlayerInfo::setStatMod(static_cast<PlayerInfo::Attribute>( + EA_MDEF), value); break; case 0x0031: - PlayerInfo::setStatBase(EA_HIT, value); + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>( + EA_HIT), value); break; case 0x0032: - PlayerInfo::setStatBase(EA_FLEE, value); + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>( + EA_FLEE), value); break; case 0x0033: - PlayerInfo::setStatMod(EA_FLEE, value); + PlayerInfo::setStatMod(static_cast<PlayerInfo::Attribute>( + EA_FLEE), value); break; case 0x0034: - PlayerInfo::setStatBase(EA_CRIT, value); + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>( + EA_CRIT), value); break; case 0x0035: @@ -414,7 +426,8 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg) break; case 0x0037: - PlayerInfo::setStatBase(EA_JOB, value); + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>( + EA_JOB), value); break; case 500: @@ -445,8 +458,10 @@ void PlayerHandler::processPlayerStatUpdate2(Net::MessageIn &msg) PlayerInfo::setAttribute(PlayerInfo::EXP, msg.readInt32()); break; case 0x0002: - PlayerInfo::setStatExperience(EA_JOB, msg.readInt32(), - PlayerInfo::getStatExperience(EA_JOB).second); + PlayerInfo::setStatExperience(static_cast<PlayerInfo::Attribute>( + EA_JOB), msg.readInt32(), + PlayerInfo::getStatExperience(static_cast<PlayerInfo::Attribute>( + EA_JOB)).second); break; case 0x0014: { @@ -470,8 +485,9 @@ void PlayerHandler::processPlayerStatUpdate2(Net::MessageIn &msg) PlayerInfo::setAttribute(PlayerInfo::EXP_NEEDED, msg.readInt32()); break; case 0x0017: - PlayerInfo::setStatExperience(EA_JOB, - PlayerInfo::getStatExperience(EA_JOB).first, + PlayerInfo::setStatExperience(static_cast<PlayerInfo::Attribute>( + EA_JOB), PlayerInfo::getStatExperience( + static_cast<PlayerInfo::Attribute>(EA_JOB)).first, msg.readInt32()); break; default: @@ -486,8 +502,10 @@ void PlayerHandler::processPlayerStatUpdate3(Net::MessageIn &msg) int base = msg.readInt32(); int bonus = msg.readInt32(); - PlayerInfo::setStatBase(type, base, false); - PlayerInfo::setStatMod(type, bonus); + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>( + type), base, false); + PlayerInfo::setStatMod(static_cast<PlayerInfo::Attribute>( + type), bonus); if (type == EA_ATK || type == PlayerInfo::ATTACK_DELAY) PlayerInfo::updateAttrs(); } @@ -500,14 +518,15 @@ void PlayerHandler::processPlayerStatUpdate4(Net::MessageIn &msg) if (ok != 1) { - int oldValue = PlayerInfo::getStatBase(type); + int oldValue = PlayerInfo::getStatBase( + static_cast<PlayerInfo::Attribute>(type)); int points = PlayerInfo::getAttribute(PlayerInfo::CHAR_POINTS); points += oldValue - value; PlayerInfo::setAttribute(PlayerInfo::CHAR_POINTS, points); SERVER_NOTICE(_("Cannot raise skill!")) } - PlayerInfo::setStatBase(type, value); + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(type), value); } void PlayerHandler::processPlayerStatUpdate5(Net::MessageIn &msg) @@ -515,69 +534,80 @@ void PlayerHandler::processPlayerStatUpdate5(Net::MessageIn &msg) PlayerInfo::setAttribute(PlayerInfo::CHAR_POINTS, msg.readInt16()); int val = msg.readInt8(); - PlayerInfo::setStatBase(EA_STR, val); + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_STR), val); if (statusWindow) statusWindow->setPointsNeeded(EA_STR, msg.readInt8()); else msg.readInt8(); val = msg.readInt8(); - PlayerInfo::setStatBase(EA_AGI, val); + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_AGI), val); if (statusWindow) statusWindow->setPointsNeeded(EA_AGI, msg.readInt8()); else msg.readInt8(); val = msg.readInt8(); - PlayerInfo::setStatBase(EA_VIT, val); + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_VIT), val); if (statusWindow) statusWindow->setPointsNeeded(EA_VIT, msg.readInt8()); else msg.readInt8(); val = msg.readInt8(); - PlayerInfo::setStatBase(EA_INT, val); + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_INT), val); if (statusWindow) statusWindow->setPointsNeeded(EA_INT, msg.readInt8()); else msg.readInt8(); val = msg.readInt8(); - PlayerInfo::setStatBase(EA_DEX, val); + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_DEX), val); if (statusWindow) statusWindow->setPointsNeeded(EA_DEX, msg.readInt8()); else msg.readInt8(); val = msg.readInt8(); - PlayerInfo::setStatBase(EA_LUK, val); + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_LUK), val); if (statusWindow) statusWindow->setPointsNeeded(EA_LUK, msg.readInt8()); else msg.readInt8(); - PlayerInfo::setStatBase(EA_ATK, msg.readInt16(), false); - PlayerInfo::setStatMod(EA_ATK, msg.readInt16()); + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_ATK), + msg.readInt16(), false); + PlayerInfo::setStatMod(static_cast<PlayerInfo::Attribute>(EA_ATK), + msg.readInt16()); PlayerInfo::updateAttrs(); val = msg.readInt16(); - PlayerInfo::setStatBase(EA_MATK, val, false); + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_MATK), + val, false); val = msg.readInt16(); - PlayerInfo::setStatMod(EA_MATK, val); + PlayerInfo::setStatMod(static_cast<PlayerInfo::Attribute>(EA_MATK), val); - PlayerInfo::setStatBase(EA_DEF, msg.readInt16(), false); - PlayerInfo::setStatMod(EA_DEF, msg.readInt16()); + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_DEF), + msg.readInt16(), false); + PlayerInfo::setStatMod(static_cast<PlayerInfo::Attribute>(EA_DEF), + msg.readInt16()); - PlayerInfo::setStatBase(EA_MDEF, msg.readInt16(), false); - PlayerInfo::setStatMod(EA_MDEF, msg.readInt16()); + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_MDEF), + msg.readInt16(), false); + PlayerInfo::setStatMod(static_cast<PlayerInfo::Attribute>(EA_MDEF), + msg.readInt16()); - PlayerInfo::setStatBase(EA_HIT, msg.readInt16()); + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_HIT), + msg.readInt16()); - PlayerInfo::setStatBase(EA_FLEE, msg.readInt16(), false); - PlayerInfo::setStatMod(EA_FLEE, msg.readInt16()); + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_FLEE), + msg.readInt16(), false); + PlayerInfo::setStatMod(static_cast<PlayerInfo::Attribute>(EA_FLEE), + msg.readInt16()); - PlayerInfo::setStatBase(EA_CRIT, msg.readInt16()); + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>(EA_CRIT), + msg.readInt16()); msg.readInt16(); // manner } @@ -635,17 +665,18 @@ void PlayerHandler::processPlayerArrowMessage(Net::MessageIn &msg) bool PlayerHandler::canUseMagic() const { - return PlayerInfo::getStatEffective(EA_MATK) > 0; + return PlayerInfo::getStatEffective(static_cast<PlayerInfo::Attribute>( + EA_MATK)) > 0; } -int PlayerHandler::getJobLocation() const +PlayerInfo::Attribute PlayerHandler::getJobLocation() const { - return EA_JOB; + return static_cast<PlayerInfo::Attribute>(EA_JOB); } -int PlayerHandler::getAttackLocation() const +PlayerInfo::Attribute PlayerHandler::getAttackLocation() const { - return EA_ATK; + return static_cast<PlayerInfo::Attribute>(EA_ATK); } } // namespace Ea diff --git a/src/net/ea/playerhandler.h b/src/net/ea/playerhandler.h index d0402ecfc..3e9d14804 100644 --- a/src/net/ea/playerhandler.h +++ b/src/net/ea/playerhandler.h @@ -47,9 +47,9 @@ class PlayerHandler : public Net::PlayerHandler Vector getDefaultWalkSpeed() const; - int getJobLocation() const; + PlayerInfo::Attribute getJobLocation() const; - int getAttackLocation() const; + PlayerInfo::Attribute getAttackLocation() const; void processWalkResponse(Net::MessageIn &msg); diff --git a/src/net/ea/specialhandler.cpp b/src/net/ea/specialhandler.cpp index dd0284ae8..7a760c5b4 100644 --- a/src/net/ea/specialhandler.cpp +++ b/src/net/ea/specialhandler.cpp @@ -94,7 +94,8 @@ void SpecialHandler::processPlayerSkills(Net::MessageIn &msg) msg.skip(24); // 0 unused int up = msg.readInt8(); - PlayerInfo::setStatBase(skillId, level); + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>( + skillId), level); if (skillDialog) { if (!skillDialog->updateSkill(skillId, range, up)) @@ -111,7 +112,8 @@ void SpecialHandler::processPlayerSkillUp(Net::MessageIn &msg) int range = msg.readInt16(); int up = msg.readInt8(); - PlayerInfo::setStatBase(skillId, level); + PlayerInfo::setStatBase(static_cast<PlayerInfo::Attribute>( + skillId), level); if (skillDialog) { if (!skillDialog->updateSkill(skillId, range, up)) |