1
0

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
This commit is contained in:
Tiger Wang
2020-10-05 13:09:42 +01:00
parent 83e18f6d31
commit 090d8305e4
29 changed files with 225 additions and 211 deletions

View File

@@ -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<short>(std::chrono::duration_cast<std::chrono::milliseconds>(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;