From 88a64ec40df87f21a89de43fe8bb78f10ee7eeb7 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 7 Feb 2014 18:58:52 +0000 Subject: Improved chat messaging functions * Moved string manipulation into cClientHandle and therefore... + Added configuration option for prefixes. * Cleaned up code. * Updated documentation for API. --- src/World.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index de2002b84..e5c9f4398 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -249,7 +249,9 @@ cWorld::cWorld(const AString & a_WorldName) : m_WeatherInterval(24000), // Guaranteed 1 day of sunshine at server start :) m_GeneratorCallbacks(*this), m_TickThread(*this), - m_Scoreboard(this) + m_Scoreboard(this), + m_bCommandBlocksEnabled(false), + m_bUseChatPrefixes(true) { LOGD("cWorld::cWorld(\"%s\")", a_WorldName.c_str()); @@ -543,9 +545,10 @@ void cWorld::Start(void) m_IsSaplingBonemealable = IniFile.GetValueSetB("Plants", "IsSaplingBonemealable", true); m_IsSugarcaneBonemealable = IniFile.GetValueSetB("Plants", "IsSugarcaneBonemealable", false); m_bEnabledPVP = IniFile.GetValueSetB("PVP", "Enabled", true); - m_IsDeepSnowEnabled = IniFile.GetValueSetB("Physics", "DeepSnow", false); + m_IsDeepSnowEnabled = IniFile.GetValueSetB("Physics", "DeepSnow", true); m_ShouldLavaSpawnFire = IniFile.GetValueSetB("Physics", "ShouldLavaSpawnFire", true); m_bCommandBlocksEnabled = IniFile.GetValueSetB("Mechanics", "CommandBlocksEnabled", false); + m_bUseChatPrefixes = IniFile.GetValueSetB("Mechanics", "UseChatPrefixes", true); m_VillagersShouldHarvestCrops = IniFile.GetValueSetB("Monsters", "VillagersShouldHarvestCrops", true); m_GameMode = (eGameMode)IniFile.GetValueSetI("GameMode", "GameMode", m_GameMode); @@ -1744,7 +1747,7 @@ void cWorld::BroadcastBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cons -void cWorld::BroadcastChat(const AString & a_Message, const cClientHandle * a_Exclude) +void cWorld::LoopPlayersAndBroadcastChat(const AString & a_Message, ChatPrefixCodes a_ChatPrefix, const cClientHandle * a_Exclude) { cCSLock Lock(m_CSPlayers); for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) @@ -1754,7 +1757,7 @@ void cWorld::BroadcastChat(const AString & a_Message, const cClientHandle * a_Ex { continue; } - ch->SendChat(a_Message); + ch->SendChat(a_Message, a_ChatPrefix); } } -- cgit v1.2.3 From 0f36d1c122c78757c9106eb6afa5e3897a87e5fb Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 7 Feb 2014 20:10:12 +0000 Subject: Added sender name to PM if prefixes disabled * Also moved the PVP setting into Mechanics --- src/World.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index e5c9f4398..bb6f5f29a 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -544,10 +544,10 @@ void cWorld::Start(void) m_IsPumpkinBonemealable = IniFile.GetValueSetB("Plants", "IsPumpkinBonemealable", false); m_IsSaplingBonemealable = IniFile.GetValueSetB("Plants", "IsSaplingBonemealable", true); m_IsSugarcaneBonemealable = IniFile.GetValueSetB("Plants", "IsSugarcaneBonemealable", false); - m_bEnabledPVP = IniFile.GetValueSetB("PVP", "Enabled", true); m_IsDeepSnowEnabled = IniFile.GetValueSetB("Physics", "DeepSnow", true); m_ShouldLavaSpawnFire = IniFile.GetValueSetB("Physics", "ShouldLavaSpawnFire", true); m_bCommandBlocksEnabled = IniFile.GetValueSetB("Mechanics", "CommandBlocksEnabled", false); + m_bEnabledPVP = IniFile.GetValueSetB("Mechanics", "PVPEnabled", true); m_bUseChatPrefixes = IniFile.GetValueSetB("Mechanics", "UseChatPrefixes", true); m_VillagersShouldHarvestCrops = IniFile.GetValueSetB("Monsters", "VillagersShouldHarvestCrops", true); -- cgit v1.2.3 From fadf3c037ba02e18264dabbad5f1016fa53a995d Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 7 Feb 2014 20:11:56 +0000 Subject: Moved Gamemode setting into General root tag --- src/World.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index bb6f5f29a..ab77fa545 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -551,7 +551,7 @@ void cWorld::Start(void) m_bUseChatPrefixes = IniFile.GetValueSetB("Mechanics", "UseChatPrefixes", true); m_VillagersShouldHarvestCrops = IniFile.GetValueSetB("Monsters", "VillagersShouldHarvestCrops", true); - m_GameMode = (eGameMode)IniFile.GetValueSetI("GameMode", "GameMode", m_GameMode); + m_GameMode = (eGameMode)IniFile.GetValueSetI("General", "Gamemode", m_GameMode); // Load allowed mobs: const char * DefaultMonsters = ""; -- cgit v1.2.3 From c68bdaf34beee368100e6697fc3d87a711dba6b7 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 9 Feb 2014 00:57:22 +0000 Subject: Fixed compile and some warnings in MSVS --- src/World.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index d2523b0a5..662a9a4b8 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -251,10 +251,8 @@ cWorld::cWorld(const AString & a_WorldName) : m_Scoreboard(this), m_GeneratorCallbacks(*this), m_TickThread(*this), - m_Scoreboard(this), m_bCommandBlocksEnabled(false), m_bUseChatPrefixes(true) - m_TickThread(*this) { LOGD("cWorld::cWorld(\"%s\")", a_WorldName.c_str()); -- cgit v1.2.3