1
0

Fixed basic whitespace problems.

Indenting by spaces and alignment by spaces, as well as trailing whitespace on non-empty lines.
This commit is contained in:
madmaxoft 2014-07-17 16:33:09 +02:00
parent c3b4b70a73
commit 993fd14ddf
52 changed files with 306 additions and 298 deletions

View File

@ -107,3 +107,7 @@ class cListAllocationPool : public cAllocationPool<T>
std::list<void *> m_FreeList;
std::auto_ptr<typename cAllocationPool<T>::cStarvationCallbacks> m_Callbacks;
};

View File

@ -2226,7 +2226,7 @@ void cBlockArea::MergeByStrategy(const cBlockArea & a_Src, int a_RelX, int a_Rel
m_Size.x, m_Size.y, m_Size.z
);
return;
} // case msDifference
} // case msDifference
case cBlockArea::msMask:
{

View File

@ -27,7 +27,7 @@ public:
static const std::string Rose;
static const std::string LightPurple;
static const std::string Yellow;
static const std::string White;
static const std::string White;
// Styles ( source: http://wiki.vg/Chat )
static const std::string Random;

View File

@ -2326,7 +2326,7 @@ bool cChunk::DoWithNoteBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cNoteBl
return false;
}
// The correct block entity is here,
// The correct block entity is here
if (a_Callback.Item((cNoteEntity *)*itr))
{
return false;
@ -2422,7 +2422,7 @@ bool cChunk::DoWithFlowerPotAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFlower
return false;
}
// The correct block entity is here,
// The correct block entity is here
if (a_Callback.Item((cFlowerPotEntity *)*itr))
{
return false;

View File

@ -22,8 +22,8 @@ It will help us when the new chunk format comes out and we need to patch everyth
#define ZERO_CHUNK_Y 0
// Used to smoothly convert to new axis ordering. One will be removed when deemed stable.
#define AXIS_ORDER_YZX 1 // Original (1.1-)
#define AXIS_ORDER_XZY 2 // New (1.2+)
#define AXIS_ORDER_YZX 1 // Original (1.1-)
#define AXIS_ORDER_XZY 2 // New (1.2+)
#define AXIS_ORDER AXIS_ORDER_XZY
@ -148,17 +148,17 @@ public:
inline static Vector3i IndexToCoordinate( unsigned int index )
{
#if AXIS_ORDER == AXIS_ORDER_XZY
return Vector3i( // 1.2
index % cChunkDef::Width, // X
index / (cChunkDef::Width * cChunkDef::Width), // Y
(index / cChunkDef::Width) % cChunkDef::Width // Z
);
return Vector3i( // 1.2
index % cChunkDef::Width, // X
index / (cChunkDef::Width * cChunkDef::Width), // Y
(index / cChunkDef::Width) % cChunkDef::Width // Z
);
#elif AXIS_ORDER == AXIS_ORDER_YZX
return Vector3i( // 1.1
index / (cChunkDef::Height * cChunkDef::Width), // X
index % cChunkDef::Height, // Y
(index / cChunkDef::Height) % cChunkDef::Width // Z
);
return Vector3i( // 1.1
index / (cChunkDef::Height * cChunkDef::Width), // X
index % cChunkDef::Height, // Y
(index / cChunkDef::Height) % cChunkDef::Width // Z
);
#endif
}

View File

@ -85,7 +85,7 @@ cClientHandle::cClientHandle(const cSocket * a_Socket, int a_ViewDistance) :
{
m_Protocol = new cProtocolRecognizer(this);
s_ClientCount++; // Not protected by CS because clients are always constructed from the same thread
s_ClientCount++; // Not protected by CS because clients are always constructed from the same thread
m_UniqueID = s_ClientCount;
cTimer t1;

View File

@ -48,7 +48,7 @@ class cStatManager;
class cClientHandle : // tolua_export
public cSocketThreads::cCallback
{ // tolua_export
{ // tolua_export
public:
#if defined(ANDROID_NDK)
@ -64,9 +64,9 @@ public:
const AString & GetIPString(void) const { return m_IPString; }
cPlayer * GetPlayer(void) { return m_Player; } // tolua_export
cPlayer * GetPlayer(void) { return m_Player; } // tolua_export
const AString & GetUUID(void) const { return m_UUID; } // tolua_export
const AString & GetUUID(void) const { return m_UUID; } // tolua_export
void SetUUID(const AString & a_UUID) { m_UUID = a_UUID; }
const Json::Value & GetProperties(void) const { return m_Properties; }
@ -338,7 +338,7 @@ private:
csAuthenticating, ///< The client has logged in, waiting for external authentication
csAuthenticated, ///< The client has been authenticated, will start streaming chunks in the next tick
csDownloadingWorld, ///< The client is waiting for chunks, we're waiting for the loader to provide and send them
csConfirmingPos, ///< The client has been sent the position packet, waiting for them to repeat the position back
csConfirmingPos, ///< The client has been sent the position packet, waiting for them to repeat the position back
csPlaying, ///< Normal gameplay
csDestroying, ///< The client is being destroyed, don't queue any more packets / don't add to chunks
csDestroyed, ///< The client has been destroyed, the destructor is to be called from the owner thread
@ -408,7 +408,7 @@ private:
virtual bool DataReceived (const char * a_Data, size_t a_Size) override; // Data is received from the client
virtual void GetOutgoingData(AString & a_Data) override; // Data can be sent to client
virtual void SocketClosed (void) override; // The socket has been closed for any reason
}; // tolua_export
}; // tolua_export

View File

@ -38,7 +38,7 @@ public:
Assumes both cuboids are sorted. */
bool DoesIntersect(const cCuboid & a_Other) const;
bool IsInside(const Vector3i & v) const
bool IsInside(const Vector3i & v) const
{
return (
(v.x >= p1.x) && (v.x <= p2.x) &&
@ -47,7 +47,7 @@ public:
);
}
bool IsInside(int a_X, int a_Y, int a_Z) const
bool IsInside(int a_X, int a_Y, int a_Z) const
{
return (
(a_X >= p1.x) && (a_X <= p2.x) &&

View File

@ -16,7 +16,7 @@
// Disable some warnings that we don't care about:
#pragma warning(disable:4100) // Unreferenced formal parameter
// Useful warnings from warning level 4:
// Useful warnings from warning level 4:
#pragma warning(3 : 4127) // Conditional expression is constant
#pragma warning(3 : 4189) // Local variable is initialized but not referenced
#pragma warning(3 : 4245) // Conversion from 'type1' to 'type2', signed/unsigned mismatch
@ -58,7 +58,7 @@
// override is part of c++11
#if __cplusplus < 201103L
#define override
#define override
#endif
#define OBSOLETE __attribute__((deprecated))
@ -145,7 +145,7 @@ class SizeChecker;
template <typename T, size_t Size>
class SizeChecker<T, Size, true>
{
T v;
T v;
};
template class SizeChecker<Int64, 8>;

View File

@ -5,18 +5,22 @@
class cGroup // tolua_export
{ // tolua_export
public: // tolua_export
// tolua_begin
class cGroup
{
public:
// tolua_end
cGroup() {}
~cGroup() {}
void SetName( const AString & a_Name ) { m_Name = a_Name; } // tolua_export
const AString & GetName() const { return m_Name; } // tolua_export
void SetColor( const AString & a_Color ) { m_Color = a_Color; } // tolua_export
void AddCommand( const AString & a_Command ); // tolua_export
void AddPermission( const AString & a_Permission ); // tolua_export
void InheritFrom( cGroup* a_Group ); // tolua_export
// tolua_begin
void SetName( const AString & a_Name ) { m_Name = a_Name; }
const AString & GetName() const { return m_Name; }
void SetColor( const AString & a_Color ) { m_Color = a_Color; }
void AddCommand( const AString & a_Command );
void AddPermission( const AString & a_Permission );
void InheritFrom( cGroup* a_Group );
// tolua_end
typedef std::map< AString, bool > PermissionMap;
const PermissionMap & GetPermissions() const { return m_Permissions; }
@ -26,7 +30,7 @@ public: // tolua_export
typedef std::map< AString, bool > CommandMap;
const CommandMap & GetCommands() const { return m_Commands; }
const AString & GetColor() const { return m_Color; } // tolua_export
const AString & GetColor() const { return m_Color; } // tolua_export
typedef std::list< cGroup* > GroupList;
const GroupList & GetInherits() const { return m_Inherits; }
@ -37,4 +41,4 @@ private:
PermissionMap m_Permissions;
CommandMap m_Commands;
GroupList m_Inherits;
};// tolua_export
}; // tolua_export

View File

@ -183,7 +183,7 @@ protected:
// cItemGrid::cListener override:
virtual void OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) override;
}; // tolua_export
}; // tolua_export

View File

@ -193,17 +193,29 @@ void cItem::FromJson(const Json::Value & a_Value)
bool cItem::IsEnchantable(short item)
{
if ((item >= 256) && (item <= 259))
{
return true;
}
if ((item >= 267) && (item <= 279))
{
return true;
}
if ((item >= 283) && (item <= 286))
{
return true;
}
if ((item >= 290) && (item <= 294))
{
return true;
}
if ((item >= 298) && (item <= 317))
{
return true;
}
if ((item == 346) || (item == 359) || (item == 261))
{
return true;
}
return false;
}

View File

@ -184,14 +184,14 @@ public:
void FromJson(const Json::Value & a_Value);
/** Returns true if the specified item type is enchantable (as per 1.2.5 protocol requirements) */
static bool IsEnchantable(short a_ItemType); // tolua_export
static bool IsEnchantable(short a_ItemType); // tolua_export
/** Returns the enchantability of the item. When the item hasn't a enchantability, it will returns 0 */
int GetEnchantability(); // tolua_export
int GetEnchantability(); // tolua_export
/** Enchants the item using the specified number of XP levels.
Returns true if item enchanted, false if not. */
bool EnchantByXPLevels(int a_NumXPLevels); // tolua_export
bool EnchantByXPLevels(int a_NumXPLevels); // tolua_export
// tolua_begin

View File

@ -6,7 +6,7 @@
class cLog
{ // tolua_export
{
private:
FILE * m_File;
static cLog * s_Log;
@ -23,7 +23,7 @@ public:
void ClearLog();
static cLog* GetInstance();
};
// tolua_end

View File

@ -10,7 +10,6 @@ class cLog;
// tolua_begin
class cMCLogger
{
public:
@ -27,9 +26,9 @@ public:
cMCLogger(void);
/** Creates a logger with the specified filename inside "logs" folder */
cMCLogger(const AString & a_FileName); // tolua_export
cMCLogger(const AString & a_FileName);
~cMCLogger(); // tolua_export
~cMCLogger();
void Log (const char * a_Format, va_list a_ArgList) FORMATSTRING(2, 0);
void Info (const char * a_Format, va_list a_ArgList) FORMATSTRING(2, 0);
@ -37,7 +36,7 @@ public:
void Error(const char * a_Format, va_list a_ArgList) FORMATSTRING(2, 0);
/** Logs the simple text message at the specified log level. */
void LogSimple(const char * a_Text, eLogLevel a_LogLevel = llRegular); // tolua_export
void LogSimple(const char * a_Text, eLogLevel a_LogLevel = llRegular);
static cMCLogger * GetInstance();
private:
@ -63,7 +62,7 @@ private:
/// Common initialization for all constructors, creates a logfile with the specified name and assigns s_MCLogger to this
void InitLog(const AString & a_FileName);
}; // tolua_export
};

View File

@ -29,13 +29,12 @@ class cMap;
/** Encapsulates a map decorator.
*
* A map decorator represents an object drawn on the map that can move freely.
* (e.g. player trackers and item frame pointers)
*
* Excluding manually placed decorators,
* decorators are automatically managed (allocated and freed) by their parent cMap instance.
*/
A map decorator represents an object drawn on the map that can move freely.
(e.g. player trackers and item frame pointers)
Excluding manually placed decorators,
decorators are automatically managed (allocated and freed) by their parent cMap instance.
*/
class cMapDecorator
{
public:
@ -194,10 +193,9 @@ public:
protected:
/** Encapsulates the state of a map client.
*
* In order to enhance performace, maps are streamed column-by-column to each client.
* This structure stores the state of the stream.
*/
In order to enhance performace, maps are streamed column-by-column to each client.
This structure stores the state of the stream.
*/
struct cMapClient
{
cClientHandle * m_Handle;

View File

@ -32,25 +32,22 @@ public:
cMapManager(cWorld * a_World);
/** Returns the map with the specified ID, NULL if out of range.
*
* WARNING: The returned map object is not thread safe.
*/
WARNING: The returned map object is not thread safe.
*/
cMap * GetMapData(unsigned int a_ID);
/** Creates a new map. Returns NULL on error */
cMap * CreateMap(int a_CenterX, int a_CenterY, int a_Scale = 3);
/** Calls the callback for the map with the specified ID.
*
* Returns true if the map was found and the callback called, false if map not found.
* Callback return ignored.
*/
Returns true if the map was found and the callback called, false if map not found.
Callback return value is ignored.
*/
bool DoWithMap(int a_ID, cMapCallback & a_Callback); // Exported in ManualBindings.cpp
/** Calls the callback for each map.
*
* Returns true if all maps processed, false if the callback aborted by returning true.
*/
Returns true if all maps processed, false if the callback aborted by returning true.
*/
bool ForEachMap(cMapCallback & a_Callback);
size_t GetNumMaps(void) const; // tolua_export

View File

@ -8,7 +8,7 @@
void cMobProximityCounter::CollectMob(cEntity& a_Monster, cChunk& a_Chunk, double a_Distance)
{
// LOGD("Collecting monster %s, with distance %f",a_Monster->GetClass(),a_Distance);
// LOGD("Collecting monster %s, with distance %f",a_Monster->GetClass(),a_Distance);
tMonsterToDistance::iterator it = m_MonsterToDistance.find(&a_Monster);
if (it == m_MonsterToDistance.end())
{

View File

@ -91,7 +91,7 @@ cMonster::eType cMobSpawner::ChooseMobType(EMCSBiome a_Biome)
addIfAllowed(cMonster::mtCow, allowedMobs);
addIfAllowed(cMonster::mtChicken, allowedMobs);
addIfAllowed(cMonster::mtEnderman, allowedMobs);
addIfAllowed(cMonster::mtSlime, allowedMobs); // MG TODO : much more complicated rule
addIfAllowed(cMonster::mtSlime, allowedMobs); // MG TODO : much more complicated rule
if (a_Biome == biForest || a_Biome == biForestHills || a_Biome == biTaiga || a_Biome == biTaigaHills)
{

View File

@ -487,8 +487,8 @@ NOISE_DATATYPE cNoise::SmoothNoise1D(int a_X) const
NOISE_DATATYPE cNoise::CubicNoise2D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y) const
{
const int BaseX = FAST_FLOOR(a_X);
const int BaseY = FAST_FLOOR(a_Y);
const int BaseX = FAST_FLOOR(a_X);
const int BaseY = FAST_FLOOR(a_Y);
const NOISE_DATATYPE points[4][4] =
{
@ -515,9 +515,9 @@ NOISE_DATATYPE cNoise::CubicNoise2D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y) cons
NOISE_DATATYPE cNoise::CubicNoise3D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y, NOISE_DATATYPE a_Z) const
{
const int BaseX = FAST_FLOOR(a_X);
const int BaseY = FAST_FLOOR(a_Y);
const int BaseZ = FAST_FLOOR(a_Z);
const int BaseX = FAST_FLOOR(a_X);
const int BaseY = FAST_FLOOR(a_Y);
const int BaseZ = FAST_FLOOR(a_Z);
const NOISE_DATATYPE points1[4][4] = {
{ IntNoise3D(BaseX - 1, BaseY - 1, BaseZ - 1), IntNoise3D(BaseX, BaseY - 1, BaseZ - 1), IntNoise3D(BaseX + 1, BaseY - 1, BaseZ - 1), IntNoise3D(BaseX + 2, BaseY - 1, BaseZ - 1), },
@ -526,17 +526,17 @@ NOISE_DATATYPE cNoise::CubicNoise3D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y, NOIS
{ IntNoise3D(BaseX - 1, BaseY + 2, BaseZ - 1), IntNoise3D(BaseX, BaseY + 2, BaseZ - 1), IntNoise3D(BaseX + 1, BaseY + 2, BaseZ - 1), IntNoise3D(BaseX + 2, BaseY + 2, BaseZ - 1), },
};
const NOISE_DATATYPE FracX = (a_X) - BaseX;
const NOISE_DATATYPE FracX = (a_X) - BaseX;
const NOISE_DATATYPE x1interp1 = CubicInterpolate( points1[0][0], points1[0][1], points1[0][2], points1[0][3], FracX );
const NOISE_DATATYPE x1interp2 = CubicInterpolate( points1[1][0], points1[1][1], points1[1][2], points1[1][3], FracX );
const NOISE_DATATYPE x1interp3 = CubicInterpolate( points1[2][0], points1[2][1], points1[2][2], points1[2][3], FracX );
const NOISE_DATATYPE x1interp4 = CubicInterpolate( points1[3][0], points1[3][1], points1[3][2], points1[3][3], FracX );
const NOISE_DATATYPE points2[4][4] = {
{ IntNoise3D( BaseX-1, BaseY-1, BaseZ ), IntNoise3D( BaseX, BaseY-1, BaseZ ), IntNoise3D( BaseX+1, BaseY-1, BaseZ ), IntNoise3D( BaseX+2, BaseY-1, BaseZ ), },
{ IntNoise3D( BaseX-1, BaseY, BaseZ ), IntNoise3D( BaseX, BaseY, BaseZ ), IntNoise3D( BaseX+1, BaseY, BaseZ ), IntNoise3D( BaseX+2, BaseY, BaseZ ), },
{ IntNoise3D( BaseX-1, BaseY+1, BaseZ ), IntNoise3D( BaseX, BaseY+1, BaseZ ), IntNoise3D( BaseX+1, BaseY+1, BaseZ ), IntNoise3D( BaseX+2, BaseY+1, BaseZ ), },
{ IntNoise3D( BaseX-1, BaseY+2, BaseZ ), IntNoise3D( BaseX, BaseY+2, BaseZ ), IntNoise3D( BaseX+1, BaseY+2, BaseZ ), IntNoise3D( BaseX+2, BaseY+2, BaseZ ), },
{ IntNoise3D(BaseX - 1, BaseY - 1, BaseZ), IntNoise3D(BaseX, BaseY - 1, BaseZ), IntNoise3D(BaseX + 1, BaseY - 1, BaseZ), IntNoise3D(BaseX + 2, BaseY - 1, BaseZ), },
{ IntNoise3D(BaseX - 1, BaseY, BaseZ), IntNoise3D(BaseX, BaseY, BaseZ), IntNoise3D(BaseX + 1, BaseY, BaseZ), IntNoise3D(BaseX + 2, BaseY, BaseZ), },
{ IntNoise3D(BaseX - 1, BaseY + 1, BaseZ), IntNoise3D(BaseX, BaseY + 1, BaseZ), IntNoise3D(BaseX + 1, BaseY + 1, BaseZ), IntNoise3D(BaseX + 2, BaseY + 1, BaseZ), },
{ IntNoise3D(BaseX - 1, BaseY + 2, BaseZ), IntNoise3D(BaseX, BaseY + 2, BaseZ), IntNoise3D(BaseX + 1, BaseY + 2, BaseZ), IntNoise3D(BaseX + 2, BaseY + 2, BaseZ), },
};
const NOISE_DATATYPE x2interp1 = CubicInterpolate( points2[0][0], points2[0][1], points2[0][2], points2[0][3], FracX );
@ -545,10 +545,10 @@ NOISE_DATATYPE cNoise::CubicNoise3D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y, NOIS
const NOISE_DATATYPE x2interp4 = CubicInterpolate( points2[3][0], points2[3][1], points2[3][2], points2[3][3], FracX );
const NOISE_DATATYPE points3[4][4] = {
{ IntNoise3D( BaseX-1, BaseY-1, BaseZ+1 ), IntNoise3D( BaseX, BaseY-1, BaseZ+1 ), IntNoise3D( BaseX+1, BaseY-1, BaseZ+1 ), IntNoise3D( BaseX+2, BaseY-1, BaseZ + 1), },
{ IntNoise3D( BaseX-1, BaseY, BaseZ+1 ), IntNoise3D( BaseX, BaseY, BaseZ+1 ), IntNoise3D( BaseX+1, BaseY, BaseZ+1 ), IntNoise3D( BaseX+2, BaseY, BaseZ + 1), },
{ IntNoise3D( BaseX-1, BaseY+1, BaseZ+1 ), IntNoise3D( BaseX, BaseY+1, BaseZ+1 ), IntNoise3D( BaseX+1, BaseY+1, BaseZ+1 ), IntNoise3D( BaseX+2, BaseY+1, BaseZ + 1), },
{ IntNoise3D( BaseX-1, BaseY+2, BaseZ+1 ), IntNoise3D( BaseX, BaseY+2, BaseZ+1 ), IntNoise3D( BaseX+1, BaseY+2, BaseZ+1 ), IntNoise3D( BaseX+2, BaseY+2, BaseZ + 1), },
{ IntNoise3D( BaseX-1, BaseY-1, BaseZ+1 ), IntNoise3D( BaseX, BaseY-1, BaseZ+1 ), IntNoise3D( BaseX+1, BaseY-1, BaseZ+1 ), IntNoise3D( BaseX+2, BaseY-1, BaseZ + 1), },
{ IntNoise3D( BaseX-1, BaseY, BaseZ+1 ), IntNoise3D( BaseX, BaseY, BaseZ+1 ), IntNoise3D( BaseX+1, BaseY, BaseZ+1 ), IntNoise3D( BaseX+2, BaseY, BaseZ + 1), },
{ IntNoise3D( BaseX-1, BaseY+1, BaseZ+1 ), IntNoise3D( BaseX, BaseY+1, BaseZ+1 ), IntNoise3D( BaseX+1, BaseY+1, BaseZ+1 ), IntNoise3D( BaseX+2, BaseY+1, BaseZ + 1), },
{ IntNoise3D( BaseX-1, BaseY+2, BaseZ+1 ), IntNoise3D( BaseX, BaseY+2, BaseZ+1 ), IntNoise3D( BaseX+1, BaseY+2, BaseZ+1 ), IntNoise3D( BaseX+2, BaseY+2, BaseZ + 1), },
};
const NOISE_DATATYPE x3interp1 = CubicInterpolate( points3[0][0], points3[0][1], points3[0][2], points3[0][3], FracX );
@ -557,10 +557,10 @@ NOISE_DATATYPE cNoise::CubicNoise3D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y, NOIS
const NOISE_DATATYPE x3interp4 = CubicInterpolate( points3[3][0], points3[3][1], points3[3][2], points3[3][3], FracX );
const NOISE_DATATYPE points4[4][4] = {
{ IntNoise3D( BaseX-1, BaseY-1, BaseZ+2 ), IntNoise3D( BaseX, BaseY-1, BaseZ+2 ), IntNoise3D( BaseX+1, BaseY-1, BaseZ+2 ), IntNoise3D( BaseX+2, BaseY-1, BaseZ+2 ), },
{ IntNoise3D( BaseX-1, BaseY, BaseZ+2 ), IntNoise3D( BaseX, BaseY, BaseZ+2 ), IntNoise3D( BaseX+1, BaseY, BaseZ+2 ), IntNoise3D( BaseX+2, BaseY, BaseZ+2 ), },
{ IntNoise3D( BaseX-1, BaseY+1, BaseZ+2 ), IntNoise3D( BaseX, BaseY+1, BaseZ+2 ), IntNoise3D( BaseX+1, BaseY+1, BaseZ+2 ), IntNoise3D( BaseX+2, BaseY+1, BaseZ+2 ), },
{ IntNoise3D( BaseX-1, BaseY+2, BaseZ+2 ), IntNoise3D( BaseX, BaseY+2, BaseZ+2 ), IntNoise3D( BaseX+1, BaseY+2, BaseZ+2 ), IntNoise3D( BaseX+2, BaseY+2, BaseZ+2 ), },
{ IntNoise3D( BaseX-1, BaseY-1, BaseZ+2 ), IntNoise3D( BaseX, BaseY-1, BaseZ+2 ), IntNoise3D( BaseX+1, BaseY-1, BaseZ+2 ), IntNoise3D( BaseX+2, BaseY-1, BaseZ+2 ), },
{ IntNoise3D( BaseX-1, BaseY, BaseZ+2 ), IntNoise3D( BaseX, BaseY, BaseZ+2 ), IntNoise3D( BaseX+1, BaseY, BaseZ+2 ), IntNoise3D( BaseX+2, BaseY, BaseZ+2 ), },
{ IntNoise3D( BaseX-1, BaseY+1, BaseZ+2 ), IntNoise3D( BaseX, BaseY+1, BaseZ+2 ), IntNoise3D( BaseX+1, BaseY+1, BaseZ+2 ), IntNoise3D( BaseX+2, BaseY+1, BaseZ+2 ), },
{ IntNoise3D( BaseX-1, BaseY+2, BaseZ+2 ), IntNoise3D( BaseX, BaseY+2, BaseZ+2 ), IntNoise3D( BaseX+1, BaseY+2, BaseZ+2 ), IntNoise3D( BaseX+2, BaseY+2, BaseZ+2 ), },
};
const NOISE_DATATYPE x4interp1 = CubicInterpolate( points4[0][0], points4[0][1], points4[0][2], points4[0][3], FracX );
@ -568,13 +568,13 @@ NOISE_DATATYPE cNoise::CubicNoise3D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y, NOIS
const NOISE_DATATYPE x4interp3 = CubicInterpolate( points4[2][0], points4[2][1], points4[2][2], points4[2][3], FracX );
const NOISE_DATATYPE x4interp4 = CubicInterpolate( points4[3][0], points4[3][1], points4[3][2], points4[3][3], FracX );
const NOISE_DATATYPE FracY = (a_Y) - BaseY;
const NOISE_DATATYPE FracY = (a_Y) - BaseY;
const NOISE_DATATYPE yinterp1 = CubicInterpolate( x1interp1, x1interp2, x1interp3, x1interp4, FracY );
const NOISE_DATATYPE yinterp2 = CubicInterpolate( x2interp1, x2interp2, x2interp3, x2interp4, FracY );
const NOISE_DATATYPE yinterp3 = CubicInterpolate( x3interp1, x3interp2, x3interp3, x3interp4, FracY );
const NOISE_DATATYPE yinterp4 = CubicInterpolate( x4interp1, x4interp2, x4interp3, x4interp4, FracY );
const NOISE_DATATYPE FracZ = (a_Z) - BaseZ;
const NOISE_DATATYPE FracZ = (a_Z) - BaseZ;
return CubicInterpolate( yinterp1, yinterp2, yinterp3, yinterp4, FracZ );
}

View File

@ -194,7 +194,7 @@ void cRoot::Start(void)
#if !defined(ANDROID_NDK)
LOGD("Starting InputThread...");
m_InputThread = new cThread( InputThread, this, "cRoot::InputThread" );
m_InputThread->Start( false ); // We should NOT wait? Otherwise we can't stop the server from other threads than the input thread
m_InputThread->Start( false ); // We should NOT wait? Otherwise we can't stop the server from other threads than the input thread
#endif
long long finishmseconds = Time.GetNowTime();
@ -687,7 +687,7 @@ int cRoot::GetVirtualRAMUsage(void)
&t_info_count
))
{
return (int)(t_info.virtual_size / 1024);
return (int)(t_info.virtual_size / 1024);
}
return -1;
#else
@ -739,7 +739,7 @@ int cRoot::GetPhysicalRAMUsage(void)
&t_info_count
))
{
return (int)(t_info.resident_size / 1024);
return (int)(t_info.resident_size / 1024);
}
return -1;
#else

View File

@ -36,20 +36,24 @@ namespace Json
/// The root of the object hierarchy
class cRoot // tolua_export
{ // tolua_export
// tolua_begin
class cRoot
{
public:
static cRoot * Get() { return s_Root; } // tolua_export
static cRoot * Get() { return s_Root; }
// tolua_end
cRoot(void);
~cRoot();
void Start(void);
cServer * GetServer(void) { return m_Server; } // tolua_export
cWorld * GetDefaultWorld(void); // tolua_export
cWorld * GetWorld(const AString & a_WorldName); // tolua_export
cWorld * CreateAndInitializeWorld(const AString & a_WorldName); // tolua_export
// tolua_begin
cServer * GetServer(void) { return m_Server; }
cWorld * GetDefaultWorld(void);
cWorld * GetWorld(const AString & a_WorldName);
cWorld * CreateAndInitializeWorld(const AString & a_WorldName);
// tolua_end
/// Calls the callback for each world; returns true if the callback didn't abort (return true)
bool ForEachWorld(cWorldListCallback & a_Callback); // >> Exported in ManualBindings <<
@ -106,13 +110,13 @@ public:
void SaveAllChunks(void); // tolua_export
/// Reloads all the groups
void ReloadGroups(void); // tolua_export
void ReloadGroups(void); // tolua_export
/// Calls the callback for each player in all worlds
bool ForEachPlayer(cPlayerListCallback & a_Callback); // >> EXPORTED IN MANUALBINDINGS <<
bool ForEachPlayer(cPlayerListCallback & a_Callback); // >> EXPORTED IN MANUALBINDINGS <<
/// Finds a player from a partial or complete player name and calls the callback - case-insensitive
bool FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback); // >> EXPORTED IN MANUALBINDINGS <<
bool FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback); // >> EXPORTED IN MANUALBINDINGS <<
// tolua_begin
@ -202,8 +206,8 @@ private:
static void InputThread(void* a_Params);
static cRoot* s_Root;
}; // tolua_export
static cRoot* s_Root;
}; // tolua_export

View File

@ -197,15 +197,18 @@ void cObjective::SendTo(cClientHandle & a_Client)
cTeam::cTeam(const AString & a_Name, const AString & a_DisplayName,
const AString & a_Prefix, const AString & a_Suffix)
cTeam::cTeam(
const AString & a_Name, const AString & a_DisplayName,
const AString & a_Prefix, const AString & a_Suffix
)
: m_AllowsFriendlyFire(true)
, m_CanSeeFriendlyInvisible(false)
, m_DisplayName(a_DisplayName)
, m_Name(a_Name)
, m_Prefix(a_Prefix)
, m_Suffix(a_Suffix)
{}
{
}

View File

@ -259,25 +259,22 @@ public:
/** Send this scoreboard to the specified client */
void SendTo(cClientHandle & a_Client);
cTeam * QueryPlayerTeam(const AString & a_Name); // WARNING: O(n logn)
cTeam * QueryPlayerTeam(const AString & a_Name); // WARNING: O(n logn)
/** Execute callback for each objective with the specified type
*
* Returns true if all objectives processed, false if the callback aborted by returning true.
*/
Returns true if all objectives processed, false if the callback aborted by returning true.
*/
bool ForEachObjectiveWith(cObjective::eType a_Type, cObjectiveCallback& a_Callback);
/** Execute callback for each objective.
*
* Returns true if all objectives have been processed, false if the callback aborted by returning true.
*/
bool ForEachObjective(cObjectiveCallback& a_Callback); // Exported in ManualBindings.cpp
Returns true if all objectives have been processed, false if the callback aborted by returning true.
*/
bool ForEachObjective(cObjectiveCallback& a_Callback); // Exported in ManualBindings.cpp
/** Execute callback for each team.
*
* Returns true if all teams have been processed, false if the callback aborted by returning true.
*/
bool ForEachTeam(cTeamCallback& a_Callback); // Exported in ManualBindings.cpp
Returns true if all teams have been processed, false if the callback aborted by returning true.
*/
bool ForEachTeam(cTeamCallback& a_Callback); // Exported in ManualBindings.cpp
void SetDisplay(cObjective * a_Objective, eDisplaySlot a_Slot);

View File

@ -50,10 +50,10 @@ namespace Json
class cServer // tolua_export
class cServer // tolua_export
: public cListenThread::cCallback
{ // tolua_export
public: // tolua_export
{ // tolua_export
public: // tolua_export
virtual ~cServer() {}
bool InitServer(cIniFile & a_SettingsIni);

View File

@ -143,10 +143,9 @@ public:
/** Reset everything. */
void Reset();
/** Increment the specified stat.
*
* Returns the new value.
*/
/** Increments the specified stat.
Returns the new value.
*/
StatValue AddValue(const eStatistic a_Stat, const StatValue a_Delta = 1);
// tolua_end

View File

@ -233,13 +233,13 @@ AString & StrToLower(AString & s)
int NoCaseCompare(const AString & s1, const AString & s2)
{
#ifdef _MSC_VER
// MSVC has stricmp that compares case-insensitive:
return _stricmp(s1.c_str(), s2.c_str());
// MSVC has stricmp that compares case-insensitive:
return _stricmp(s1.c_str(), s2.c_str());
#else
// Do it the hard way:
AString s1Copy(s1);
AString s2Copy(s2);
return StrToUpper(s1Copy).compare(StrToUpper(s2Copy));
// Do it the hard way:
AString s1Copy(s1);
AString s2Copy(s2);
return StrToUpper(s1Copy).compare(StrToUpper(s2Copy));
#endif // else _MSC_VER
}
@ -502,22 +502,21 @@ AString & UTF8ToRawBEUTF16(const char * a_UTF8, size_t a_UTF8Length, AString & a
return a_UTF16;
}
/* ---------------------------------------------------------------------
Note A.
The fall-through switches in UTF-8 reading code save a
temp variable, some decrements & conditionals. The switches
are equivalent to the following loop:
{
int tmpBytesToRead = extraBytesToRead+1;
do {
ch += *source++;
--tmpBytesToRead;
if (tmpBytesToRead) ch <<= 6;
} while (tmpBytesToRead > 0);
}
---------------------------------------------------------------------
/*
---------------------------------------------------------------------
Note A.
The fall-through switches in UTF-8 reading code save a
temp variable, some decrements & conditionals. The switches
are equivalent to the following loop:
{
int tmpBytesToRead = extraBytesToRead+1;
do {
ch += *source++;
--tmpBytesToRead;
if (tmpBytesToRead) ch <<= 6;
} while (tmpBytesToRead > 0);
}
---------------------------------------------------------------------
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -761,7 +760,7 @@ AString Base64Decode(const AString & a_Base64String)
{
switch (o & 7)
{
case 0: res[o >> 3] |= (c << 2); break;
case 0: res[o >> 3] |= (c << 2); break;
case 6: res[o >> 3] |= (c >> 4); res[(o >> 3) + 1] |= (c << 4); break;
case 4: res[o >> 3] |= (c >> 2); res[(o >> 3) + 1] |= (c << 6); break;
case 2: res[o >> 3] |= c; break;

View File

@ -6,10 +6,7 @@
#ifndef STRINGUTILS_H_INCLUDED
#define STRINGUTILS_H_INCLUDED
#pragma once
#include <string>
@ -101,8 +98,3 @@ extern void SetBEInt(char * a_Mem, Int32 a_Value);
#endif // STRINGUTILS_H_INCLUDED

View File

@ -2920,7 +2920,7 @@ void cWorld::TickQueuedBlocks(void)
}
else
{
m_BlockTickQueue.push_back(Block); // Keep the block in the queue
m_BlockTickQueue.push_back(Block); // Keep the block in the queue
}
} // for itr - m_BlockTickQueueCopy[]
}

View File

@ -301,7 +301,7 @@ public:
bool DoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback); // >> EXPORTED IN MANUALBINDINGS <<
/** Finds a player from a partial or complete player name and calls the callback - case-insensitive */
bool FindAndDoWithPlayer(const AString & a_PlayerNameHint, cPlayerListCallback & a_Callback); // >> EXPORTED IN MANUALBINDINGS <<
bool FindAndDoWithPlayer(const AString & a_PlayerNameHint, cPlayerListCallback & a_Callback); // >> EXPORTED IN MANUALBINDINGS <<
// TODO: This interface is dangerous - rewrite to DoWithClosestPlayer(pos, sight, action)
cPlayer * FindClosestPlayer(const Vector3d & a_Pos, float a_SightLimit, bool a_CheckLineOfSight = true);
@ -365,10 +365,10 @@ public:
bool SetSignLines(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player = NULL); // Exported in ManualBindings.cpp
/** Sets the sign text, asking plugins for permission first. a_Player is the player who this change belongs to, may be NULL. Returns true if sign text changed. Same as SetSignLines() */
bool UpdateSign(int a_X, int a_Y, int a_Z, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player = NULL); // Exported in ManualBindings.cpp
bool UpdateSign(int a_X, int a_Y, int a_Z, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player = NULL); // Exported in ManualBindings.cpp
/** Sets the command block command. Returns true if command changed. */
bool SetCommandBlockCommand(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Command); // tolua_export
bool SetCommandBlockCommand(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Command); // tolua_export
/** Is the trapdoor open? Returns false if there is no trapdoor at the specified coords. */
bool IsTrapdoorOpen(int a_BlockX, int a_BlockY, int a_BlockZ); // tolua_export
@ -377,10 +377,10 @@ public:
bool SetTrapdoorOpen(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_Open); // tolua_export
/** Regenerate the given chunk: */
void RegenerateChunk(int a_ChunkX, int a_ChunkZ); // tolua_export
void RegenerateChunk(int a_ChunkX, int a_ChunkZ); // tolua_export
/** Generates the given chunk, if not already generated */
void GenerateChunk(int a_ChunkX, int a_ChunkZ); // tolua_export
void GenerateChunk(int a_ChunkX, int a_ChunkZ); // tolua_export
/** Queues a chunk for lighting; a_Callback is called after the chunk is lighted */
void QueueLightChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_Callback = NULL);