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::list<void *> m_FreeList;
std::auto_ptr<typename cAllocationPool<T>::cStarvationCallbacks> m_Callbacks; std::auto_ptr<typename cAllocationPool<T>::cStarvationCallbacks> m_Callbacks;
}; };

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -32,8 +32,7 @@ public:
cMapManager(cWorld * a_World); cMapManager(cWorld * a_World);
/** Returns the map with the specified ID, NULL if out of range. /** 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); cMap * GetMapData(unsigned int a_ID);
@ -41,15 +40,13 @@ public:
cMap * CreateMap(int a_CenterX, int a_CenterY, int a_Scale = 3); cMap * CreateMap(int a_CenterX, int a_CenterY, int a_Scale = 3);
/** Calls the callback for the map with the specified ID. /** 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.
* Returns true if the map was found and the callback called, false if map not found. Callback return value is ignored.
* Callback return ignored.
*/ */
bool DoWithMap(int a_ID, cMapCallback & a_Callback); // Exported in ManualBindings.cpp bool DoWithMap(int a_ID, cMapCallback & a_Callback); // Exported in ManualBindings.cpp
/** Calls the callback for each map. /** 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); bool ForEachMap(cMapCallback & a_Callback);

View File

@ -8,7 +8,7 @@
void cMobProximityCounter::CollectMob(cEntity& a_Monster, cChunk& a_Chunk, double a_Distance) 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); tMonsterToDistance::iterator it = m_MonsterToDistance.find(&a_Monster);
if (it == m_MonsterToDistance.end()) if (it == m_MonsterToDistance.end())
{ {

View File

@ -533,10 +533,10 @@ NOISE_DATATYPE cNoise::CubicNoise3D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y, NOIS
const NOISE_DATATYPE x1interp4 = CubicInterpolate( points1[3][0], points1[3][1], points1[3][2], points1[3][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] = { 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 - 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, 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 + 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 + 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 ); const NOISE_DATATYPE x2interp1 = CubicInterpolate( points2[0][0], points2[0][1], points2[0][2], points2[0][3], FracX );

View File

@ -36,20 +36,24 @@ namespace Json
/// The root of the object hierarchy /// The root of the object hierarchy
class cRoot // tolua_export // tolua_begin
{ // tolua_export class cRoot
{
public: public:
static cRoot * Get() { return s_Root; } // tolua_export static cRoot * Get() { return s_Root; }
// tolua_end
cRoot(void); cRoot(void);
~cRoot(); ~cRoot();
void Start(void); void Start(void);
cServer * GetServer(void) { return m_Server; } // tolua_export // tolua_begin
cWorld * GetDefaultWorld(void); // tolua_export cServer * GetServer(void) { return m_Server; }
cWorld * GetWorld(const AString & a_WorldName); // tolua_export cWorld * GetDefaultWorld(void);
cWorld * CreateAndInitializeWorld(const AString & a_WorldName); // tolua_export 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) /// Calls the callback for each world; returns true if the callback didn't abort (return true)
bool ForEachWorld(cWorldListCallback & a_Callback); // >> Exported in ManualBindings << bool ForEachWorld(cWorldListCallback & a_Callback); // >> Exported in ManualBindings <<

View File

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

View File

@ -262,20 +262,17 @@ public:
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 /** 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); bool ForEachObjectiveWith(cObjective::eType a_Type, cObjectiveCallback& a_Callback);
/** Execute callback for each objective. /** Execute callback for each objective.
* Returns true if all objectives have been processed, false if the callback aborted by returning true.
* 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 bool ForEachObjective(cObjectiveCallback& a_Callback); // Exported in ManualBindings.cpp
/** Execute callback for each team. /** Execute callback for each team.
* Returns true if all teams have been processed, false if the callback aborted by returning true.
* 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 bool ForEachTeam(cTeamCallback& a_Callback); // Exported in ManualBindings.cpp

View File

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

View File

@ -502,22 +502,21 @@ AString & UTF8ToRawBEUTF16(const char * a_UTF8, size_t a_UTF8Length, AString & a
return a_UTF16; return a_UTF16;
} }
/* --------------------------------------------------------------------- /*
---------------------------------------------------------------------
Note A. Note A.
The fall-through switches in UTF-8 reading code save a The fall-through switches in UTF-8 reading code save a
temp variable, some decrements & conditionals. The switches temp variable, some decrements & conditionals. The switches
are equivalent to the following loop: are equivalent to the following loop:
{ {
int tmpBytesToRead = extraBytesToRead+1; int tmpBytesToRead = extraBytesToRead+1;
do { do {
ch += *source++; ch += *source++;
--tmpBytesToRead; --tmpBytesToRead;
if (tmpBytesToRead) ch <<= 6; if (tmpBytesToRead) ch <<= 6;
} while (tmpBytesToRead > 0); } while (tmpBytesToRead > 0);
} }
---------------------------------------------------------------------
---------------------------------------------------------------------
*/ */
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

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