summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-12-20 19:10:07 +0100
committermadmaxoft <github@xoft.cz>2013-12-20 19:10:15 +0100
commitf5e6124ee06f2c42f921391c186800adbeb8bc05 (patch)
tree00c5ce40307762bb6466889f22c3a5d888ebd3b7
parentOr not. Fixes #384 (diff)
downloadcuberite-f5e6124ee06f2c42f921391c186800adbeb8bc05.tar
cuberite-f5e6124ee06f2c42f921391c186800adbeb8bc05.tar.gz
cuberite-f5e6124ee06f2c42f921391c186800adbeb8bc05.tar.bz2
cuberite-f5e6124ee06f2c42f921391c186800adbeb8bc05.tar.lz
cuberite-f5e6124ee06f2c42f921391c186800adbeb8bc05.tar.xz
cuberite-f5e6124ee06f2c42f921391c186800adbeb8bc05.tar.zst
cuberite-f5e6124ee06f2c42f921391c186800adbeb8bc05.zip
-rw-r--r--src/Chunk.cpp41
-rw-r--r--src/ChunkSender.cpp4
-rw-r--r--src/ClientHandle.cpp41
-rw-r--r--src/ClientHandle.h9
-rw-r--r--src/Mobs/Zombie.cpp4
-rw-r--r--src/OSSupport/IsThread.cpp4
-rw-r--r--src/Root.cpp72
-rw-r--r--src/World.cpp12
-rw-r--r--src/World.h2
9 files changed, 92 insertions, 97 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index 3ae4e36be..3c44b91d0 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -63,26 +63,27 @@ cChunk::cChunk(
int a_ChunkX, int a_ChunkY, int a_ChunkZ,
cChunkMap * a_ChunkMap, cWorld * a_World,
cChunk * a_NeighborXM, cChunk * a_NeighborXP, cChunk * a_NeighborZM, cChunk * a_NeighborZP
-)
- : m_PosX( a_ChunkX )
- , m_PosY( a_ChunkY )
- , m_PosZ( a_ChunkZ )
- , m_BlockTickX( 0 )
- , m_BlockTickY( 0 )
- , m_BlockTickZ( 0 )
- , m_World( a_World )
- , m_ChunkMap(a_ChunkMap)
- , m_IsValid(false)
- , m_IsLightValid(false)
- , m_IsDirty(false)
- , m_IsSaving(false)
- , m_StayCount(0)
- , m_NeighborXM(a_NeighborXM)
- , m_NeighborXP(a_NeighborXP)
- , m_NeighborZM(a_NeighborZM)
- , m_NeighborZP(a_NeighborZP)
- , m_WaterSimulatorData(a_World->GetWaterSimulator()->CreateChunkData())
- , m_LavaSimulatorData (a_World->GetLavaSimulator ()->CreateChunkData())
+) :
+ m_IsValid(false),
+ m_IsLightValid(false),
+ m_IsDirty(false),
+ m_IsSaving(false),
+ m_HasLoadFailed(false),
+ m_StayCount(0),
+ m_PosX(a_ChunkX),
+ m_PosY(a_ChunkY),
+ m_PosZ(a_ChunkZ),
+ m_World(a_World),
+ m_ChunkMap(a_ChunkMap),
+ m_BlockTickX(0),
+ m_BlockTickY(0),
+ m_BlockTickZ(0),
+ m_NeighborXM(a_NeighborXM),
+ m_NeighborXP(a_NeighborXP),
+ m_NeighborZM(a_NeighborZM),
+ m_NeighborZP(a_NeighborZP),
+ m_WaterSimulatorData(a_World->GetWaterSimulator()->CreateChunkData()),
+ m_LavaSimulatorData (a_World->GetLavaSimulator ()->CreateChunkData())
{
if (a_NeighborXM != NULL)
{
diff --git a/src/ChunkSender.cpp b/src/ChunkSender.cpp
index 7d1ef73a0..fe3ee9b42 100644
--- a/src/ChunkSender.cpp
+++ b/src/ChunkSender.cpp
@@ -35,8 +35,8 @@ void cNotifyChunkSender::Call(int a_ChunkX, int a_ChunkZ)
cChunkSender::cChunkSender(void) :
super("ChunkSender"),
m_World(NULL),
- m_Notify(NULL),
- m_RemoveCount(0)
+ m_RemoveCount(0),
+ m_Notify(NULL)
{
m_Notify.SetChunkSender(this);
}
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 837f88e61..65b376d38 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -77,27 +77,26 @@ int cClientHandle::s_ClientCount = 0;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cClientHandle:
-cClientHandle::cClientHandle(const cSocket * a_Socket, int a_ViewDistance)
- : m_ViewDistance(a_ViewDistance)
- , m_IPString(a_Socket->GetIPString())
- , m_OutgoingData(64 KiB)
- , m_Player(NULL)
- , m_HasSentDC(false)
- , m_TimeSinceLastPacket(0)
- , m_bKeepThreadGoing(true)
- , m_Ping(1000)
- , m_PingID(1)
- , m_TicksSinceDestruction(0)
- , m_State(csConnected)
- , m_LastStreamedChunkX(0x7fffffff) // bogus chunk coords to force streaming upon login
- , m_LastStreamedChunkZ(0x7fffffff)
- , m_ShouldCheckDownloaded(false)
- , m_UniqueID(0)
- , m_BlockDigAnimStage(-1)
- , m_HasStartedDigging(false)
- , m_CurrentExplosionTick(0)
- , m_RunningSumExplosions(0)
- , m_HasSentPlayerChunk(false)
+cClientHandle::cClientHandle(const cSocket * a_Socket, int a_ViewDistance) :
+ m_ViewDistance(a_ViewDistance),
+ m_IPString(a_Socket->GetIPString()),
+ m_OutgoingData(64 KiB),
+ m_Player(NULL),
+ m_HasSentDC(false),
+ m_LastStreamedChunkX(0x7fffffff), // bogus chunk coords to force streaming upon login
+ m_LastStreamedChunkZ(0x7fffffff),
+ m_TimeSinceLastPacket(0),
+ m_Ping(1000),
+ m_PingID(1),
+ m_BlockDigAnimStage(-1),
+ m_HasStartedDigging(false),
+ m_TicksSinceDestruction(0),
+ m_State(csConnected),
+ m_ShouldCheckDownloaded(false),
+ m_CurrentExplosionTick(0),
+ m_RunningSumExplosions(0),
+ m_UniqueID(0),
+ m_HasSentPlayerChunk(false)
{
m_Protocol = new cProtocolRecognizer(this);
diff --git a/src/ClientHandle.h b/src/ClientHandle.h
index b426153b9..6f82d5d46 100644
--- a/src/ClientHandle.h
+++ b/src/ClientHandle.h
@@ -42,12 +42,6 @@ class cClientHandle : // tolua_export
public cSocketThreads::cCallback
{ // tolua_export
public:
- enum ENUM_PRIORITY
- {
- E_PRIORITY_LOW,
- E_PRIORITY_NORMAL
- };
-
static const int MAXBLOCKCHANGEINTERACTIONS = 20; // 5 didn't help, 10 still doesn't work in Creative, 20 seems to have done the trick
#if defined(ANDROID_NDK)
@@ -219,7 +213,6 @@ private:
AString m_IPString;
- int m_ProtocolVersion;
AString m_Username;
AString m_Password;
@@ -291,8 +284,6 @@ private:
/// m_State needs to be locked in the Destroy() function so that the destruction code doesn't run twice on two different threads
cCriticalSection m_CSDestroyingState;
- bool m_bKeepThreadGoing;
-
/// If set to true during csDownloadingWorld, the tick thread calls CheckIfWorldDownloaded()
bool m_ShouldCheckDownloaded;
diff --git a/src/Mobs/Zombie.cpp b/src/Mobs/Zombie.cpp
index 29563a755..a046fcc92 100644
--- a/src/Mobs/Zombie.cpp
+++ b/src/Mobs/Zombie.cpp
@@ -11,8 +11,8 @@
cZombie::cZombie(bool a_IsVillagerZombie) :
super("Zombie", mtZombie, "mob.zombie.hurt", "mob.zombie.death", 0.6, 1.8),
- m_IsConverting(false),
- m_IsVillagerZombie(a_IsVillagerZombie)
+ m_IsVillagerZombie(a_IsVillagerZombie),
+ m_IsConverting(false)
{
SetBurnsInDaylight(true);
}
diff --git a/src/OSSupport/IsThread.cpp b/src/OSSupport/IsThread.cpp
index 7eb114a82..36205bcf1 100644
--- a/src/OSSupport/IsThread.cpp
+++ b/src/OSSupport/IsThread.cpp
@@ -51,8 +51,8 @@ static void SetThreadName( DWORD dwThreadID, LPCSTR szThreadName)
// cIsThread:
cIsThread::cIsThread(const AString & iThreadName) :
- m_ThreadName(iThreadName),
m_ShouldTerminate(false),
+ m_ThreadName(iThreadName),
m_Handle(NULL_HANDLE)
{
}
@@ -144,7 +144,7 @@ bool cIsThread::Wait(void)
return (res == WAIT_OBJECT_0);
#else // _WIN32
int res = pthread_join(m_Handle, NULL);
- m_Handle = NULL;
+ m_Handle = NULL_HANDLE;
#ifdef LOGD // ProtoProxy doesn't have LOGD
LOGD("Thread %s finished", m_ThreadName.c_str());
diff --git a/src/Root.cpp b/src/Root.cpp
index fb1e96426..fffd8fb47 100644
--- a/src/Root.cpp
+++ b/src/Root.cpp
@@ -39,19 +39,20 @@ cRoot* cRoot::s_Root = NULL;
-cRoot::cRoot()
- : m_Server( NULL )
- , m_MonsterConfig( NULL )
- , m_GroupManager( NULL )
- , m_CraftingRecipes(NULL)
- , m_FurnaceRecipe( NULL )
- , m_WebAdmin( NULL )
- , m_PluginManager( NULL )
- , m_Log( NULL )
- , m_bStop( false )
- , m_bRestart( false )
- , m_InputThread( NULL )
- , m_pDefaultWorld( NULL )
+cRoot::cRoot(void) :
+ m_PrimaryServerVersion(cProtocolRecognizer::PROTO_VERSION_LATEST),
+ m_pDefaultWorld(NULL),
+ m_InputThread(NULL),
+ m_Server(NULL),
+ m_MonsterConfig(NULL),
+ m_GroupManager(NULL),
+ m_CraftingRecipes(NULL),
+ m_FurnaceRecipe(NULL),
+ m_WebAdmin(NULL),
+ m_PluginManager(NULL),
+ m_Log(NULL),
+ m_bStop(false),
+ m_bRestart(false)
{
s_Root = this;
}
@@ -552,22 +553,25 @@ bool cRoot::FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallbac
{
class cCallback : public cPlayerListCallback
{
- unsigned int BestRating;
- unsigned int NameLength;
- const AString PlayerName;
+ unsigned m_BestRating;
+ unsigned m_NameLength;
+ const AString m_PlayerName;
cPlayerListCallback & m_Callback;
virtual bool Item (cPlayer * a_pPlayer)
{
- unsigned int Rating = RateCompareString (PlayerName, a_pPlayer->GetName());
- if (Rating > 0 && Rating >= BestRating)
+ unsigned int Rating = RateCompareString (m_PlayerName, a_pPlayer->GetName());
+ if ((Rating > 0) && (Rating >= m_BestRating))
{
- BestMatch = a_pPlayer;
- if( Rating > BestRating ) NumMatches = 0;
- BestRating = Rating;
- ++NumMatches;
+ m_BestMatch = a_pPlayer;
+ if (Rating > m_BestRating)
+ {
+ m_NumMatches = 0;
+ }
+ m_BestRating = Rating;
+ ++m_NumMatches;
}
- if (Rating == NameLength) // Perfect match
+ if (Rating == m_NameLength) // Perfect match
{
return true;
}
@@ -575,23 +579,23 @@ bool cRoot::FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallbac
}
public:
- cCallback (const AString & a_PlayerName, cPlayerListCallback & a_Callback)
- : m_Callback( a_Callback )
- , BestMatch( NULL )
- , BestRating( 0 )
- , NumMatches( 0 )
- , NameLength( a_PlayerName.length() )
- , PlayerName( a_PlayerName )
+ cCallback (const AString & a_PlayerName, cPlayerListCallback & a_Callback) :
+ m_Callback(a_Callback),
+ m_BestRating(0),
+ m_NameLength(a_PlayerName.length()),
+ m_PlayerName(a_PlayerName),
+ m_BestMatch(NULL),
+ m_NumMatches(0)
{}
- cPlayer * BestMatch;
- unsigned int NumMatches;
+ cPlayer * m_BestMatch;
+ unsigned m_NumMatches;
} Callback (a_PlayerName, a_Callback);
ForEachPlayer( Callback );
- if (Callback.NumMatches == 1)
+ if (Callback.m_NumMatches == 1)
{
- return a_Callback.Item (Callback.BestMatch);
+ return a_Callback.Item(Callback.m_BestMatch);
}
return false;
}
diff --git a/src/World.cpp b/src/World.cpp
index f81456334..976af671d 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -229,16 +229,16 @@ cWorld::cWorld(const AString & a_WorldName) :
m_WorldName(a_WorldName),
m_IniFileName(m_WorldName + "/world.ini"),
m_StorageSchema("Default"),
+ m_IsSpawnExplicitlySet(false),
m_WorldAgeSecs(0),
m_TimeOfDaySecs(0),
m_WorldAge(0),
m_TimeOfDay(0),
m_LastTimeUpdate(0),
+ m_SkyDarkness(0),
m_Weather(eWeather_Sunny),
m_WeatherInterval(24000), // Guaranteed 1 day of sunshine at server start :)
- m_TickThread(*this),
- m_SkyDarkness(0),
- m_bSpawnExplicitlySet(false)
+ m_TickThread(*this)
{
LOGD("cWorld::cWorld(\"%s\")", a_WorldName.c_str());
@@ -329,7 +329,7 @@ void cWorld::SetNextBlockTick(int a_BlockX, int a_BlockY, int a_BlockZ)
void cWorld::InitializeSpawn(void)
{
- if (!m_bSpawnExplicitlySet) // Check if spawn position was already explicitly set or not
+ if (!m_IsSpawnExplicitlySet) // Check if spawn position was already explicitly set or not
{
GenerateRandomSpawn(); // Generate random solid-land coordinate and then write it to the world configuration
@@ -487,7 +487,7 @@ void cWorld::Start(void)
// Try to find the "SpawnPosition" key and coord values in the world configuration, set the flag if found
int KeyNum = IniFile.FindKey("SpawnPosition");
- m_bSpawnExplicitlySet =
+ m_IsSpawnExplicitlySet =
(
(KeyNum >= 0) &&
(
@@ -497,7 +497,7 @@ void cWorld::Start(void)
)
);
- if (m_bSpawnExplicitlySet)
+ if (m_IsSpawnExplicitlySet)
{
LOGD("Spawnpoint explicitly set!");
m_SpawnX = IniFile.GetValueF("SpawnPosition", "X", m_SpawnX);
diff --git a/src/World.h b/src/World.h
index 2d9e8b551..1effc5d5d 100644
--- a/src/World.h
+++ b/src/World.h
@@ -647,7 +647,7 @@ private:
/// This random generator is to be used only in the Tick() method, and thus only in the World-Tick-thread (MTRand is not exactly thread-safe)
MTRand m_TickRand;
- bool m_bSpawnExplicitlySet;
+ bool m_IsSpawnExplicitlySet;
double m_SpawnX;
double m_SpawnY;
double m_SpawnZ;