summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-10-05 14:09:42 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-12-18 22:03:40 +0100
commit090d8305e4e3c3ee085a897b72f2b4708e183eb8 (patch)
treee703cc7fcb7f16c85f16b094d5df0bd0a8d698e8 /src/World.cpp
parentHorsies: don't always broadcast metadata (diff)
downloadcuberite-090d8305e4e3c3ee085a897b72f2b4708e183eb8.tar
cuberite-090d8305e4e3c3ee085a897b72f2b4708e183eb8.tar.gz
cuberite-090d8305e4e3c3ee085a897b72f2b4708e183eb8.tar.bz2
cuberite-090d8305e4e3c3ee085a897b72f2b4708e183eb8.tar.lz
cuberite-090d8305e4e3c3ee085a897b72f2b4708e183eb8.tar.xz
cuberite-090d8305e4e3c3ee085a897b72f2b4708e183eb8.tar.zst
cuberite-090d8305e4e3c3ee085a897b72f2b4708e183eb8.zip
Diffstat (limited to 'src/World.cpp')
-rw-r--r--src/World.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/World.cpp b/src/World.cpp
index bd1a52a7d..ba2f159a0 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -264,7 +264,8 @@ cWorld::cWorld(
m_BroadcastDeathMessages = IniFile.GetValueSetB("Broadcasting", "BroadcastDeathMessages", true);
m_BroadcastAchievementMessages = IniFile.GetValueSetB("Broadcasting", "BroadcastAchievementMessages", true);
- SetMaxViewDistance(IniFile.GetValueSetI("SpawnPosition", "MaxViewDistance", 12));
+ const auto ClientViewDistance = IniFile.GetValueSetI("SpawnPosition", "MaxViewDistance", static_cast<int>(cClientHandle::DEFAULT_VIEW_DISTANCE));
+ m_MaxViewDistance = static_cast<unsigned>(std::clamp(ClientViewDistance, static_cast<int>(cClientHandle::MIN_VIEW_DISTANCE), static_cast<int>(cClientHandle::MAX_VIEW_DISTANCE)));
// Try to find the "SpawnPosition" key and coord values in the world configuration, set the flag if found
int KeyNum = IniFile.FindKey("SpawnPosition");
@@ -1841,7 +1842,7 @@ bool cWorld::SetAreaBiome(const cCuboid & a_Area, EMCSBiome a_Biome)
-void cWorld::SetMaxViewDistance(int a_MaxViewDistance)
+void cWorld::SetMaxViewDistance(unsigned a_MaxViewDistance)
{
m_MaxViewDistance = Clamp(a_MaxViewDistance, cClientHandle::MIN_VIEW_DISTANCE, cClientHandle::MAX_VIEW_DISTANCE);
}