summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
Diffstat (limited to 'src/Entities')
-rw-r--r--src/Entities/Painting.cpp11
-rw-r--r--src/Entities/Painting.h2
-rw-r--r--src/Entities/Player.cpp39
3 files changed, 26 insertions, 26 deletions
diff --git a/src/Entities/Painting.cpp b/src/Entities/Painting.cpp
index b98c1e67a..e217556c7 100644
--- a/src/Entities/Painting.cpp
+++ b/src/Entities/Painting.cpp
@@ -4,6 +4,7 @@
#include "Painting.h"
#include "ClientHandle.h"
#include "Player.h"
+#include "../Chunk.h"
@@ -30,6 +31,16 @@ void cPainting::SpawnOn(cClientHandle & a_Client)
+void cPainting::Tick(float a_Dt, cChunk & a_Chunk)
+{
+ UNUSED(a_Dt);
+ UNUSED(a_Chunk);
+}
+
+
+
+
+
void cPainting::GetDrops(cItems & a_Items, cEntity * a_Killer)
{
if ((a_Killer != NULL) && a_Killer->IsPlayer() && !((cPlayer *)a_Killer)->IsGameModeCreative())
diff --git a/src/Entities/Painting.h b/src/Entities/Painting.h
index 95afbed1e..c1024bd1b 100644
--- a/src/Entities/Painting.h
+++ b/src/Entities/Painting.h
@@ -24,7 +24,7 @@ public:
private:
virtual void SpawnOn(cClientHandle & a_Client) override;
- virtual void Tick(float a_Dt, cChunk & a_Chunk) override {};
+ virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
virtual void GetDrops(cItems & a_Items, cEntity * a_Killer) override;
virtual void KilledBy(cEntity * a_Killer) override
{
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index e0f0b9222..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);
}
@@ -1529,14 +1514,14 @@ void cPlayer::LoadPermissionsFromDisk()
std::string Groups = IniFile.GetValue(m_PlayerName, "Groups", "");
if (!Groups.empty())
{
- AStringVector Split = StringSplit( Groups, "," );
- for( unsigned int i = 0; i < Split.size(); i++ )
+ AStringVector Split = StringSplitAndTrim(Groups, ",");
+ for (AStringVector::const_iterator itr = Split.begin(), end = Split.end(); itr != end; ++itr)
{
- if (!cRoot::Get()->GetGroupManager()->ExistsGroup(Split[i]))
+ if (!cRoot::Get()->GetGroupManager()->ExistsGroup(*itr))
{
- LOGWARNING("The group %s for player %s was not found!", Split[i].c_str(), m_PlayerName.c_str());
+ LOGWARNING("The group %s for player %s was not found!", itr->c_str(), m_PlayerName.c_str());
}
- AddToGroup(Split[i].c_str());
+ AddToGroup(*itr);
}
}
else
@@ -1544,11 +1529,15 @@ void cPlayer::LoadPermissionsFromDisk()
AddToGroup("Default");
}
- m_Color = IniFile.GetValue(m_PlayerName, "Color", "-")[0];
+ AString Color = IniFile.GetValue(m_PlayerName, "Color", "-");
+ if (!Color.empty())
+ {
+ m_Color = Color[0];
+ }
}
else
{
- cRoot::Get()->GetGroupManager()->CheckUsers();
+ cGroupManager::GenerateDefaultUsersIni(IniFile);
AddToGroup("Default");
}
ResolvePermissions();