summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-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());
+ }
}