mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 17:05:44 +01:00
Merge pull request #10319 from joschiwald/casts
Core/Misc: replace (Player*) casts with ToPlayer()
This commit is contained in:
@@ -258,7 +258,7 @@ public:
|
||||
if (!unit || (unit->GetTypeId() != TYPEID_PLAYER))
|
||||
player = handler->GetSession()->GetPlayer();
|
||||
else
|
||||
player = (Player*)unit;
|
||||
player = unit->ToPlayer();
|
||||
|
||||
if (!unit)
|
||||
unit = player;
|
||||
|
||||
@@ -90,8 +90,9 @@ public:
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity((Player*)target, 0))
|
||||
return false;
|
||||
if (Player* player = target->ToPlayer())
|
||||
if (handler->HasLowerSecurity(player, 0))
|
||||
return false;
|
||||
|
||||
handler->GetSession()->GetPlayer()->RewardHonor(target, 1);
|
||||
return true;
|
||||
|
||||
@@ -655,11 +655,9 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if (handler->HasLowerSecurity((Player*)target, 0, false))
|
||||
if (Player* player = target->ToPlayer())
|
||||
if (handler->HasLowerSecurity(player, 0, false))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target->IsAlive())
|
||||
{
|
||||
@@ -2227,11 +2225,9 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if (handler->HasLowerSecurity((Player*)target, 0, false))
|
||||
if (Player* player = target->ToPlayer())
|
||||
if (handler->HasLowerSecurity(player, 0, false))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!target->IsAlive())
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user