summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-11-17 12:34:14 +0100
committerMattes D <github@xoft.cz>2014-11-17 12:34:14 +0100
commitae15c2f78e85c8a6ee192d48d8befc5ee4b478b6 (patch)
tree581c67e8fae7f969952d139cc584c2c74f245733 /src
parentBiomalNoise3D: Added more biomes. (diff)
downloadcuberite-ae15c2f78e85c8a6ee192d48d8befc5ee4b478b6.tar
cuberite-ae15c2f78e85c8a6ee192d48d8befc5ee4b478b6.tar.gz
cuberite-ae15c2f78e85c8a6ee192d48d8befc5ee4b478b6.tar.bz2
cuberite-ae15c2f78e85c8a6ee192d48d8befc5ee4b478b6.tar.lz
cuberite-ae15c2f78e85c8a6ee192d48d8befc5ee4b478b6.tar.xz
cuberite-ae15c2f78e85c8a6ee192d48d8befc5ee4b478b6.tar.zst
cuberite-ae15c2f78e85c8a6ee192d48d8befc5ee4b478b6.zip
Diffstat (limited to 'src')
-rw-r--r--src/ClientHandle.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 0b9d84bf7..8b4d6d0cc 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -2848,11 +2848,15 @@ void cClientHandle::SetUsername( const AString & a_Username)
void cClientHandle::SetViewDistance(int a_ViewDistance)
{
- ASSERT(m_Player->GetWorld() == NULL);
-
m_RequestedViewDistance = a_ViewDistance;
- m_CurrentViewDistance = Clamp(a_ViewDistance, cClientHandle::MIN_VIEW_DISTANCE, m_Player->GetWorld()->GetMaxViewDistance());
- LOGD("Setted view distance from %s to %d!", GetUsername().c_str(), m_CurrentViewDistance);
+ LOGD("%s is requesting ViewDistance of %d!", GetUsername().c_str(), m_RequestedViewDistance);
+
+ // Set the current view distance based on the requested VD and world max VD:
+ cWorld * world = m_Player->GetWorld();
+ if (world != nullptr)
+ {
+ m_CurrentViewDistance = Clamp(a_ViewDistance, cClientHandle::MIN_VIEW_DISTANCE, world->GetMaxViewDistance());
+ }
}