summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-12-23 23:39:53 +0100
committerTiger Wang <ziwei.tiger@outlook.com>2020-12-26 17:58:53 +0100
commitd9a7c51d4da21976ce3a8d41cde23fc9a4b6eb9d (patch)
treec2763ddfe026c2121864d6ca5eae640f01133f7e /src/ClientHandle.cpp
parentReplace custom ChunkCoordinate with cChunkCoords (diff)
downloadcuberite-d9a7c51d4da21976ce3a8d41cde23fc9a4b6eb9d.tar
cuberite-d9a7c51d4da21976ce3a8d41cde23fc9a4b6eb9d.tar.gz
cuberite-d9a7c51d4da21976ce3a8d41cde23fc9a4b6eb9d.tar.bz2
cuberite-d9a7c51d4da21976ce3a8d41cde23fc9a4b6eb9d.tar.lz
cuberite-d9a7c51d4da21976ce3a8d41cde23fc9a4b6eb9d.tar.xz
cuberite-d9a7c51d4da21976ce3a8d41cde23fc9a4b6eb9d.tar.zst
cuberite-d9a7c51d4da21976ce3a8d41cde23fc9a4b6eb9d.zip
Diffstat (limited to 'src/ClientHandle.cpp')
-rw-r--r--src/ClientHandle.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index cee35203e..f9b4fd327 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -67,7 +67,7 @@ float cClientHandle::FASTBREAK_PERCENTAGE;
////////////////////////////////////////////////////////////////////////////////
// cClientHandle:
-cClientHandle::cClientHandle(const AString & a_IPString, unsigned a_ViewDistance) :
+cClientHandle::cClientHandle(const AString & a_IPString, int a_ViewDistance) :
m_LastSentDimension(dimNotSet),
m_ForgeHandshake(this),
m_CurrentViewDistance(a_ViewDistance),
@@ -473,7 +473,7 @@ bool cClientHandle::StreamNextChunk(void)
cCSLock Lock(m_CSChunkLists);
// High priority: Load the chunks that are in the view-direction of the player (with a radius of 3)
- for (unsigned Range = 0; Range < m_CurrentViewDistance; Range++)
+ for (int Range = 0; Range < m_CurrentViewDistance; Range++)
{
Vector3d Vector = Position + LookVector * cChunkDef::Width * Range;
@@ -513,10 +513,8 @@ bool cClientHandle::StreamNextChunk(void)
}
// Low priority: Add all chunks that are in range. (From the center out to the edge)
- for (unsigned Range = 0; Range <= m_CurrentViewDistance; ++Range) // cycle through (square) distance, from nearest to furthest
+ for (int d = 0; d <= m_CurrentViewDistance; ++d) // cycle through (square) distance, from nearest to furthest
{
- const int d = static_cast<int>(Range);
-
// For each distance add chunks in a hollow square centered around current position:
cChunkCoordsList CurcleChunks;
for (int i = -d; i <= d; ++i)
@@ -3271,7 +3269,7 @@ void cClientHandle::SetUsername(const AString & a_Username)
-void cClientHandle::SetViewDistance(unsigned a_ViewDistance)
+void cClientHandle::SetViewDistance(int a_ViewDistance)
{
m_RequestedViewDistance = a_ViewDistance;
LOGD("%s is requesting ViewDistance of %d!", GetUsername().c_str(), m_RequestedViewDistance);