summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-04-21 05:54:26 +0300
committerAndrei Karas <akaras@inbox.ru>2018-04-23 03:31:27 +0300
commitdeef43ce3342df308cd19c9ff37a2e953ed31cf1 (patch)
tree89f778f413734c62e0176a5541b628f8318511dc /src/net
parent3147797b7973250aabbd2fdd8cf54dda35fd440a (diff)
downloadmanaplus-deef43ce3342df308cd19c9ff37a2e953ed31cf1.tar.gz
manaplus-deef43ce3342df308cd19c9ff37a2e953ed31cf1.tar.bz2
manaplus-deef43ce3342df308cd19c9ff37a2e953ed31cf1.tar.xz
manaplus-deef43ce3342df308cd19c9ff37a2e953ed31cf1.zip
Fix different cast issues and remove useless explicit keywords.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/eathena/playerhandler.cpp64
-rw-r--r--src/net/tmwa/playerhandler.cpp66
2 files changed, 71 insertions, 59 deletions
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: