summaryrefslogtreecommitdiffstats
path: root/src/Entities/Player.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-03-01 15:20:30 +0100
committerMattes D <github@xoft.cz>2014-03-01 15:20:30 +0100
commit80b0496bff3d8b8c65fd79a183a665d7cad396c8 (patch)
tree535474f8e8eb226546a4ad921ab76c7ca340b226 /src/Entities/Player.cpp
parentMerge pull request #737 from mc-server/InfoDump_SourceLocation (diff)
parentAPIDump: Fixed cScoreboard enums (diff)
downloadcuberite-80b0496bff3d8b8c65fd79a183a665d7cad396c8.tar
cuberite-80b0496bff3d8b8c65fd79a183a665d7cad396c8.tar.gz
cuberite-80b0496bff3d8b8c65fd79a183a665d7cad396c8.tar.bz2
cuberite-80b0496bff3d8b8c65fd79a183a665d7cad396c8.tar.lz
cuberite-80b0496bff3d8b8c65fd79a183a665d7cad396c8.tar.xz
cuberite-80b0496bff3d8b8c65fd79a183a665d7cad396c8.tar.zst
cuberite-80b0496bff3d8b8c65fd79a183a665d7cad396c8.zip
Diffstat (limited to 'src/Entities/Player.cpp')
-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..8f94f1feb 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::otPlayerKillCount, 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::otDeathCount, 1);
}