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/ClientHandle.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index e955911bf..33a9a8f8c 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -50,12 +50,12 @@ class cClientHandle // tolua_export public: // tolua_export #if defined(ANDROID) - static const int DEFAULT_VIEW_DISTANCE = 4; // The default ViewDistance (used when no value is set in Settings.ini) + static const unsigned DEFAULT_VIEW_DISTANCE = 4; // The default ViewDistance (used when no value is set in Settings.ini) #else - static const int DEFAULT_VIEW_DISTANCE = 10; + static const unsigned DEFAULT_VIEW_DISTANCE = 10; #endif - static const int MAX_VIEW_DISTANCE = 32; - static const int MIN_VIEW_DISTANCE = 1; + static const unsigned MAX_VIEW_DISTANCE = 32; + static const unsigned MIN_VIEW_DISTANCE = 1; /** The percentage how much a block has to be broken. Should be a value between 0.7 (70% broken) and 1 (100% broken) depending on lag. @@ -63,7 +63,7 @@ public: // tolua_export static float FASTBREAK_PERCENTAGE; /** Creates a new client with the specified IP address in its description and the specified initial view distance. */ - cClientHandle(const AString & a_IPString, int a_ViewDistance); + cClientHandle(const AString & a_IPString, unsigned a_ViewDistance); virtual ~cClientHandle() override; @@ -242,13 +242,13 @@ public: // tolua_export inline short GetPing(void) const { return static_cast(std::chrono::duration_cast(m_Ping).count()); } /** Sets the maximal view distance. */ - void SetViewDistance(int a_ViewDistance); + void SetViewDistance(unsigned a_ViewDistance); /** Returns the view distance that the player currently have. */ - int GetViewDistance(void) const { return m_CurrentViewDistance; } + unsigned GetViewDistance(void) const { return m_CurrentViewDistance; } /** Returns the view distance that the player request, not the used view distance. */ - int GetRequestedViewDistance(void) const { return m_RequestedViewDistance; } + unsigned GetRequestedViewDistance(void) const { return m_RequestedViewDistance; } void SetLocale(const AString & a_Locale) { m_Locale = a_Locale; } AString GetLocale(void) const { return m_Locale; } @@ -304,7 +304,7 @@ public: // tolua_export /** Called when the protocol receives a MC|Beacon plugin message, indicating that the player set an effect in the beacon UI. */ - void HandleBeaconSelection(int a_PrimaryEffect, int a_SecondaryEffect); + void HandleBeaconSelection(unsigned a_PrimaryEffect, unsigned a_SecondaryEffect); /** Called when the protocol detects a chat packet. */ void HandleChat(const AString & a_Message); @@ -422,10 +422,10 @@ private: AStringMap m_ForgeMods; /** The actual view distance used, the minimum of client's requested view distance and world's max view distance. */ - int m_CurrentViewDistance; + unsigned m_CurrentViewDistance; /** The requested view distance from the player. It isn't clamped with 1 and the max view distance of the world. */ - int m_RequestedViewDistance; + unsigned m_RequestedViewDistance; AString m_IPString; -- cgit v1.2.3