summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authorandrew <xdotftw@gmail.com>2014-03-01 11:06:19 +0100
committerandrew <xdotftw@gmail.com>2014-03-01 11:08:40 +0100
commit5c449452871340eeae9df8f34c5e145fda991d92 (patch)
treee55eed91cb7616386dd1fe2c04b4904a0ff5099b /src/Entities
parentForgotten changes to cChunkInterface. (diff)
downloadcuberite-5c449452871340eeae9df8f34c5e145fda991d92.tar
cuberite-5c449452871340eeae9df8f34c5e145fda991d92.tar.gz
cuberite-5c449452871340eeae9df8f34c5e145fda991d92.tar.bz2
cuberite-5c449452871340eeae9df8f34c5e145fda991d92.tar.lz
cuberite-5c449452871340eeae9df8f34c5e145fda991d92.tar.xz
cuberite-5c449452871340eeae9df8f34c5e145fda991d92.tar.zst
cuberite-5c449452871340eeae9df8f34c5e145fda991d92.zip
Diffstat (limited to 'src/Entities')
-rw-r--r--src/Entities/Player.cpp21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index f419ee09c..416bda2ec 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -858,6 +858,8 @@ void cPlayer::KilledBy(cEntity * a_Killer)
else if (a_Killer->IsPlayer())
{
GetWorld()->BroadcastChatDeath(Printf("%s was killed by %s", GetName().c_str(), ((cPlayer *)a_Killer)->GetName().c_str()));
+
+ m_World->GetScoreBoard().AddPlayerScore(((cPlayer *)a_Killer)->GetName(), cObjective::E_TYPE_PLAYER_KILL_COUNT, 1);
}
else
{
@@ -867,24 +869,7 @@ void cPlayer::KilledBy(cEntity * a_Killer)
GetWorld()->BroadcastChatDeath(Printf("%s was killed by a %s", GetName().c_str(), KillerClass.c_str()));
}
- class cIncrementCounterCB
- : public cObjectiveCallback
- {
- AString m_Name;
- public:
- cIncrementCounterCB(const AString & a_Name) : m_Name(a_Name) {}
-
- virtual bool Item(cObjective * a_Objective) override
- {
- a_Objective->AddScore(m_Name, 1);
- return true;
- }
- } IncrementCounter (GetName());
-
- cScoreboard & Scoreboard = m_World->GetScoreBoard();
-
- // Update scoreboard objectives
- Scoreboard.ForEachObjectiveWith(cObjective::E_TYPE_DEATH_COUNT, IncrementCounter);
+ m_World->GetScoreBoard().AddPlayerScore(GetName(), cObjective::E_TYPE_DEATH_COUNT, 1);
}