1
0

Fix style of Tools

This commit is contained in:
Alexander Lyons Harkness 2017-12-23 12:49:08 +00:00
parent aff140365d
commit 1926181cb7
45 changed files with 626 additions and 773 deletions

View File

@ -66,7 +66,3 @@ int main(int argc, char * argv[])
LOG("Done");
}

View File

@ -123,7 +123,7 @@ void cBiomeMap::StartNewRegion(int a_RegionX, int a_RegionZ)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// cBiomeMapFactory:
cBiomeMapFactory::~cBiomeMapFactory()
@ -135,7 +135,3 @@ cBiomeMapFactory::~cBiomeMapFactory()
}
// TODO: Join all the files into one giant image file
}

View File

@ -21,7 +21,7 @@ class cBiomeMap :
public:
cBiomeMap(void);
/// Saves the last region that it was processing
/** Saves the last region that it was processing */
void Finish(void);
protected:
@ -63,7 +63,3 @@ public:
}
} ;

View File

@ -40,25 +40,25 @@ public:
virtual ~cCallback() {} // Force a virtual destructor in each descendant
/// Called when a new region file is about to be opened; by default allow the region
/** Called when a new region file is about to be opened; by default allow the region */
virtual bool OnNewRegion(int a_RegionX, int a_RegionZ) { return CALLBACK_CONTINUE; }
/// Called to inform the stats module of the chunk coords for newly processing chunk
/** Called to inform the stats module of the chunk coords for newly processing chunk */
virtual bool OnNewChunk(int a_ChunkX, int a_ChunkZ) = 0;
/// Called to inform about the chunk's data offset in the file (chunk mini-header), the number of sectors it uses and the timestamp field value
/** Called to inform about the chunk's data offset in the file (chunk mini-header), the number of sectors it uses and the timestamp field value */
virtual bool OnHeader(int a_FileOffset, unsigned char a_NumSectors, int a_Timestamp) { return CALLBACK_ABORT; }
/// Called to inform of the compressed chunk data size and position in the file (offset from file start to the actual data)
/** Called to inform of the compressed chunk data size and position in the file (offset from file start to the actual data) */
virtual bool OnCompressedDataSizePos(int a_CompressedDataSize, int a_DataOffset, char a_CompressionMethod) { return CALLBACK_ABORT; }
/// Just in case you wanted to process the NBT yourself ;)
/** Just in case you wanted to process the NBT yourself ;) */
virtual bool OnDecompressedData(const char * a_DecompressedNBT, int a_DataSize) { return CALLBACK_ABORT; }
/// The chunk's NBT should specify chunk coords, these are sent here:
/** The chunk's NBT should specify chunk coords, these are sent here: */
virtual bool OnRealCoords(int a_ChunkX, int a_ChunkZ) { return CALLBACK_ABORT; }
/// The chunk contains a LastUpdate value specifying the last tick in which it was saved.
/** The chunk contains a LastUpdate value specifying the last tick in which it was saved. */
virtual bool OnLastUpdate(Int64 a_LastUpdate) { return CALLBACK_ABORT; }
virtual bool OnTerrainPopulated(bool a_Populated) { return CALLBACK_ABORT; }
@ -121,14 +121,14 @@ public:
int a_NBTTag
) { return CALLBACK_ABORT; }
/// Called for each tile tick in the chunk
/** Called for each tile tick in the chunk */
virtual bool OnTileTick(
int a_BlockType,
int a_TicksLeft,
int a_PosX, int a_PosY, int a_PosZ
) { return CALLBACK_ABORT; }
/// Called after the entire region file has been processed. No more callbacks for this region will be called. No processing by default
/** Called after the entire region file has been processed. No more callbacks for this region will be called. No processing by default */
virtual void OnRegionFinished(int a_RegionX, int a_RegionZ) {}
} ;
@ -154,10 +154,10 @@ public:
}
}
/// Descendants override this method to return the correct callback type
/** Descendants override this method to return the correct callback type */
virtual cCallback * CreateNewCallback(void) = 0;
/// cProcessor uses this method to request a new callback
/** cProcessor uses this method to request a new callback */
cCallback * GetNewCallback(void)
{
cCallback * Callback = CreateNewCallback();
@ -171,7 +171,3 @@ public:
protected:
cCallbacks m_Callbacks;
} ;

View File

@ -53,7 +53,7 @@ bool cChunkExtract::OnCompressedDataSizePos(int a_CompressedDataSize, int a_Data
// Copy data from mAnvilFile to ChunkFile:
mAnvilFile.Seek(a_DataOffset);
for (int BytesToCopy = a_CompressedDataSize; BytesToCopy > 0; )
for (int BytesToCopy = a_CompressedDataSize; BytesToCopy > 0;)
{
char Buffer[64000];
int NumBytes = std::min(BytesToCopy, (int)sizeof(Buffer));

View File

@ -29,7 +29,7 @@ protected:
int mCurChunkX; // X-coord of the chunk being processed
int mCurChunkZ; // Z-coord of the chunk being processed
/// Opens new anvil file into mAnvilFile, sets mCurAnvilX and mCurAnvilZ
/** Opens new anvil file into mAnvilFile, sets mCurAnvilX and mCurAnvilZ */
void OpenAnvilFile(int a_AnvilX, int a_AnvilZ);
// cCallback overrides:
@ -60,7 +60,3 @@ public:
protected:
AString mWorldFolder;
} ;

View File

@ -193,35 +193,35 @@ typedef unsigned short UInt16;
// Common definitions:
#define LOG(x,...) printf(x "\n", __VA_ARGS__)
#define LOG(x, ...) printf(x "\n", __VA_ARGS__)
#define LOGERROR LOG
#define LOGWARNING LOG
#define LOGINFO LOG
#define LOGWARN LOG
/// Evaluates to the number of elements in an array (compile-time!)
/** Evaluates to the number of elements in an array (compile-time!) */
#define ARRAYCOUNT(X) (sizeof(X) / sizeof(*(X)))
/// Allows arithmetic expressions like "32 KiB" (but consider using parenthesis around it, "(32 KiB)" )
/** Allows arithmetic expressions like "32 KiB" (but consider using parenthesis around it, "(32 KiB)") */
#define KiB * 1024
/// Allows arithmetic expressions like "32 MiB" (but consider using parenthesis around it, "(32 MiB)" )
/** Allows arithmetic expressions like "32 MiB" (but consider using parenthesis around it, "(32 MiB)") */
#define MiB * 1024 * 1024
/// Faster than (int)floorf((float)x / (float)div)
#define FAST_FLOOR_DIV( x, div ) ( (x) < 0 ? (((int)x / div) - 1) : ((int)x / div) )
/** Faster than (int)floorf((float)x / (float)div) */
#define FAST_FLOOR_DIV(x, div) ((x) < 0 ? (((int)x / div) - 1) : ((int)x / div))
#define TOLUA_TEMPLATE_BIND(...)
// Own version of assert() that writes failed assertions to the log for review
#ifdef _DEBUG
#define ASSERT( x ) ( !!(x) || ( LOGERROR("Assertion failed: %s, file %s, line %i", #x, __FILE__, __LINE__ ), assert(0), 0 ) )
#define ASSERT(x) (!!(x) || (LOGERROR("Assertion failed: %s, file %s, line %i", #x, __FILE__, __LINE__), assert(0), 0))
#else
#define ASSERT(x) ((void)0)
#endif
// Pretty much the same as ASSERT() but stays in Release builds
#define VERIFY( x ) ( !!(x) || ( LOGERROR("Verification failed: %s, file %s, line %i", #x, __FILE__, __LINE__ ), exit(1), 0 ) )
#define VERIFY(x) (!!(x) || (LOGERROR("Verification failed: %s, file %s, line %i", #x, __FILE__, __LINE__), exit(1), 0))
typedef unsigned char Byte;
@ -229,11 +229,11 @@ typedef unsigned char Byte;
/// A generic interface used mainly in ForEach() functions
/** A generic interface used mainly in ForEach() functions */
template <typename Type> class cItemCallback
{
public:
/// Called for each item in the internal list; return true to stop the loop, or false to continue enumerating
/** Called for each item in the internal list; return true to stop the loop, or false to continue enumerating */
virtual bool Item(Type * a_Type) = 0;
} ;
@ -255,8 +255,3 @@ T Clamp(T a_Value, T a_Min, T a_Max)
// Common headers (part 2, with macros):
#include "../../src/ChunkDef.h"
#include "../../src/BlockID.h"

View File

@ -173,7 +173,7 @@ bool cHeightBiomeMap::OnSectionsFinished(void)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// cHeightBiomeMapFactory:
cHeightBiomeMapFactory::~cHeightBiomeMapFactory()
@ -224,7 +224,3 @@ cHeightBiomeMapFactory::~cHeightBiomeMapFactory()
}
}
}

View File

@ -33,9 +33,12 @@ protected:
int m_CurrentChunkRelX; // Chunk offset from the start of the region
int m_CurrentChunkRelZ;
char m_ChunkBiomes[16 * 16]; ///< Biome-map for the current chunk
int m_ChunkHeight[16 * 16]; ///< Height-map for the current chunk
BLOCKTYPE m_BlockTypes [16 * 16 * 256]; ///< Block data for the current chunk (between OnSection() and OnSectionsFinished() )
/** Biome-map for the current chunk */
char m_ChunkBiomes[16 * 16];
/** Height-map for the current chunk */
int m_ChunkHeight[16 * 16];
/** Block data for the current chunk (between OnSection() and OnSectionsFinished()) */
BLOCKTYPE m_BlockTypes [16 * 16 * 256];
// cCallback overrides:
virtual bool OnNewRegion(int a_RegionX, int a_RegionZ) override;
@ -75,7 +78,3 @@ public:
return new cHeightBiomeMap;
}
} ;

View File

@ -1,7 +1,7 @@
// HeightMap.cpp
// Implements the cHeightMap class representing a cCallback descendant that draws a B&W map of heights for the world
// Implements the cHeightMap class representing a cCallback descendant that draws a B & W map of heights for the world
#include "Globals.h"
#include "HeightMap.h"
@ -253,7 +253,7 @@ bool cHeightMap::IsGround(BLOCKTYPE a_BlockType)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// cHeightMapFactory:
cHeightMapFactory::~cHeightMapFactory()
@ -265,7 +265,3 @@ cHeightMapFactory::~cHeightMapFactory()
}
// TODO: Join all the files into one giant image file
}

View File

@ -1,7 +1,7 @@
// HeightMap.h
// Declares the cHeightMap class representing a cCallback descendant that draws a B&W map of heights for the world
// Declares the cHeightMap class representing a cCallback descendant that draws a B & W map of heights for the world
@ -33,8 +33,10 @@ protected:
int m_CurrentRegionX;
int m_CurrentRegionZ;
bool m_IsCurrentRegionValid;
int m_Height[16 * 32 * 16 * 32]; ///< Height-map of the entire current region [x + 16 * 32 * z]
BLOCKTYPE m_BlockTypes[16 * 16 * 256]; ///< Block data of the currently processed chunk (between OnSection() and OnSectionsFinished() )
/** Height-map of the entire current region [x + 16 * 32 * z] */
int m_Height[16 * 32 * 16 * 32];
/** Block data of the currently processed chunk (between OnSection() and OnSectionsFinished()) */
BLOCKTYPE m_BlockTypes[16 * 16 * 256];
// cCallback overrides:
virtual bool OnNewChunk(int a_ChunkX, int a_ChunkZ) override;
@ -75,7 +77,3 @@ public:
}
} ;

View File

@ -213,7 +213,3 @@ void cImageComposingCallback::SaveImage(const AString & a_FileName)
f.Write(BMPHeader, sizeof(BMPHeader));
f.Write(m_ImageData, PIXEL_COUNT * 4);
}

View File

@ -42,39 +42,39 @@ public:
// New introduced overridable functions:
/// Called when a file is about to be saved, to generate the filename
/** Called when a file is about to be saved, to generate the filename */
virtual AString GetFileName(int a_RegionX, int a_RegionZ);
/// Called before the file is saved
/** Called before the file is saved */
virtual void OnBeforeImageSaved(int a_RegionX, int a_RegionZ, const AString & a_FileName) {}
/// Called after the image is saved to a file
/** Called after the image is saved to a file */
virtual void OnAfterImageSaved(int a_RegionX, int a_RegionZ, const AString & a_FileName) {}
/// Called when a new region is beginning, to erase the image data
/** Called when a new region is beginning, to erase the image data */
virtual void OnEraseImage(void);
// Functions for manipulating the image:
/// Erases the entire image with the specified color
/** Erases the entire image with the specified color */
void EraseImage(int a_Color);
/// Erases the specified chunk's portion of the image with the specified color. Note that chunk coords are relative to the current region
/** Erases the specified chunk's portion of the image with the specified color. Note that chunk coords are relative to the current region */
void EraseChunk(int a_Color, int a_RelChunkX, int a_RelChunkZ);
/// Returns the current region X coord
/** Returns the current region X coord */
int GetCurrentRegionX(void) const { return m_CurrentRegionX; }
/// Returns the current region Z coord
/** Returns the current region Z coord */
int GetCurrentRegionZ(void) const { return m_CurrentRegionZ; }
/// Sets the pixel at the specified UV coords to the specified color
/** Sets the pixel at the specified UV coords to the specified color */
void SetPixel(int a_RelU, int a_RelV, int a_Color);
/// Returns the color of the pixel at the specified UV coords; -1 if outside
/** Returns the color of the pixel at the specified UV coords; -1 if outside */
int GetPixel(int a_RelU, int a_RelV);
/// Sets a row of pixels. a_Pixels is expected to be a_CountU pixels wide. a_RelUStart + a_CountU is assumed less than image width
/** Sets a row of pixels. a_Pixels is expected to be a_CountU pixels wide. a_RelUStart + a_CountU is assumed less than image width */
void SetPixelURow(int a_RelUStart, int a_RelV, int a_CountU, int * a_Pixels);
/** "Shades" the given color based on the shade amount given
@ -84,22 +84,18 @@ public:
*/
static int ShadeColor(int a_Color, int a_Shade);
/// Mixes the two colors in the specified ratio; a_Ratio is between 0 and 256, 0 returning a_Src
/** Mixes the two colors in the specified ratio; a_Ratio is between 0 and 256, 0 returning a_Src */
static int MixColor(int a_Src, int a_Dest, int a_Ratio);
protected:
/// Prefix for the filenames, when generated by the default GetFileName() function
/** Prefix for the filenames, when generated by the default GetFileName() function */
AString m_FileNamePrefix;
/// Coords of the currently processed region
/** Coords of the currently processed region */
int m_CurrentRegionX, m_CurrentRegionZ;
/// Raw image data; 1 MiB worth of data, therefore unsuitable for stack allocation. [u + IMAGE_WIDTH * v]
/** Raw image data; 1 MiB worth of data, therefore unsuitable for stack allocation. [u + IMAGE_WIDTH * v] */
int * m_ImageData;
void SaveImage(const AString & a_FileName);
} ;

View File

@ -20,7 +20,7 @@ const int CHUNK_INFLATE_MAX = 1 MiB;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// cProcessor::cThread:
cProcessor::cThread::cThread(cCallback & a_Callback, cProcessor & a_ParentProcessor) :
@ -130,10 +130,10 @@ void cProcessor::cThread::ProcessFileData(const char * a_FileData, size_t a_Size
unsigned Location = Header[i];
unsigned Timestamp = Header[i + 1024];
if (
((Location == 0) && (Timestamp == 0)) || // Official docs' "not present"
(Location >> 8 < 2) || // Logical - no chunk can start inside the header
((Location & 0xff) == 0) || // Logical - no chunk can be zero bytes
((Location >> 8) * 4096 > a_Size) // Logical - no chunk can start at beyond the file end
((Location == 0) && (Timestamp == 0)) || // Official docs' "not present"
(Location >> 8 < 2) || // Logical - no chunk can start inside the header
((Location & 0xff) == 0) || // Logical - no chunk can be zero bytes
((Location >> 8) * 4096 > a_Size) // Logical - no chunk can start at beyond the file end
)
{
// Chunk not present in the file
@ -491,7 +491,7 @@ bool cProcessor::cThread::ProcessChunkTileTicks(int a_ChunkX, int a_ChunkZ, cPar
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// cProcessor:
cProcessor::cProcessor(void) :
@ -589,7 +589,3 @@ AString cProcessor::GetOneFileName(void)
m_FileQueue.pop_back();
return res;
}

View File

@ -77,7 +77,3 @@ protected:
/** Returns one filename from m_FileQueue, and removes the name from the queue. */
AString GetOneFileName(void);
} ;

View File

@ -10,7 +10,7 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// cSpringStats::cStats
cSpringStats::cStats::cStats(void) :
@ -41,7 +41,7 @@ void cSpringStats::cStats::Add(const cSpringStats::cStats & a_Other)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// cSpringStats:
cSpringStats::cSpringStats(void) :
@ -189,7 +189,7 @@ void cSpringStats::TestSpring(int a_RelX, int a_RelY, int a_RelZ, cSpringStats::
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// cSpringStatsFactory:
cSpringStatsFactory::~cSpringStatsFactory()
@ -273,7 +273,3 @@ void cSpringStatsFactory::SaveStatistics(const cSpringStats::cStats::SpringStats
f.Write(Line.c_str(), Line.size());
}
}

View File

@ -22,13 +22,14 @@ public:
class cStats
{
public:
/// Per-height, per-biome frequencies of springs
/** Per-height, per-biome frequencies of springs */
typedef UInt64 SpringStats[256][256];
SpringStats m_LavaSprings;
SpringStats m_WaterSprings;
UInt64 m_TotalChunks; ///< Total number of chunks that are fully processed through this callback(OnSectionsFinished())
/** Total number of chunks that are fully processed through this callback(OnSectionsFinished()) */
UInt64 m_TotalChunks;
cStats(void);
void Add(const cStats & a_Other);
@ -67,7 +68,7 @@ protected:
) override;
virtual bool OnSectionsFinished(void) override;
/// Tests the specified block, if it appears to be a spring, it is added to a_Stats
/** Tests the specified block, if it appears to be a spring, it is added to a_Stats */
void TestSpring(int a_RelX, int a_RelY, int a_RelZ, cStats::SpringStats & a_Stats);
} ;
@ -90,13 +91,9 @@ public:
void JoinResults(void);
/// Saves total per-height data (summed through biomes) for both spring types to the file
/** Saves total per-height data (summed through biomes) for both spring types to the file */
void SaveTotals(const AString & a_FileName);
/// Saves complete per-height, per-biome statistics for the springs to the file
/** Saves complete per-height, per-biome statistics for the springs to the file */
void SaveStatistics(const cSpringStats::cStats::SpringStats & a_Stats, const AString & a_FileName);
} ;

View File

@ -11,7 +11,7 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// cStatistics::cStats:
cStatistics::cStats::cStats(void) :
@ -97,7 +97,7 @@ void cStatistics::cStats::UpdateCoordsRange(int a_ChunkX, int a_ChunkZ)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// cStatistics:
cStatistics::cStatistics(void)
@ -295,7 +295,7 @@ void cStatistics::OnSpawner(cParsedNBT & a_NBT, int a_TileEntityTag)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// cStatisticsFactory:
cStatisticsFactory::cStatisticsFactory(void) :
@ -634,7 +634,3 @@ void cStatisticsFactory::SavePerHeightSpawners(void)
f.Printf("\n");
}
}

View File

@ -138,7 +138,3 @@ protected:
void SaveSpawners(void);
void SavePerHeightSpawners(void);
} ;

View File

@ -287,7 +287,3 @@ int GetNumCores(void)
} // while (Affinity > 0)
return NumCores;
}

View File

@ -91,7 +91,3 @@ int main(int argc, char * argv[])
LOGINFO("Done");
return 0;
} ;

View File

@ -11,7 +11,7 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// cRegion:
cRegion::cRegion(void) :
@ -66,7 +66,7 @@ bool cRegion::TouchesChunk(int a_ChunkX, int a_ChunkZ) const
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// cRegions:
void cRegions::Read(std::istream & a_Stream)
@ -161,7 +161,3 @@ void cRegions::AddRegion(const AStringVector & a_Split)
// Store the region
m_Regions.push_back(cRegion(Coords[0], Coords[1], Coords[2], Coords[3], Coords[4], Coords[5], ShouldZapBlocks, ShouldZapEntities));
}

View File

@ -39,20 +39,16 @@ typedef std::vector<cRegion> cRegionVector;
class cRegions
{
public:
/// Reads the list of regions from the specified stream
/** Reads the list of regions from the specified stream */
void Read(std::istream & a_Stream);
/// Returns all regions in this container
/** Returns all regions in this container */
const cRegionVector & GetAll(void) const { return m_Regions; }
protected:
cRegionVector m_Regions;
/// Adds a new region based on the contents of the split line. The split must already be the correct size
/** Adds a new region based on the contents of the split line. The split must already be the correct size */
void AddRegion(const AStringVector & a_Split);
} ;

View File

@ -15,7 +15,7 @@
/// The maximum size of an inflated chunk; raw chunk data is 192 KiB, allow 64 KiB more of entities
/** The maximum size of an inflated chunk; raw chunk data is 192 KiB, allow 64 KiB more of entities */
#define CHUNK_INFLATE_MAX 256 KiB
@ -320,7 +320,7 @@ void cZapper::ZapRegionBlocksInNBT(const cRegion & a_Region, cParsedNBT & a_NBT,
{
ZapRegionInNBTSectionNibbles(a_Region, y, (unsigned char *)(a_NBT.GetData(BlockAddTag)));
}
} // for Child - Level/Sections/[]
} // for Child - Level / Sections / []
}
@ -434,7 +434,3 @@ void cZapper::SerializeNBTTag(const cParsedNBT & a_NBT, int a_Tag, cFastNBTWrite
}
}
}

View File

@ -28,7 +28,7 @@ class cZapper
public:
cZapper(const AString & a_MCAFolder);
/// Zaps all the specified regions
/** Zaps all the specified regions */
void ZapRegions(const cRegionVector & a_Regions);
protected:
@ -39,13 +39,13 @@ protected:
AString m_MCAFolder;
/// Converts from block coords to MCA coords
/** Converts from block coords to MCA coords */
void BlockToMCA(int a_BlockX, int a_BlockZ, int & a_MCAX, int & a_MCAZ);
/// Converts from block coords to chunk coords
/** Converts from block coords to chunk coords */
void BlockToChunk(int a_BlockX, int a_BlockZ, int & a_ChunkX, int & a_ChunkZ);
/// Zaps the specified region in the MCA file with the specified MCA coords
/** Zaps the specified region in the MCA file with the specified MCA coords */
void ZapRegionInMCAFile(const cRegion & a_Region, int a_MCAX, int a_MCAZ);
/** Loads raw compressed chunk data from the specified file
@ -53,28 +53,24 @@ protected:
*/
void LoadChunkData(cFile & a_InFile, int a_ChunkHeaderValue, AString & a_ChunkData, int a_ChunkX, int a_ChunkZ);
/// Zaps the specified region in the raw (compressed) chunk data.
/** Zaps the specified region in the raw (compressed) chunk data. */
void ZapRegionInRawChunkData(const cRegion & a_Region, AString & a_ChunkData, int a_ChunkX, int a_ChunkZ);
/// Zaps the specified region in the specified NBT structure
/** Zaps the specified region in the specified NBT structure */
void ZapRegionInNBTChunk(const cRegion & a_Region, cParsedNBT & a_NBT, int a_ChunkX, int a_ChunkZ);
/// Zaps the blocks in the specified region from the specified NBT
/** Zaps the blocks in the specified region from the specified NBT */
void ZapRegionBlocksInNBT(const cRegion & a_Region, cParsedNBT & a_NBT, int a_SectionsTag);
/// Zaps the blocks in the specified bytes (types) from one vertical section (16^3 blocks) of a chunk.
/** Zaps the blocks in the specified bytes (types) from one vertical section (16^3 blocks) of a chunk. */
void ZapRegionInNBTSectionBytes(const cRegion & a_Region, int a_SectionY, unsigned char * a_BlockBytes);
/// Zaps the blocks in the specified nibbles (meta, add) from one vertical section (16^3 blocks) of a chunk.
/** Zaps the blocks in the specified nibbles (meta, add) from one vertical section (16^3 blocks) of a chunk. */
void ZapRegionInNBTSectionNibbles(const cRegion & a_Region, int a_SectionY, unsigned char * a_BlockNibbles);
/// Zaps entities in the specified region from the specified NBT
/** Zaps entities in the specified region from the specified NBT */
void ZapRegionEntitiesInNBT(const cRegion & a_Region, cParsedNBT & a_NBT, int a_EntitiesTag);
/// Serializes the NBT subtree into a writer
/** Serializes the NBT subtree into a writer */
void SerializeNBTTag(const cParsedNBT & a_NBT, int a_Tag, cFastNBTWriter & a_Writer);
} ;

View File

@ -2,6 +2,7 @@
#include "Globals.h"
#include "ChunkGenerator.h"
int main(int argc, char * argv[]) {
int main(int argc, char * argv[])
{
cChunkGenerator Generator = cChunkGenerator();
}

View File

@ -59,11 +59,11 @@ static const Color spectrumColors[] =
/** Color palette used for displaying biome groups. */
static const Color biomeGroupColors[] =
{
/* bgOcean */ {0x00, 0x00, 0x70},
/* bgDesert */ {0xfa, 0x94, 0x18},
/* bgTemperate */ {0x05, 0x66, 0x21},
/* bgMountains */ {0x60, 0x60, 0x60},
/* bgIce */ {0xa0, 0xa0, 0xff},
/* bgOcean */ {0x00, 0x00, 0x70},
/* bgDesert */ {0xfa, 0x94, 0x18},
/* bgTemperate */ {0x05, 0x66, 0x21},
/* bgMountains */ {0x60, 0x60, 0x60},
/* bgIce */ {0xa0, 0xa0, 0xff},
};
@ -110,22 +110,22 @@ biomeColorMap[] =
{ biJungleHills, { 0x2c, 0x42, 0x05 }, },
{ biJungleEdge, { 0x62, 0x8b, 0x17 }, },
{ biDeepOcean, { 0x00, 0x00, 0x30 }, },
{ biStoneBeach, { 0xa2, 0xa2, 0x84 }, },
{ biColdBeach, { 0xfa, 0xf0, 0xc0 }, },
{ biBirchForest, { 0x30, 0x74, 0x44 }, },
{ biBirchForestHills, { 0x1f, 0x5f, 0x32 }, },
{ biRoofedForest, { 0x40, 0x51, 0x1a }, },
{ biColdTaiga, { 0x31, 0x55, 0x4a }, },
{ biColdTaigaHills, { 0x59, 0x7d, 0x72 }, },
{ biMegaTaiga, { 0x59, 0x66, 0x51 }, },
{ biMegaTaigaHills, { 0x59, 0x66, 0x59 }, },
{ biExtremeHillsPlus, { 0x50, 0x70, 0x50 }, },
{ biSavanna, { 0xbd, 0xb2, 0x5f }, },
{ biSavannaPlateau, { 0xa7, 0x9d, 0x64 }, },
{ biMesa, { 0xd9, 0x45, 0x15 }, },
{ biMesaPlateauF, { 0xb0, 0x97, 0x65 }, },
{ biMesaPlateau, { 0xca, 0x8c, 0x65 }, },
{ biDeepOcean, { 0x00, 0x00, 0x30 }, },
{ biStoneBeach, { 0xa2, 0xa2, 0x84 }, },
{ biColdBeach, { 0xfa, 0xf0, 0xc0 }, },
{ biBirchForest, { 0x30, 0x74, 0x44 }, },
{ biBirchForestHills, { 0x1f, 0x5f, 0x32 }, },
{ biRoofedForest, { 0x40, 0x51, 0x1a }, },
{ biColdTaiga, { 0x31, 0x55, 0x4a }, },
{ biColdTaigaHills, { 0x59, 0x7d, 0x72 }, },
{ biMegaTaiga, { 0x59, 0x66, 0x51 }, },
{ biMegaTaigaHills, { 0x59, 0x66, 0x59 }, },
{ biExtremeHillsPlus, { 0x50, 0x70, 0x50 }, },
{ biSavanna, { 0xbd, 0xb2, 0x5f }, },
{ biSavannaPlateau, { 0xa7, 0x9d, 0x64 }, },
{ biMesa, { 0xd9, 0x45, 0x15 }, },
{ biMesaPlateauF, { 0xb0, 0x97, 0x65 }, },
{ biMesaPlateau, { 0xca, 0x8c, 0x65 }, },
// M variants:
{ biSunflowerPlains, { 0xb5, 0xdb, 0x88 }, },
@ -237,7 +237,7 @@ void initializeBiomeColors(void)
}
// Initialize per-biome:
for(size_t i = 0; i < ARRAYCOUNT(biomeColorMap); i++)
for (size_t i = 0; i < ARRAYCOUNT(biomeColorMap); i++)
{
auto & dst = biomeColors[biomeColorMap[i].biome];
const auto & src = biomeColorMap[i].color;
@ -450,7 +450,3 @@ int main(int argc, char ** argv)
log("GrownBiomeGenVisualiser finished");
return 0;
}

View File

@ -49,7 +49,7 @@ int main(int argc, char ** argv)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// cMCADefrag:
cMCADefrag::cMCADefrag(void) :
@ -122,7 +122,7 @@ AString cMCADefrag::GetNextFileName(void)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// cMCADefrag::cThread:
cMCADefrag::cThread::cThread(cMCADefrag & a_Parent) :
@ -432,7 +432,3 @@ bool cMCADefrag::cThread::CompressChunk(void)
m_CompressedChunkDataSize = static_cast<int>(CompressedSize + 1);
return true;
}

View File

@ -138,7 +138,3 @@ protected:
Returns an empty string when queue empty. */
AString GetNextFileName(void);
} ;

View File

@ -4,7 +4,3 @@
// Used for precompiled header generation
#include "Globals.h"

View File

@ -315,7 +315,3 @@ int main(int argc, char * argv[])
return 0;
}

View File

@ -19,7 +19,3 @@
#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
#endif

View File

@ -20,7 +20,7 @@ not much variance in the coords. The exact sizes and coord ranges were adapted f
/// The sizes of the interpolated noise that are calculated:
/** The sizes of the interpolated noise that are calculated: */
static const int SIZE_X = 33;
static const int SIZE_Y = 5;
static const int SIZE_Z = 5;
@ -115,7 +115,3 @@ int main(int argc, char ** argv)
return 0;
}

View File

@ -17,7 +17,7 @@
/// When defined, the following macro causes a sleep after each parsed packet (DEBUG-mode only)
/** When defined, the following macro causes a sleep after each parsed packet (DEBUG-mode only) */
// #define SLEEP_AFTER_PACKET
@ -185,7 +185,7 @@ struct sChunkMeta
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// cConnection:
cConnection::cConnection(SOCKET a_ClientSocket, cServer & a_Server) :
@ -785,7 +785,7 @@ bool cConnection::DecodeServersPackets(const char * a_Data, int a_Size)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// packet handling, client-side, initial handshake:
bool cConnection::HandleClientHandshake(void)
@ -826,7 +826,7 @@ bool cConnection::HandleClientHandshake(void)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// packet handling, client-side, login:
bool cConnection::HandleClientLoginEncryptionKeyResponse(void)
@ -852,7 +852,7 @@ bool cConnection::HandleClientLoginStart(void)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// packet handling, client-side, game:
bool cConnection::HandleClientAnimation(void)
@ -1279,7 +1279,7 @@ bool cConnection::HandleClientUnknownPacket(UInt32 a_PacketType, UInt32 a_Packet
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// packet handling, server-side, login:
bool cConnection::HandleServerLoginDisconnect(void)
@ -1355,7 +1355,7 @@ bool cConnection::HandleServerLoginSuccess(void)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// packet handling, server-side, game:
bool cConnection::HandleServerAttachEntity(void)
@ -2966,7 +2966,3 @@ void cConnection::SendEncryptionKeyResponse(const AString & a_ServerPublicKey, c
m_ServerState = csEncryptedUnderstood;
m_IsServerEncrypted = true;
}

View File

@ -25,9 +25,11 @@ class cServer;
class cConnection
{
AString m_LogNameBase; ///< Base for the log filename and all files connected to this log
/** Base for the log filename and all files connected to this log */
AString m_LogNameBase;
int m_ItemIdx; ///< Index for the next file into which item metadata should be written (ParseSlot() function)
/** Index for the next file into which item metadata should be written (ParseSlot() function) */
int m_ItemIdx;
cCriticalSection m_CSLog;
FILE * m_LogFile;
@ -71,7 +73,7 @@ protected:
AString m_ServerEncryptionBuffer; // Buffer for the data to be sent to the server once encryption is established
/// Set to true when PACKET_PING is received from the client; will cause special parsing for server kick
/** Set to true when PACKET_PING is received from the client; will cause special parsing for server kick */
bool m_HasClientPinged;
/*
@ -81,43 +83,43 @@ protected:
2: login
3: game
*/
/// State the to-server protocol is in (as defined by the initial handshake / login), -1 if no initial handshake received yet
/** State the to-server protocol is in (as defined by the initial handshake / login), -1 if no initial handshake received yet */
int m_ServerProtocolState;
/// State the to-client protocol is in (as defined by the initial handshake / login), -1 if no initial handshake received yet
/** State the to-client protocol is in (as defined by the initial handshake / login), -1 if no initial handshake received yet */
int m_ClientProtocolState;
/// True if the server connection has provided encryption keys
/** True if the server connection has provided encryption keys */
bool m_IsServerEncrypted;
bool ConnectToServer(void);
/// Relays data from server to client; returns false if connection aborted
/** Relays data from server to client; returns false if connection aborted */
bool RelayFromServer(void);
/// Relays data from client to server; returns false if connection aborted
/** Relays data from client to server; returns false if connection aborted */
bool RelayFromClient(void);
/// Returns the time relative to the first call of this function, in the fractional seconds elapsed
/** Returns the time relative to the first call of this function, in the fractional seconds elapsed */
double GetRelativeTime(void);
/// Sends data to the specified socket. If sending fails, prints a fail message using a_Peer and returns false.
/** Sends data to the specified socket. If sending fails, prints a fail message using a_Peer and returns false. */
bool SendData(SOCKET a_Socket, const char * a_Data, size_t a_Size, const char * a_Peer);
/// Sends data to the specified socket. If sending fails, prints a fail message using a_Peer and returns false.
/** Sends data to the specified socket. If sending fails, prints a fail message using a_Peer and returns false. */
bool SendData(SOCKET a_Socket, cByteBuffer & a_Data, const char * a_Peer);
/// Sends data to the specfied socket, after encrypting it using a_Encryptor. If sending fails, prints a fail message using a_Peer and returns false
/** Sends data to the specfied socket, after encrypting it using a_Encryptor. If sending fails, prints a fail message using a_Peer and returns false */
bool SendEncryptedData(SOCKET a_Socket, cAesCfb128Encryptor & a_Encryptor, const char * a_Data, size_t a_Size, const char * a_Peer);
/// Sends data to the specfied socket, after encrypting it using a_Encryptor. If sending fails, prints a fail message using a_Peer and returns false
/** Sends data to the specfied socket, after encrypting it using a_Encryptor. If sending fails, prints a fail message using a_Peer and returns false */
bool SendEncryptedData(SOCKET a_Socket, cAesCfb128Encryptor & a_Encryptor, cByteBuffer & a_Data, const char * a_Peer);
/// Decodes packets coming from the client, sends appropriate counterparts to the server; returns false if the connection is to be dropped
/** Decodes packets coming from the client, sends appropriate counterparts to the server; returns false if the connection is to be dropped */
bool DecodeClientsPackets(const char * a_Data, int a_Size);
/// Decodes packets coming from the server, sends appropriate counterparts to the client; returns false if the connection is to be dropped
/** Decodes packets coming from the server, sends appropriate counterparts to the client; returns false if the connection is to be dropped */
bool DecodeServersPackets(const char * a_Data, int a_Size);
// Packet handling, client-side, initial:
@ -224,22 +226,18 @@ protected:
bool HandleServerUnknownPacket(UInt32 a_PacketType, UInt32 a_PacketLen, UInt32 a_PacketReadSoFar);
/// Parses the slot data in a_Buffer into item description; returns true if successful, false if not enough data
/** Parses the slot data in a_Buffer into item description; returns true if successful, false if not enough data */
bool ParseSlot(cByteBuffer & a_Buffer, AString & a_ItemDesc);
/// Parses the metadata in a_Buffer into raw metadata in an AString; returns true if successful, false if not enough data
/** Parses the metadata in a_Buffer into raw metadata in an AString; returns true if successful, false if not enough data */
bool ParseMetadata(cByteBuffer & a_Buffer, AString & a_Metadata);
/// Logs the contents of the metadata in the AString, using Log(). Assumes a_Metadata is valid (parsed by ParseMetadata()). The log is indented by a_IndentCount spaces
/** Logs the contents of the metadata in the AString, using Log(). Assumes a_Metadata is valid (parsed by ParseMetadata()). The log is indented by a_IndentCount spaces */
void LogMetadata(const AString & a_Metadata, size_t a_IndentCount);
/// Send EKResp to the server:
/** Send EKResp to the server: */
void SendEncryptionKeyResponse(const AString & a_ServerPublicKey, const AString & a_Nonce);
/// Starts client encryption based on the parameters received
/** Starts client encryption based on the parameters received */
void StartClientEncryption(const AString & a_EncryptedSecret, const AString & a_EncryptedNonce);
} ;

View File

@ -195,14 +195,14 @@ typedef unsigned char Byte;
// Common definitions:
/// Evaluates to the number of elements in an array (compile-time!)
/** Evaluates to the number of elements in an array (compile-time!) */
#define ARRAYCOUNT(X) (sizeof(X) / sizeof(*(X)))
/// Allows arithmetic expressions like "32 KiB" (but consider using parenthesis around it, "(32 KiB)" )
/* Allows arithmetic expressions like "32 KiB" (but consider using parenthesis around it, "(32 KiB)") */
#define KiB * 1024
/// Faster than (int)floorf((float)x / (float)div)
#define FAST_FLOOR_DIV( x, div ) ( (x) < 0 ? (((int)x / div) - 1) : ((int)x / div) )
/* Faster than (int)floorf((float)x / (float)div) */
#define FAST_FLOOR_DIV(x, div) ((x) < 0 ? (((int)x / div) - 1) : ((int)x / div))
// Own version of assert() that writes failed assertions to the log for review
#ifdef NDEBUG
@ -212,7 +212,7 @@ typedef unsigned char Byte;
#endif
// Pretty much the same as ASSERT() but stays in Release builds
#define VERIFY( x ) ( !!(x) || ( LOGERROR("Verification failed: %s, file %s, line %i", #x, __FILE__, __LINE__ ), exit(1), 0 ) )
#define VERIFY(x) (!!(x) || (LOGERROR("Verification failed: %s, file %s, line %i", #x, __FILE__, __LINE__), exit(1), 0))
// C++11 has std::shared_ptr in <memory>, included earlier
#define SharedPtr std::shared_ptr
@ -222,10 +222,10 @@ typedef unsigned char Byte;
/// A generic interface used mainly in ForEach() functions
/* A generic interface used mainly in ForEach() functions */
template <typename Type> class cItemCallback
{
public:
/// Called for each item in the internal list; return true to stop the loop, or false to continue enumerating
/* Called for each item in the internal list; return true to stop the loop, or false to continue enumerating */
virtual bool Item(Type * a_Type) = 0;
} ;

View File

@ -57,7 +57,3 @@ int main(int argc, char ** argv)
return 0;
}

View File

@ -103,7 +103,3 @@ void cServer::Run(void)
LOGINFO("Client disconnected. Ready for another connection.");
}
}

View File

@ -34,7 +34,3 @@ public:
UInt16 GetConnectPort(void) const { return m_ConnectPort; }
} ;

View File

@ -17,7 +17,7 @@ static const int DELTA_STEP = 120; // The normal per-notch wheel delta
/** Map for converting biome values to colors. Initialized from biomeColors[]. */
static uchar biomeToColor[256 * 4];
/** Map for converting biome values to colors. Used to initialize biomeToColor[].*/
/** Map for converting biome values to colors. Used to initialize biomeToColor[]. */
static struct
{
EMCSBiome m_Biome;
@ -49,22 +49,22 @@ static struct
{ biJungleHills, { 0x2c, 0x42, 0x05 }, },
{ biJungleEdge, { 0x62, 0x8b, 0x17 }, },
{ biDeepOcean, { 0x00, 0x00, 0x30 }, },
{ biStoneBeach, { 0xa2, 0xa2, 0x84 }, },
{ biColdBeach, { 0xfa, 0xf0, 0xc0 }, },
{ biBirchForest, { 0x30, 0x74, 0x44 }, },
{ biBirchForestHills, { 0x1f, 0x5f, 0x32 }, },
{ biRoofedForest, { 0x40, 0x51, 0x1a }, },
{ biColdTaiga, { 0x31, 0x55, 0x4a }, },
{ biColdTaigaHills, { 0x59, 0x7d, 0x72 }, },
{ biMegaTaiga, { 0x59, 0x66, 0x51 }, },
{ biMegaTaigaHills, { 0x59, 0x66, 0x59 }, },
{ biExtremeHillsPlus, { 0x50, 0x70, 0x50 }, },
{ biSavanna, { 0xbd, 0xb2, 0x5f }, },
{ biSavannaPlateau, { 0xa7, 0x9d, 0x64 }, },
{ biMesa, { 0xd9, 0x45, 0x15 }, },
{ biMesaPlateauF, { 0xb0, 0x97, 0x65 }, },
{ biMesaPlateau, { 0xca, 0x8c, 0x65 }, },
{ biDeepOcean, { 0x00, 0x00, 0x30 }, },
{ biStoneBeach, { 0xa2, 0xa2, 0x84 }, },
{ biColdBeach, { 0xfa, 0xf0, 0xc0 }, },
{ biBirchForest, { 0x30, 0x74, 0x44 }, },
{ biBirchForestHills, { 0x1f, 0x5f, 0x32 }, },
{ biRoofedForest, { 0x40, 0x51, 0x1a }, },
{ biColdTaiga, { 0x31, 0x55, 0x4a }, },
{ biColdTaigaHills, { 0x59, 0x7d, 0x72 }, },
{ biMegaTaiga, { 0x59, 0x66, 0x51 }, },
{ biMegaTaigaHills, { 0x59, 0x66, 0x59 }, },
{ biExtremeHillsPlus, { 0x50, 0x70, 0x50 }, },
{ biSavanna, { 0xbd, 0xb2, 0x5f }, },
{ biSavannaPlateau, { 0xa7, 0x9d, 0x64 }, },
{ biMesa, { 0xd9, 0x45, 0x15 }, },
{ biMesaPlateauF, { 0xb0, 0x97, 0x65 }, },
{ biMesaPlateau, { 0xca, 0x8c, 0x65 }, },
// M variants:
{ biSunflowerPlains, { 0xb5, 0xdb, 0x88 }, },
@ -307,8 +307,8 @@ void BiomeView::drawChunk(int a_ChunkX, int a_ChunkZ)
// which need to be shifted to account for panning inside that chunk
centerx -= (m_X - centerchunkx * 16) * m_Zoom;
centery -= (m_Z - centerchunkz * 16) * m_Zoom;
// centerx,y now points to the top left corner of the center chunk
// so now calculate our x,y in relation
// centerx, centery now points to the top left corner of the center chunk
// so now calculate our x, y in relation
double chunksize = 16 * m_Zoom;
centerx += (a_ChunkX - centerchunkx) * chunksize;
centery += (a_ChunkZ - centerchunkz) * chunksize;
@ -550,7 +550,3 @@ void BiomeView::keyPressEvent(QKeyEvent * a_Event)
}
}
}

View File

@ -15,9 +15,9 @@
// 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
#pragma warning(3 : 4245) // Conversion from 'type1' to 'type2', signed / unsigned mismatch
#pragma warning(3 : 4310) // Cast truncates constant value
#pragma warning(3 : 4389) // Signed/unsigned mismatch
#pragma warning(3 : 4389) // Signed / unsigned mismatch
#pragma warning(3 : 4505) // Unreferenced local function has been removed
#pragma warning(3 : 4701) // Potentially unitialized local variable used
#pragma warning(3 : 4702) // Unreachable code
@ -254,9 +254,9 @@ template class SizeChecker<UInt16, 2>;
#include "src/Logger.h"
#else
// Logging functions
void inline LOGERROR(const char* a_Format, ...) FORMATSTRING(1, 2);
void inline LOGERROR(const char * a_Format, ...) FORMATSTRING(1, 2);
void inline LOGERROR(const char* a_Format, ...)
void inline LOGERROR(const char * a_Format, ...)
{
va_list argList;
va_start(argList, a_Format);
@ -271,14 +271,15 @@ void inline LOGERROR(const char* a_Format, ...)
// Common definitions:
/// Evaluates to the number of elements in an array (compile-time!)
/** Evaluates to the number of elements in an array (compile-time!) */
#define ARRAYCOUNT(X) (sizeof(X) / sizeof(*(X)))
/// Allows arithmetic expressions like "32 KiB" (but consider using parenthesis around it, "(32 KiB)")
/** Allows arithmetic expressions like "32 KiB" (but consider using parenthesis
around it, "(32 KiB)") */
#define KiB * 1024
#define MiB * 1024 * 1024
/// Faster than (int)floorf((float)x / (float)div)
/** Faster than (int)floorf((float)x / (float)div) */
#define FAST_FLOOR_DIV( x, div) (((x) - (((x) < 0) ? ((div) - 1) : 0)) / (div))
// Own version of assert() that writes failed assertions to the log for review

View File

@ -218,14 +218,14 @@ typedef unsigned char Byte;
// Common definitions:
/// Evaluates to the number of elements in an array (compile-time!)
/** Evaluates to the number of elements in an array (compile-time!) */
#define ARRAYCOUNT(X) (sizeof(X) / sizeof(*(X)))
/// Allows arithmetic expressions like "32 KiB" (but consider using parenthesis around it, "(32 KiB)" )
/** Allows arithmetic expressions like "32 KiB" (but consider using parenthesis around it, "(32 KiB)") */
#define KiB * 1024
/// Faster than (int)floorf((float)x / (float)div)
#define FAST_FLOOR_DIV( x, div ) ( (x) < 0 ? (((int)x / div) - 1) : ((int)x / div) )
/** Faster than (int)floorf((float)x / (float)div) */
#define FAST_FLOOR_DIV(x, div) ((x) < 0 ? (((int)x / div) - 1) : ((int)x / div))
// Own version of assert() that writes failed assertions to the log for review
#ifdef NDEBUG
@ -235,4 +235,4 @@ typedef unsigned char Byte;
#endif
// Pretty much the same as ASSERT() but stays in Release builds
#define VERIFY( x ) ( !!(x) || ( LOGERROR("Verification failed: %s, file %s, line %i", #x, __FILE__, __LINE__ ), exit(1), 0 ) )
#define VERIFY(x) (!!(x) || (LOGERROR("Verification failed: %s, file %s, line %i", #x, __FILE__, __LINE__), exit(1), 0))

View File

@ -18,7 +18,7 @@ bool g_IsVerbose = false;
/// This class can read and write RCON packets to / from a connected socket
/** This class can read and write RCON packets to / from a connected socket */
class cRCONPacketizer
{
public:
@ -30,26 +30,26 @@ public:
cRCONPacketizer(cSocket & a_Socket);
/// Sends the packet to the socket and waits until the response is received.
/// Returns true if response successfully received, false if the client disconnected or protocol error.
/// Dumps the reply payload to stdout.
/** Sends the packet to the socket and waits until the response is received.
Returns true if response successfully received, false if the client disconnected or protocol error.
Dumps the reply payload to stdout. */
bool SendPacket(int a_PacketType, const AString & a_PacketPayload);
protected:
/// The socket to use for reading incoming data and writing outgoing data:
/** The socket to use for reading incoming data and writing outgoing data: */
cSocket & m_Socket;
/// The RequestID of the packet that is being sent. Incremented when the reply is received
/** The RequestID of the packet that is being sent. Incremented when the reply is received */
int m_RequestID;
/// Receives the full response and dumps its payload to stdout.
/// Returns true if successful, false if the client disconnected or protocol error.
/** Receives the full response and dumps its payload to stdout.
Returns true if successful, false if the client disconnected or protocol error. */
bool ReceiveResponse(void);
/// Parses the received response packet and dumps its payload to stdout.
/// Returns true if successful, false on protocol error
/// Assumes that the packet length has already been read from the packet
/// If the packet is successfully parsed, increments m_RequestID
/** Parses the received response packet and dumps its payload to stdout.
Returns true if successful, false on protocol error
Assumes that the packet length has already been read from the packet
If the packet is successfully parsed, increments m_RequestID */
bool ParsePacket(cByteBuffer & a_Buffer, int a_PacketLength);
} ;
@ -195,7 +195,7 @@ bool cRCONPacketizer::ParsePacket(cByteBuffer & a_Buffer, int a_PacketLength)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// main:
int RealMain(int argc, char * argv[])
@ -327,7 +327,3 @@ int main(int argc, char * argv[])
int res = RealMain(argc, argv);
return res;
}

View File

@ -83,10 +83,10 @@
// Common definitions:
/// Evaluates to the number of elements in an array (compile-time!)
/** Evaluates to the number of elements in an array (compile-time!) */
#define ARRAYCOUNT(X) (sizeof(X) / sizeof(*(X)))
/// Allows arithmetic expressions like "32 KiB" (but consider using parenthesis around it, "(32 KiB)" )
/** Allows arithmetic expressions like "32 KiB" (but consider using parenthesis around it, "(32 KiB)") */
#define KiB * 1024
#define MiB * 1024 * 1024

View File

@ -169,7 +169,7 @@ bool ParsePackageFile(const AString & a_FileName, AStrings & a_CFiles, AStrings
/// Processes the specified input header file into the output file
/** Processes the specified input header file into the output file */
void ProcessCFile(const AString & a_CFileIn, const AString & a_CFileOut)
{
cProcessor p(a_CFileOut);
@ -216,7 +216,3 @@ int main(int argc, char * argv[])
return 0;
}