From ae15c2f78e85c8a6ee192d48d8befc5ee4b478b6 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Mon, 17 Nov 2014 12:34:14 +0100 Subject: Fixed a wrong assert in cClientHandle::SetViewDistance(). --- src/ClientHandle.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/ClientHandle.cpp') 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()); + } } -- cgit v1.2.3