1
0

Fixed the rest of constructor reorders.

This commit is contained in:
madmaxoft 2013-12-20 19:10:07 +01:00
parent 1f03fc4bf9
commit f5e6124ee0
9 changed files with 92 additions and 97 deletions

View File

@ -63,26 +63,27 @@ cChunk::cChunk(
int a_ChunkX, int a_ChunkY, int a_ChunkZ, int a_ChunkX, int a_ChunkY, int a_ChunkZ,
cChunkMap * a_ChunkMap, cWorld * a_World, cChunkMap * a_ChunkMap, cWorld * a_World,
cChunk * a_NeighborXM, cChunk * a_NeighborXP, cChunk * a_NeighborZM, cChunk * a_NeighborZP cChunk * a_NeighborXM, cChunk * a_NeighborXP, cChunk * a_NeighborZM, cChunk * a_NeighborZP
) ) :
: m_PosX( a_ChunkX ) m_IsValid(false),
, m_PosY( a_ChunkY ) m_IsLightValid(false),
, m_PosZ( a_ChunkZ ) m_IsDirty(false),
, m_BlockTickX( 0 ) m_IsSaving(false),
, m_BlockTickY( 0 ) m_HasLoadFailed(false),
, m_BlockTickZ( 0 ) m_StayCount(0),
, m_World( a_World ) m_PosX(a_ChunkX),
, m_ChunkMap(a_ChunkMap) m_PosY(a_ChunkY),
, m_IsValid(false) m_PosZ(a_ChunkZ),
, m_IsLightValid(false) m_World(a_World),
, m_IsDirty(false) m_ChunkMap(a_ChunkMap),
, m_IsSaving(false) m_BlockTickX(0),
, m_StayCount(0) m_BlockTickY(0),
, m_NeighborXM(a_NeighborXM) m_BlockTickZ(0),
, m_NeighborXP(a_NeighborXP) m_NeighborXM(a_NeighborXM),
, m_NeighborZM(a_NeighborZM) m_NeighborXP(a_NeighborXP),
, m_NeighborZP(a_NeighborZP) m_NeighborZM(a_NeighborZM),
, m_WaterSimulatorData(a_World->GetWaterSimulator()->CreateChunkData()) m_NeighborZP(a_NeighborZP),
, m_LavaSimulatorData (a_World->GetLavaSimulator ()->CreateChunkData()) m_WaterSimulatorData(a_World->GetWaterSimulator()->CreateChunkData()),
m_LavaSimulatorData (a_World->GetLavaSimulator ()->CreateChunkData())
{ {
if (a_NeighborXM != NULL) if (a_NeighborXM != NULL)
{ {

View File

@ -35,8 +35,8 @@ void cNotifyChunkSender::Call(int a_ChunkX, int a_ChunkZ)
cChunkSender::cChunkSender(void) : cChunkSender::cChunkSender(void) :
super("ChunkSender"), super("ChunkSender"),
m_World(NULL), m_World(NULL),
m_Notify(NULL), m_RemoveCount(0),
m_RemoveCount(0) m_Notify(NULL)
{ {
m_Notify.SetChunkSender(this); m_Notify.SetChunkSender(this);
} }

View File

@ -77,27 +77,26 @@ int cClientHandle::s_ClientCount = 0;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cClientHandle: // cClientHandle:
cClientHandle::cClientHandle(const cSocket * a_Socket, int a_ViewDistance) cClientHandle::cClientHandle(const cSocket * a_Socket, int a_ViewDistance) :
: m_ViewDistance(a_ViewDistance) m_ViewDistance(a_ViewDistance),
, m_IPString(a_Socket->GetIPString()) m_IPString(a_Socket->GetIPString()),
, m_OutgoingData(64 KiB) m_OutgoingData(64 KiB),
, m_Player(NULL) m_Player(NULL),
, m_HasSentDC(false) m_HasSentDC(false),
, m_TimeSinceLastPacket(0) m_LastStreamedChunkX(0x7fffffff), // bogus chunk coords to force streaming upon login
, m_bKeepThreadGoing(true) m_LastStreamedChunkZ(0x7fffffff),
, m_Ping(1000) m_TimeSinceLastPacket(0),
, m_PingID(1) m_Ping(1000),
, m_TicksSinceDestruction(0) m_PingID(1),
, m_State(csConnected) m_BlockDigAnimStage(-1),
, m_LastStreamedChunkX(0x7fffffff) // bogus chunk coords to force streaming upon login m_HasStartedDigging(false),
, m_LastStreamedChunkZ(0x7fffffff) m_TicksSinceDestruction(0),
, m_ShouldCheckDownloaded(false) m_State(csConnected),
, m_UniqueID(0) m_ShouldCheckDownloaded(false),
, m_BlockDigAnimStage(-1) m_CurrentExplosionTick(0),
, m_HasStartedDigging(false) m_RunningSumExplosions(0),
, m_CurrentExplosionTick(0) m_UniqueID(0),
, m_RunningSumExplosions(0) m_HasSentPlayerChunk(false)
, m_HasSentPlayerChunk(false)
{ {
m_Protocol = new cProtocolRecognizer(this); m_Protocol = new cProtocolRecognizer(this);

View File

@ -42,12 +42,6 @@ class cClientHandle : // tolua_export
public cSocketThreads::cCallback public cSocketThreads::cCallback
{ // tolua_export { // tolua_export
public: 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 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) #if defined(ANDROID_NDK)
@ -219,7 +213,6 @@ private:
AString m_IPString; AString m_IPString;
int m_ProtocolVersion;
AString m_Username; AString m_Username;
AString m_Password; 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 /// 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; cCriticalSection m_CSDestroyingState;
bool m_bKeepThreadGoing;
/// If set to true during csDownloadingWorld, the tick thread calls CheckIfWorldDownloaded() /// If set to true during csDownloadingWorld, the tick thread calls CheckIfWorldDownloaded()
bool m_ShouldCheckDownloaded; bool m_ShouldCheckDownloaded;

View File

@ -11,8 +11,8 @@
cZombie::cZombie(bool a_IsVillagerZombie) : cZombie::cZombie(bool a_IsVillagerZombie) :
super("Zombie", mtZombie, "mob.zombie.hurt", "mob.zombie.death", 0.6, 1.8), 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); SetBurnsInDaylight(true);
} }

View File

@ -51,8 +51,8 @@ static void SetThreadName( DWORD dwThreadID, LPCSTR szThreadName)
// cIsThread: // cIsThread:
cIsThread::cIsThread(const AString & iThreadName) : cIsThread::cIsThread(const AString & iThreadName) :
m_ThreadName(iThreadName),
m_ShouldTerminate(false), m_ShouldTerminate(false),
m_ThreadName(iThreadName),
m_Handle(NULL_HANDLE) m_Handle(NULL_HANDLE)
{ {
} }
@ -144,7 +144,7 @@ bool cIsThread::Wait(void)
return (res == WAIT_OBJECT_0); return (res == WAIT_OBJECT_0);
#else // _WIN32 #else // _WIN32
int res = pthread_join(m_Handle, NULL); int res = pthread_join(m_Handle, NULL);
m_Handle = NULL; m_Handle = NULL_HANDLE;
#ifdef LOGD // ProtoProxy doesn't have LOGD #ifdef LOGD // ProtoProxy doesn't have LOGD
LOGD("Thread %s finished", m_ThreadName.c_str()); LOGD("Thread %s finished", m_ThreadName.c_str());

View File

@ -39,19 +39,20 @@ cRoot* cRoot::s_Root = NULL;
cRoot::cRoot() cRoot::cRoot(void) :
: m_Server( NULL ) m_PrimaryServerVersion(cProtocolRecognizer::PROTO_VERSION_LATEST),
, m_MonsterConfig( NULL ) m_pDefaultWorld(NULL),
, m_GroupManager( NULL ) m_InputThread(NULL),
, m_CraftingRecipes(NULL) m_Server(NULL),
, m_FurnaceRecipe( NULL ) m_MonsterConfig(NULL),
, m_WebAdmin( NULL ) m_GroupManager(NULL),
, m_PluginManager( NULL ) m_CraftingRecipes(NULL),
, m_Log( NULL ) m_FurnaceRecipe(NULL),
, m_bStop( false ) m_WebAdmin(NULL),
, m_bRestart( false ) m_PluginManager(NULL),
, m_InputThread( NULL ) m_Log(NULL),
, m_pDefaultWorld( NULL ) m_bStop(false),
m_bRestart(false)
{ {
s_Root = this; s_Root = this;
} }
@ -552,22 +553,25 @@ bool cRoot::FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallbac
{ {
class cCallback : public cPlayerListCallback class cCallback : public cPlayerListCallback
{ {
unsigned int BestRating; unsigned m_BestRating;
unsigned int NameLength; unsigned m_NameLength;
const AString PlayerName; const AString m_PlayerName;
cPlayerListCallback & m_Callback; cPlayerListCallback & m_Callback;
virtual bool Item (cPlayer * a_pPlayer) virtual bool Item (cPlayer * a_pPlayer)
{ {
unsigned int Rating = RateCompareString (PlayerName, a_pPlayer->GetName()); unsigned int Rating = RateCompareString (m_PlayerName, a_pPlayer->GetName());
if (Rating > 0 && Rating >= BestRating) if ((Rating > 0) && (Rating >= m_BestRating))
{ {
BestMatch = a_pPlayer; m_BestMatch = a_pPlayer;
if( Rating > BestRating ) NumMatches = 0; if (Rating > m_BestRating)
BestRating = Rating; {
++NumMatches; m_NumMatches = 0;
}
m_BestRating = Rating;
++m_NumMatches;
} }
if (Rating == NameLength) // Perfect match if (Rating == m_NameLength) // Perfect match
{ {
return true; return true;
} }
@ -575,23 +579,23 @@ bool cRoot::FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallbac
} }
public: public:
cCallback (const AString & a_PlayerName, cPlayerListCallback & a_Callback) cCallback (const AString & a_PlayerName, cPlayerListCallback & a_Callback) :
: m_Callback( a_Callback ) m_Callback(a_Callback),
, BestMatch( NULL ) m_BestRating(0),
, BestRating( 0 ) m_NameLength(a_PlayerName.length()),
, NumMatches( 0 ) m_PlayerName(a_PlayerName),
, NameLength( a_PlayerName.length() ) m_BestMatch(NULL),
, PlayerName( a_PlayerName ) m_NumMatches(0)
{} {}
cPlayer * BestMatch; cPlayer * m_BestMatch;
unsigned int NumMatches; unsigned m_NumMatches;
} Callback (a_PlayerName, a_Callback); } Callback (a_PlayerName, a_Callback);
ForEachPlayer( 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; return false;
} }

View File

@ -229,16 +229,16 @@ cWorld::cWorld(const AString & a_WorldName) :
m_WorldName(a_WorldName), m_WorldName(a_WorldName),
m_IniFileName(m_WorldName + "/world.ini"), m_IniFileName(m_WorldName + "/world.ini"),
m_StorageSchema("Default"), m_StorageSchema("Default"),
m_IsSpawnExplicitlySet(false),
m_WorldAgeSecs(0), m_WorldAgeSecs(0),
m_TimeOfDaySecs(0), m_TimeOfDaySecs(0),
m_WorldAge(0), m_WorldAge(0),
m_TimeOfDay(0), m_TimeOfDay(0),
m_LastTimeUpdate(0), m_LastTimeUpdate(0),
m_SkyDarkness(0),
m_Weather(eWeather_Sunny), m_Weather(eWeather_Sunny),
m_WeatherInterval(24000), // Guaranteed 1 day of sunshine at server start :) m_WeatherInterval(24000), // Guaranteed 1 day of sunshine at server start :)
m_TickThread(*this), m_TickThread(*this)
m_SkyDarkness(0),
m_bSpawnExplicitlySet(false)
{ {
LOGD("cWorld::cWorld(\"%s\")", a_WorldName.c_str()); 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) 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 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 // Try to find the "SpawnPosition" key and coord values in the world configuration, set the flag if found
int KeyNum = IniFile.FindKey("SpawnPosition"); int KeyNum = IniFile.FindKey("SpawnPosition");
m_bSpawnExplicitlySet = m_IsSpawnExplicitlySet =
( (
(KeyNum >= 0) && (KeyNum >= 0) &&
( (
@ -497,7 +497,7 @@ void cWorld::Start(void)
) )
); );
if (m_bSpawnExplicitlySet) if (m_IsSpawnExplicitlySet)
{ {
LOGD("Spawnpoint explicitly set!"); LOGD("Spawnpoint explicitly set!");
m_SpawnX = IniFile.GetValueF("SpawnPosition", "X", m_SpawnX); m_SpawnX = IniFile.GetValueF("SpawnPosition", "X", m_SpawnX);

View File

@ -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) /// 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; MTRand m_TickRand;
bool m_bSpawnExplicitlySet; bool m_IsSpawnExplicitlySet;
double m_SpawnX; double m_SpawnX;
double m_SpawnY; double m_SpawnY;
double m_SpawnZ; double m_SpawnZ;