diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-04-21 05:54:26 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-04-23 03:31:27 +0300 |
commit | deef43ce3342df308cd19c9ff37a2e953ed31cf1 (patch) | |
tree | 89f778f413734c62e0176a5541b628f8318511dc | |
parent | 3147797b7973250aabbd2fdd8cf54dda35fd440a (diff) | |
download | plus-deef43ce3342df308cd19c9ff37a2e953ed31cf1.tar.gz plus-deef43ce3342df308cd19c9ff37a2e953ed31cf1.tar.bz2 plus-deef43ce3342df308cd19c9ff37a2e953ed31cf1.tar.xz plus-deef43ce3342df308cd19c9ff37a2e953ed31cf1.zip |
Fix different cast issues and remove useless explicit keywords.
-rw-r--r-- | src/being/localplayer.h | 4 | ||||
-rw-r--r-- | src/gui/mailmessage.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/pincode.cpp | 2 | ||||
-rw-r--r-- | src/net/eathena/playerhandler.cpp | 64 | ||||
-rw-r--r-- | src/net/tmwa/playerhandler.cpp | 66 |
5 files changed, 75 insertions, 63 deletions
diff --git a/src/being/localplayer.h b/src/being/localplayer.h index f8faaaecb..14d38108d 100644 --- a/src/being/localplayer.h +++ b/src/being/localplayer.h @@ -55,8 +55,8 @@ class LocalPlayer final : public Being, /** * Constructor. */ - explicit LocalPlayer(const BeingId id, - const BeingTypeId subType); + LocalPlayer(const BeingId id, + const BeingTypeId subType); A_DELETE_COPY(LocalPlayer) diff --git a/src/gui/mailmessage.h b/src/gui/mailmessage.h index fb8ec9130..0d5399c3a 100644 --- a/src/gui/mailmessage.h +++ b/src/gui/mailmessage.h @@ -52,7 +52,7 @@ struct MailMessage final std::string text; int64_t id; int time; - int expireTime; + int64_t expireTime; int64_t money; MailMessageType::Type type; bool read; diff --git a/src/gui/widgets/pincode.cpp b/src/gui/widgets/pincode.cpp index 26b6f29d3..545b7313b 100644 --- a/src/gui/widgets/pincode.cpp +++ b/src/gui/widgets/pincode.cpp @@ -184,7 +184,7 @@ void Pincode::shuffle(uint32_t seed) const int k = 2; for (size_t f = 0; f < 10; f ++) - tab[f] = f; + tab[f] = CAST_S32(f); for (size_t f = 1; f < 10; f ++) { seed = baseSeed + seed * multiplier; diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp index c4fe7ca64..c86eb5c28 100644 --- a/src/net/eathena/playerhandler.cpp +++ b/src/net/eathena/playerhandler.cpp @@ -511,7 +511,7 @@ void PlayerHandler::setViewEquipment(const bool allow) const } #define setStatComplex(stat) \ - PlayerInfo::setStatBase(stat, base, notify); \ + PlayerInfo::setStatBase(stat, CAST_S32(base), notify); \ if (mod != NoStat) \ PlayerInfo::setStatMod(stat, mod, Notify_true) @@ -524,9 +524,9 @@ void PlayerHandler::setStat(Net::MessageIn &msg, switch (type) { case Sp::SPEED: - localPlayer->setWalkSpeed(base); + localPlayer->setWalkSpeed(CAST_S32(base)); PlayerInfo::setStatBase(Attributes::PLAYER_WALK_SPEED, - base, + CAST_S32(base), Notify_true); PlayerInfo::setStatMod(Attributes::PLAYER_WALK_SPEED, 0, @@ -544,7 +544,7 @@ void PlayerHandler::setStat(Net::MessageIn &msg, break; case Sp::KARMA: PlayerInfo::setStatBase(Attributes::PLAYER_KARMA, - base, + CAST_S32(base), Notify_true); PlayerInfo::setStatMod(Attributes::PLAYER_KARMA, 0, @@ -552,7 +552,7 @@ void PlayerHandler::setStat(Net::MessageIn &msg, break; case Sp::MANNER: PlayerInfo::setStatBase(Attributes::PLAYER_MANNER, - base, + CAST_S32(base), Notify_true); PlayerInfo::setStatMod(Attributes::PLAYER_MANNER, 0, @@ -568,7 +568,7 @@ void PlayerHandler::setStat(Net::MessageIn &msg, ->getMember(localPlayer->getId()); if (m != nullptr) { - m->setHp(base); + m->setHp(CAST_S32(base)); m->setMaxHp(PlayerInfo::getAttribute( Attributes::PLAYER_MAX_HP)); } @@ -586,7 +586,7 @@ void PlayerHandler::setStat(Net::MessageIn &msg, if (m != nullptr) { m->setHp(PlayerInfo::getAttribute(Attributes::PLAYER_HP)); - m->setMaxHp(base); + m->setMaxHp(CAST_S32(base)); } } break; @@ -611,7 +611,7 @@ void PlayerHandler::setStat(Net::MessageIn &msg, Notify_true); if (localPlayer != nullptr) { - localPlayer->setLevel(base); + localPlayer->setLevel(CAST_S32(base)); localPlayer->updateName(); } break; @@ -643,7 +643,7 @@ void PlayerHandler::setStat(Net::MessageIn &msg, case Sp::ZENY: { const int oldMoney = PlayerInfo::getAttribute(Attributes::MONEY); - const int newMoney = base; + const int newMoney = CAST_S32(base); if (newMoney > oldMoney) { NotifyManager::notify(NotifyTypes::MONEY_GET, @@ -681,90 +681,96 @@ void PlayerHandler::setStat(Net::MessageIn &msg, Notify_true); break; case Sp::USTR: - statusWindow->setPointsNeeded(Attributes::PLAYER_STR, base); + statusWindow->setPointsNeeded(Attributes::PLAYER_STR, + CAST_S32(base)); break; case Sp::UAGI: - statusWindow->setPointsNeeded(Attributes::PLAYER_AGI, base); + statusWindow->setPointsNeeded(Attributes::PLAYER_AGI, + CAST_S32(base)); break; case Sp::UVIT: - statusWindow->setPointsNeeded(Attributes::PLAYER_VIT, base); + statusWindow->setPointsNeeded(Attributes::PLAYER_VIT, + CAST_S32(base)); break; case Sp::UINT: - statusWindow->setPointsNeeded(Attributes::PLAYER_INT, base); + statusWindow->setPointsNeeded(Attributes::PLAYER_INT, + CAST_S32(base)); break; case Sp::UDEX: - statusWindow->setPointsNeeded(Attributes::PLAYER_DEX, base); + statusWindow->setPointsNeeded(Attributes::PLAYER_DEX, + CAST_S32(base)); break; case Sp::ULUK: - statusWindow->setPointsNeeded(Attributes::PLAYER_LUK, base); + statusWindow->setPointsNeeded(Attributes::PLAYER_LUK, + CAST_S32(base)); break; case Sp::ATK1: PlayerInfo::setStatBase(Attributes::PLAYER_ATK, - base, + CAST_S32(base), Notify_true); PlayerInfo::updateAttrs(); break; case Sp::ATK2: PlayerInfo::setStatMod(Attributes::PLAYER_ATK, - base, + CAST_S32(base), Notify_true); PlayerInfo::updateAttrs(); break; case Sp::MATK1: PlayerInfo::setStatBase(Attributes::PLAYER_MATK, - base, + CAST_S32(base), Notify_true); break; case Sp::MATK2: PlayerInfo::setStatMod(Attributes::PLAYER_MATK, - base, + CAST_S32(base), Notify_true); break; case Sp::DEF1: PlayerInfo::setStatBase(Attributes::PLAYER_DEF, - base, + CAST_S32(base), Notify_true); break; case Sp::DEF2: PlayerInfo::setStatMod(Attributes::PLAYER_DEF, - base, + CAST_S32(base), Notify_true); break; case Sp::MDEF1: PlayerInfo::setStatBase(Attributes::PLAYER_MDEF, - base, + CAST_S32(base), Notify_true); break; case Sp::MDEF2: PlayerInfo::setStatMod(Attributes::PLAYER_MDEF, - base, + CAST_S32(base), Notify_true); break; case Sp::HIT: PlayerInfo::setStatBase(Attributes::PLAYER_HIT, - base, + CAST_S32(base), Notify_true); break; case Sp::FLEE1: PlayerInfo::setStatBase(Attributes::PLAYER_FLEE, - base, + CAST_S32(base), Notify_true); break; case Sp::FLEE2: PlayerInfo::setStatMod(Attributes::PLAYER_FLEE, - base, + CAST_S32(base), Notify_true); break; case Sp::CRITICAL: PlayerInfo::setStatBase(Attributes::PLAYER_CRIT, - base, + CAST_S32(base), Notify_true); break; case Sp::ASPD: - localPlayer->setAttackSpeed(base); + localPlayer->setAttackSpeed(CAST_S32(base)); PlayerInfo::setStatBase(Attributes::PLAYER_ATTACK_DELAY, - base, + CAST_S32(base), Notify_true); PlayerInfo::setStatMod(Attributes::PLAYER_ATTACK_DELAY, 0, diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index 3cc37f3f5..0fd189f8e 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -212,7 +212,7 @@ void PlayerHandler::setViewEquipment(const bool allow A_UNUSED) const } #define setStatComplex(stat) \ - PlayerInfo::setStatBase(stat, base, notify); \ + PlayerInfo::setStatBase(stat, CAST_S32(base), notify); \ if (mod != NoStat) \ PlayerInfo::setStatMod(stat, mod, Notify_true) @@ -225,9 +225,9 @@ void PlayerHandler::setStat(Net::MessageIn &msg, switch (type) { case Sp::SPEED: - localPlayer->setWalkSpeed(base); + localPlayer->setWalkSpeed(CAST_S32(base)); PlayerInfo::setStatBase(Attributes::PLAYER_WALK_SPEED, - base, + CAST_S32(base), Notify_true); PlayerInfo::setStatMod(Attributes::PLAYER_WALK_SPEED, 0, @@ -245,7 +245,7 @@ void PlayerHandler::setStat(Net::MessageIn &msg, break; case Sp::KARMA: PlayerInfo::setStatBase(Attributes::PLAYER_KARMA, - base, + CAST_S32(base), Notify_true); PlayerInfo::setStatMod(Attributes::PLAYER_KARMA, 0, @@ -253,7 +253,7 @@ void PlayerHandler::setStat(Net::MessageIn &msg, break; case Sp::MANNER: PlayerInfo::setStatBase(Attributes::PLAYER_MANNER, - base, + CAST_S32(base), Notify_true); PlayerInfo::setStatMod(Attributes::PLAYER_MANNER, 0, @@ -269,7 +269,7 @@ void PlayerHandler::setStat(Net::MessageIn &msg, ->getMember(localPlayer->getId()); if (m != nullptr) { - m->setHp(base); + m->setHp(CAST_S32(base)); m->setMaxHp(PlayerInfo::getAttribute( Attributes::PLAYER_MAX_HP)); } @@ -287,7 +287,7 @@ void PlayerHandler::setStat(Net::MessageIn &msg, if (m != nullptr) { m->setHp(PlayerInfo::getAttribute(Attributes::PLAYER_HP)); - m->setMaxHp(base); + m->setMaxHp(CAST_S32(base)); } } break; @@ -312,7 +312,7 @@ void PlayerHandler::setStat(Net::MessageIn &msg, Notify_true); if (localPlayer != nullptr) { - localPlayer->setLevel(base); + localPlayer->setLevel(CAST_S32(base)); localPlayer->updateName(); } break; @@ -344,7 +344,7 @@ void PlayerHandler::setStat(Net::MessageIn &msg, case Sp::ZENY: { const int oldMoney = PlayerInfo::getAttribute(Attributes::MONEY); - const int newMoney = base; + const int newMoney = CAST_S32(base); if (newMoney > oldMoney) { NotifyManager::notify(NotifyTypes::MONEY_GET, @@ -382,89 +382,95 @@ void PlayerHandler::setStat(Net::MessageIn &msg, Notify_true); break; case Sp::USTR: - statusWindow->setPointsNeeded(Attributes::PLAYER_STR, base); + statusWindow->setPointsNeeded(Attributes::PLAYER_STR, + CAST_S32(base)); break; case Sp::UAGI: - statusWindow->setPointsNeeded(Attributes::PLAYER_AGI, base); + statusWindow->setPointsNeeded(Attributes::PLAYER_AGI, + CAST_S32(base)); break; case Sp::UVIT: - statusWindow->setPointsNeeded(Attributes::PLAYER_VIT, base); + statusWindow->setPointsNeeded(Attributes::PLAYER_VIT, + CAST_S32(base)); break; case Sp::UINT: - statusWindow->setPointsNeeded(Attributes::PLAYER_INT, base); + statusWindow->setPointsNeeded(Attributes::PLAYER_INT, + CAST_S32(base)); break; case Sp::UDEX: - statusWindow->setPointsNeeded(Attributes::PLAYER_DEX, base); + statusWindow->setPointsNeeded(Attributes::PLAYER_DEX, + CAST_S32(base)); break; case Sp::ULUK: - statusWindow->setPointsNeeded(Attributes::PLAYER_LUK, base); + statusWindow->setPointsNeeded(Attributes::PLAYER_LUK, + CAST_S32(base)); break; case Sp::ATK1: PlayerInfo::setStatBase(Attributes::PLAYER_ATK, - base, + CAST_S32(base), Notify_true); PlayerInfo::updateAttrs(); break; case Sp::ATK2: PlayerInfo::setStatMod(Attributes::PLAYER_ATK, - base, + CAST_S32(base), Notify_true); PlayerInfo::updateAttrs(); break; case Sp::MATK1: PlayerInfo::setStatBase(Attributes::PLAYER_MATK, - base, + CAST_S32(base), Notify_true); break; case Sp::MATK2: PlayerInfo::setStatMod(Attributes::PLAYER_MATK, - base, + CAST_S32(base), Notify_true); break; case Sp::DEF1: PlayerInfo::setStatBase(Attributes::PLAYER_DEF, - base, + CAST_S32(base), Notify_true); break; case Sp::DEF2: PlayerInfo::setStatMod(Attributes::PLAYER_DEF, - base, + CAST_S32(base), Notify_true); break; case Sp::MDEF1: PlayerInfo::setStatBase(Attributes::PLAYER_MDEF, - base, + CAST_S32(base), Notify_true); break; case Sp::MDEF2: PlayerInfo::setStatMod(Attributes::PLAYER_MDEF, - base, + CAST_S32(base), Notify_true); break; case Sp::HIT: PlayerInfo::setStatBase(Attributes::PLAYER_HIT, - base, + CAST_S32(base), Notify_true); break; case Sp::FLEE1: PlayerInfo::setStatBase(Attributes::PLAYER_FLEE, - base, + CAST_S32(base), Notify_true); break; case Sp::FLEE2: PlayerInfo::setStatMod(Attributes::PLAYER_FLEE, - base, + CAST_S32(base), Notify_true); break; case Sp::CRITICAL: PlayerInfo::setStatBase(Attributes::PLAYER_CRIT, - base, + CAST_S32(base), Notify_true); break; case Sp::ASPD: - localPlayer->setAttackSpeed(base); + localPlayer->setAttackSpeed(CAST_S32(base)); PlayerInfo::setStatBase(Attributes::PLAYER_ATTACK_DELAY, - base, + CAST_S32(base), Notify_true); PlayerInfo::setStatMod(Attributes::PLAYER_ATTACK_DELAY, 0, @@ -477,7 +483,7 @@ void PlayerHandler::setStat(Net::MessageIn &msg, Notify_true); break; case Sp::GM_LEVEL: - localPlayer->setGroupId(base); + localPlayer->setGroupId(CAST_S32(base)); break; default: |