From 090d8305e4e3c3ee085a897b72f2b4708e183eb8 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 5 Oct 2020 13:09:42 +0100 Subject: Warnings improvements * Turn off global-constructors warning. These are needed to implement cRoot signal handler functionality * Add Clang flags based on version lookup instead of a compile test. The CMake config process is single threaded and slow enough already * Reduced GetStackValue verbosity + Clarify EnchantmentLevel, StayCount, AlwaysTicked, ViewDistance signedness + Give SettingsRepositoryInterface a move constructor to simplify main.cpp code - Remove do {} while (false) construction in redstone handler --- src/Server.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/Server.cpp') diff --git a/src/Server.cpp b/src/Server.cpp index 2730d3511..4cb28d6ea 100644 --- a/src/Server.cpp +++ b/src/Server.cpp @@ -214,16 +214,20 @@ bool cServer::InitServer(cSettingsRepositoryInterface & a_Settings, bool a_Shoul m_ShouldLoadOfflinePlayerData = a_Settings.GetValueSetB("PlayerData", "LoadOfflinePlayerData", false); m_ShouldLoadNamedPlayerData = a_Settings.GetValueSetB("PlayerData", "LoadNamedPlayerData", true); - m_ClientViewDistance = a_Settings.GetValueSetI("Server", "DefaultViewDistance", cClientHandle::DEFAULT_VIEW_DISTANCE); - if (m_ClientViewDistance < cClientHandle::MIN_VIEW_DISTANCE) + const auto ClientViewDistance = a_Settings.GetValueSetI("Server", "DefaultViewDistance", static_cast(cClientHandle::DEFAULT_VIEW_DISTANCE)); + if (ClientViewDistance < static_cast(cClientHandle::MIN_VIEW_DISTANCE)) { m_ClientViewDistance = cClientHandle::MIN_VIEW_DISTANCE; - LOGINFO("Setting default viewdistance to the minimum of %d", m_ClientViewDistance); + LOGINFO("Setting default view distance to the minimum of %d", m_ClientViewDistance); } - if (m_ClientViewDistance > cClientHandle::MAX_VIEW_DISTANCE) + else if (ClientViewDistance > static_cast(cClientHandle::MAX_VIEW_DISTANCE)) { m_ClientViewDistance = cClientHandle::MAX_VIEW_DISTANCE; - LOGINFO("Setting default viewdistance to the maximum of %d", m_ClientViewDistance); + LOGINFO("Setting default view distance to the maximum of %d", m_ClientViewDistance); + } + else + { + m_ClientViewDistance = static_cast(ClientViewDistance); } PrepareKeys(); -- cgit v1.2.3