1
0

Revert "Replace ItemCallbacks with lambdas (#3948)"

This reverts commit 496c337cdf.
This commit is contained in:
LogicParrot
2017-09-02 10:45:06 +03:00
committed by Alexander Harkness
parent 700bbdabf5
commit 49c443896d
67 changed files with 1832 additions and 874 deletions

View File

@@ -101,19 +101,28 @@ void cWither::KilledBy(TakeDamageInfo & a_TDI)
{
super::KilledBy(a_TDI);
Vector3d Pos = GetPosition();
m_World->ForEachPlayer([=](cPlayer & a_Player)
class cPlayerCallback : public cPlayerListCallback
{
Vector3f m_Pos;
virtual bool Item(cPlayer * a_Player)
{
// TODO 2014-05-21 xdot: Vanilla minecraft uses an AABB check instead of a radius one
double Dist = (a_Player.GetPosition() - Pos).Length();
double Dist = (a_Player->GetPosition() - m_Pos).Length();
if (Dist < 50.0)
{
// If player is close, award achievement
a_Player.AwardAchievement(achKillWither);
a_Player->AwardAchievement(achKillWither);
}
return false;
}
);
public:
cPlayerCallback(const Vector3f & a_Pos) : m_Pos(a_Pos) {}
} PlayerCallback(GetPosition());
m_World->ForEachPlayer(PlayerCallback);
}