Added a MaxViewDistance option.
This commit is contained in:
parent
30db6d9852
commit
9c7661f50f
@ -2847,7 +2847,9 @@ void cClientHandle::SetUsername( const AString & a_Username)
|
||||
|
||||
void cClientHandle::SetViewDistance(int a_ViewDistance)
|
||||
{
|
||||
m_ViewDistance = Clamp(a_ViewDistance, MIN_VIEW_DISTANCE, MAX_VIEW_DISTANCE);
|
||||
ASSERT(m_Player->GetWorld() == NULL);
|
||||
|
||||
m_ViewDistance = Clamp(a_ViewDistance, cClientHandle::MIN_VIEW_DISTANCE, m_Player->GetWorld()->GetMaxViewDistance());
|
||||
LOGD("Setted %s's view distance to %i", GetUsername().c_str(), m_ViewDistance);
|
||||
}
|
||||
|
||||
|
@ -283,6 +283,7 @@ cWorld::cWorld(const AString & a_WorldName, eDimension a_Dimension, const AStrin
|
||||
m_bCommandBlocksEnabled(true),
|
||||
m_bUseChatPrefixes(false),
|
||||
m_TNTShrapnelLevel(slNone),
|
||||
m_MaxViewDistance(12),
|
||||
m_Scoreboard(this),
|
||||
m_MapManager(this),
|
||||
m_GeneratorCallbacks(*this),
|
||||
@ -561,6 +562,8 @@ void cWorld::Start(void)
|
||||
m_BroadcastDeathMessages = IniFile.GetValueSetB("Broadcasting", "BroadcastDeathMessages", true);
|
||||
m_BroadcastAchievementMessages = IniFile.GetValueSetB("Broadcasting", "BroadcastAchievementMessages", true);
|
||||
|
||||
SetMaxViewDistance(IniFile.GetValueSetI("SpawnPosition", "MaxViewDistance", 12));
|
||||
|
||||
// Try to find the "SpawnPosition" key and coord values in the world configuration, set the flag if found
|
||||
int KeyNum = IniFile.FindKey("SpawnPosition");
|
||||
m_IsSpawnExplicitlySet =
|
||||
|
10
src/World.h
10
src/World.h
@ -26,6 +26,7 @@
|
||||
#include "MapManager.h"
|
||||
#include "Blocks/WorldInterface.h"
|
||||
#include "Blocks/BroadcastInterface.h"
|
||||
#include "ClientHandle.h"
|
||||
|
||||
|
||||
|
||||
@ -646,6 +647,12 @@ public:
|
||||
eShrapnelLevel GetTNTShrapnelLevel(void) const { return m_TNTShrapnelLevel; }
|
||||
void SetTNTShrapnelLevel(eShrapnelLevel a_Flag) { m_TNTShrapnelLevel = a_Flag; }
|
||||
|
||||
int GetMaxViewDistance(void) const { return m_MaxViewDistance; }
|
||||
void SetMaxViewDistance(int a_MaxViewDistance)
|
||||
{
|
||||
m_MaxViewDistance = Clamp(a_MaxViewDistance, cClientHandle::MIN_VIEW_DISTANCE, cClientHandle::MAX_VIEW_DISTANCE);
|
||||
}
|
||||
|
||||
bool ShouldUseChatPrefixes(void) const { return m_bUseChatPrefixes; }
|
||||
void SetShouldUseChatPrefixes(bool a_Flag) { m_bUseChatPrefixes = a_Flag; }
|
||||
|
||||
@ -961,6 +968,9 @@ private:
|
||||
*/
|
||||
eShrapnelLevel m_TNTShrapnelLevel;
|
||||
|
||||
/** The maximum view distance that a player can have. */
|
||||
int m_MaxViewDistance;
|
||||
|
||||
/** Name of the nether world */
|
||||
AString m_NetherWorldName;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user