Fix style of Tools
This commit is contained in:
parent
aff140365d
commit
1926181cb7
@ -66,7 +66,3 @@ int main(int argc, char * argv[])
|
|||||||
|
|
||||||
LOG("Done");
|
LOG("Done");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ void cBiomeMap::StartNewRegion(int a_RegionX, int a_RegionZ)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// cBiomeMapFactory:
|
// cBiomeMapFactory:
|
||||||
|
|
||||||
cBiomeMapFactory::~cBiomeMapFactory()
|
cBiomeMapFactory::~cBiomeMapFactory()
|
||||||
@ -135,7 +135,3 @@ cBiomeMapFactory::~cBiomeMapFactory()
|
|||||||
}
|
}
|
||||||
// TODO: Join all the files into one giant image file
|
// TODO: Join all the files into one giant image file
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class cBiomeMap :
|
|||||||
public:
|
public:
|
||||||
cBiomeMap(void);
|
cBiomeMap(void);
|
||||||
|
|
||||||
/// Saves the last region that it was processing
|
/** Saves the last region that it was processing */
|
||||||
void Finish(void);
|
void Finish(void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -63,7 +63,3 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,25 +40,25 @@ public:
|
|||||||
|
|
||||||
virtual ~cCallback() {} // Force a virtual destructor in each descendant
|
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; }
|
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;
|
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; }
|
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; }
|
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; }
|
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; }
|
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 OnLastUpdate(Int64 a_LastUpdate) { return CALLBACK_ABORT; }
|
||||||
|
|
||||||
virtual bool OnTerrainPopulated(bool a_Populated) { return CALLBACK_ABORT; }
|
virtual bool OnTerrainPopulated(bool a_Populated) { return CALLBACK_ABORT; }
|
||||||
@ -121,14 +121,14 @@ public:
|
|||||||
int a_NBTTag
|
int a_NBTTag
|
||||||
) { return CALLBACK_ABORT; }
|
) { return CALLBACK_ABORT; }
|
||||||
|
|
||||||
/// Called for each tile tick in the chunk
|
/** Called for each tile tick in the chunk */
|
||||||
virtual bool OnTileTick(
|
virtual bool OnTileTick(
|
||||||
int a_BlockType,
|
int a_BlockType,
|
||||||
int a_TicksLeft,
|
int a_TicksLeft,
|
||||||
int a_PosX, int a_PosY, int a_PosZ
|
int a_PosX, int a_PosY, int a_PosZ
|
||||||
) { return CALLBACK_ABORT; }
|
) { 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) {}
|
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;
|
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 * GetNewCallback(void)
|
||||||
{
|
{
|
||||||
cCallback * Callback = CreateNewCallback();
|
cCallback * Callback = CreateNewCallback();
|
||||||
@ -171,7 +171,3 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
cCallbacks m_Callbacks;
|
cCallbacks m_Callbacks;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ bool cChunkExtract::OnCompressedDataSizePos(int a_CompressedDataSize, int a_Data
|
|||||||
|
|
||||||
// Copy data from mAnvilFile to ChunkFile:
|
// Copy data from mAnvilFile to ChunkFile:
|
||||||
mAnvilFile.Seek(a_DataOffset);
|
mAnvilFile.Seek(a_DataOffset);
|
||||||
for (int BytesToCopy = a_CompressedDataSize; BytesToCopy > 0; )
|
for (int BytesToCopy = a_CompressedDataSize; BytesToCopy > 0;)
|
||||||
{
|
{
|
||||||
char Buffer[64000];
|
char Buffer[64000];
|
||||||
int NumBytes = std::min(BytesToCopy, (int)sizeof(Buffer));
|
int NumBytes = std::min(BytesToCopy, (int)sizeof(Buffer));
|
||||||
|
@ -29,7 +29,7 @@ protected:
|
|||||||
int mCurChunkX; // X-coord of the chunk being processed
|
int mCurChunkX; // X-coord of the chunk being processed
|
||||||
int mCurChunkZ; // Z-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);
|
void OpenAnvilFile(int a_AnvilX, int a_AnvilZ);
|
||||||
|
|
||||||
// cCallback overrides:
|
// cCallback overrides:
|
||||||
@ -60,7 +60,3 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
AString mWorldFolder;
|
AString mWorldFolder;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -193,35 +193,35 @@ typedef unsigned short UInt16;
|
|||||||
|
|
||||||
// Common definitions:
|
// Common definitions:
|
||||||
|
|
||||||
#define LOG(x,...) printf(x "\n", __VA_ARGS__)
|
#define LOG(x, ...) printf(x "\n", __VA_ARGS__)
|
||||||
#define LOGERROR LOG
|
#define LOGERROR LOG
|
||||||
#define LOGWARNING LOG
|
#define LOGWARNING LOG
|
||||||
#define LOGINFO LOG
|
#define LOGINFO LOG
|
||||||
#define LOGWARN 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)))
|
#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 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
|
#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) < 0 ? (((int)x / div) - 1) : ((int)x / div) )
|
#define FAST_FLOOR_DIV(x, div) ((x) < 0 ? (((int)x / div) - 1) : ((int)x / div))
|
||||||
|
|
||||||
#define TOLUA_TEMPLATE_BIND(...)
|
#define TOLUA_TEMPLATE_BIND(...)
|
||||||
|
|
||||||
// Own version of assert() that writes failed assertions to the log for review
|
// Own version of assert() that writes failed assertions to the log for review
|
||||||
#ifdef _DEBUG
|
#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
|
#else
|
||||||
#define ASSERT(x) ((void)0)
|
#define ASSERT(x) ((void)0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Pretty much the same as ASSERT() but stays in Release builds
|
// 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;
|
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
|
template <typename Type> class cItemCallback
|
||||||
{
|
{
|
||||||
public:
|
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;
|
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):
|
// Common headers (part 2, with macros):
|
||||||
#include "../../src/ChunkDef.h"
|
#include "../../src/ChunkDef.h"
|
||||||
#include "../../src/BlockID.h"
|
#include "../../src/BlockID.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ bool cHeightBiomeMap::OnSectionsFinished(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// cHeightBiomeMapFactory:
|
// cHeightBiomeMapFactory:
|
||||||
|
|
||||||
cHeightBiomeMapFactory::~cHeightBiomeMapFactory()
|
cHeightBiomeMapFactory::~cHeightBiomeMapFactory()
|
||||||
@ -224,7 +224,3 @@ cHeightBiomeMapFactory::~cHeightBiomeMapFactory()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,9 +33,12 @@ protected:
|
|||||||
int m_CurrentChunkRelX; // Chunk offset from the start of the region
|
int m_CurrentChunkRelX; // Chunk offset from the start of the region
|
||||||
int m_CurrentChunkRelZ;
|
int m_CurrentChunkRelZ;
|
||||||
|
|
||||||
char m_ChunkBiomes[16 * 16]; ///< Biome-map for the current chunk
|
/** Biome-map for the current chunk */
|
||||||
int m_ChunkHeight[16 * 16]; ///< Height-map for the current chunk
|
char m_ChunkBiomes[16 * 16];
|
||||||
BLOCKTYPE m_BlockTypes [16 * 16 * 256]; ///< Block data for the current chunk (between OnSection() and OnSectionsFinished() )
|
/** 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:
|
// cCallback overrides:
|
||||||
virtual bool OnNewRegion(int a_RegionX, int a_RegionZ) override;
|
virtual bool OnNewRegion(int a_RegionX, int a_RegionZ) override;
|
||||||
@ -75,7 +78,3 @@ public:
|
|||||||
return new cHeightBiomeMap;
|
return new cHeightBiomeMap;
|
||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
// HeightMap.cpp
|
// 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 "Globals.h"
|
||||||
#include "HeightMap.h"
|
#include "HeightMap.h"
|
||||||
@ -253,7 +253,7 @@ bool cHeightMap::IsGround(BLOCKTYPE a_BlockType)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// cHeightMapFactory:
|
// cHeightMapFactory:
|
||||||
|
|
||||||
cHeightMapFactory::~cHeightMapFactory()
|
cHeightMapFactory::~cHeightMapFactory()
|
||||||
@ -265,7 +265,3 @@ cHeightMapFactory::~cHeightMapFactory()
|
|||||||
}
|
}
|
||||||
// TODO: Join all the files into one giant image file
|
// TODO: Join all the files into one giant image file
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
// HeightMap.h
|
// 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_CurrentRegionX;
|
||||||
int m_CurrentRegionZ;
|
int m_CurrentRegionZ;
|
||||||
bool m_IsCurrentRegionValid;
|
bool m_IsCurrentRegionValid;
|
||||||
int m_Height[16 * 32 * 16 * 32]; ///< Height-map of the entire current region [x + 16 * 32 * z]
|
/** 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() )
|
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:
|
// cCallback overrides:
|
||||||
virtual bool OnNewChunk(int a_ChunkX, int a_ChunkZ) override;
|
virtual bool OnNewChunk(int a_ChunkX, int a_ChunkZ) override;
|
||||||
@ -75,7 +77,3 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -213,7 +213,3 @@ void cImageComposingCallback::SaveImage(const AString & a_FileName)
|
|||||||
f.Write(BMPHeader, sizeof(BMPHeader));
|
f.Write(BMPHeader, sizeof(BMPHeader));
|
||||||
f.Write(m_ImageData, PIXEL_COUNT * 4);
|
f.Write(m_ImageData, PIXEL_COUNT * 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,39 +42,39 @@ public:
|
|||||||
|
|
||||||
// New introduced overridable functions:
|
// 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);
|
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) {}
|
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) {}
|
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);
|
virtual void OnEraseImage(void);
|
||||||
|
|
||||||
// Functions for manipulating the image:
|
// 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);
|
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);
|
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; }
|
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; }
|
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);
|
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);
|
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);
|
void SetPixelURow(int a_RelUStart, int a_RelV, int a_CountU, int * a_Pixels);
|
||||||
|
|
||||||
/** "Shades" the given color based on the shade amount given
|
/** "Shades" the given color based on the shade amount given
|
||||||
@ -84,22 +84,18 @@ public:
|
|||||||
*/
|
*/
|
||||||
static int ShadeColor(int a_Color, int a_Shade);
|
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);
|
static int MixColor(int a_Src, int a_Dest, int a_Ratio);
|
||||||
|
|
||||||
protected:
|
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;
|
AString m_FileNamePrefix;
|
||||||
|
|
||||||
/// Coords of the currently processed region
|
/** Coords of the currently processed region */
|
||||||
int m_CurrentRegionX, m_CurrentRegionZ;
|
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;
|
int * m_ImageData;
|
||||||
|
|
||||||
void SaveImage(const AString & a_FileName);
|
void SaveImage(const AString & a_FileName);
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ const int CHUNK_INFLATE_MAX = 1 MiB;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// cProcessor::cThread:
|
// cProcessor::cThread:
|
||||||
|
|
||||||
cProcessor::cThread::cThread(cCallback & a_Callback, cProcessor & a_ParentProcessor) :
|
cProcessor::cThread::cThread(cCallback & a_Callback, cProcessor & a_ParentProcessor) :
|
||||||
@ -491,7 +491,7 @@ bool cProcessor::cThread::ProcessChunkTileTicks(int a_ChunkX, int a_ChunkZ, cPar
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// cProcessor:
|
// cProcessor:
|
||||||
|
|
||||||
cProcessor::cProcessor(void) :
|
cProcessor::cProcessor(void) :
|
||||||
@ -589,7 +589,3 @@ AString cProcessor::GetOneFileName(void)
|
|||||||
m_FileQueue.pop_back();
|
m_FileQueue.pop_back();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,7 +77,3 @@ protected:
|
|||||||
/** Returns one filename from m_FileQueue, and removes the name from the queue. */
|
/** Returns one filename from m_FileQueue, and removes the name from the queue. */
|
||||||
AString GetOneFileName(void);
|
AString GetOneFileName(void);
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// cSpringStats::cStats
|
// cSpringStats::cStats
|
||||||
|
|
||||||
cSpringStats::cStats::cStats(void) :
|
cSpringStats::cStats::cStats(void) :
|
||||||
@ -41,7 +41,7 @@ void cSpringStats::cStats::Add(const cSpringStats::cStats & a_Other)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// cSpringStats:
|
// cSpringStats:
|
||||||
|
|
||||||
cSpringStats::cSpringStats(void) :
|
cSpringStats::cSpringStats(void) :
|
||||||
@ -189,7 +189,7 @@ void cSpringStats::TestSpring(int a_RelX, int a_RelY, int a_RelZ, cSpringStats::
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// cSpringStatsFactory:
|
// cSpringStatsFactory:
|
||||||
|
|
||||||
cSpringStatsFactory::~cSpringStatsFactory()
|
cSpringStatsFactory::~cSpringStatsFactory()
|
||||||
@ -273,7 +273,3 @@ void cSpringStatsFactory::SaveStatistics(const cSpringStats::cStats::SpringStats
|
|||||||
f.Write(Line.c_str(), Line.size());
|
f.Write(Line.c_str(), Line.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,13 +22,14 @@ public:
|
|||||||
class cStats
|
class cStats
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// Per-height, per-biome frequencies of springs
|
/** Per-height, per-biome frequencies of springs */
|
||||||
typedef UInt64 SpringStats[256][256];
|
typedef UInt64 SpringStats[256][256];
|
||||||
|
|
||||||
SpringStats m_LavaSprings;
|
SpringStats m_LavaSprings;
|
||||||
SpringStats m_WaterSprings;
|
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);
|
cStats(void);
|
||||||
void Add(const cStats & a_Other);
|
void Add(const cStats & a_Other);
|
||||||
@ -67,7 +68,7 @@ protected:
|
|||||||
) override;
|
) override;
|
||||||
virtual bool OnSectionsFinished(void) 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);
|
void TestSpring(int a_RelX, int a_RelY, int a_RelZ, cStats::SpringStats & a_Stats);
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
@ -90,13 +91,9 @@ public:
|
|||||||
|
|
||||||
void JoinResults(void);
|
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);
|
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);
|
void SaveStatistics(const cSpringStats::cStats::SpringStats & a_Stats, const AString & a_FileName);
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// cStatistics::cStats:
|
// cStatistics::cStats:
|
||||||
|
|
||||||
cStatistics::cStats::cStats(void) :
|
cStatistics::cStats::cStats(void) :
|
||||||
@ -97,7 +97,7 @@ void cStatistics::cStats::UpdateCoordsRange(int a_ChunkX, int a_ChunkZ)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// cStatistics:
|
// cStatistics:
|
||||||
|
|
||||||
cStatistics::cStatistics(void)
|
cStatistics::cStatistics(void)
|
||||||
@ -295,7 +295,7 @@ void cStatistics::OnSpawner(cParsedNBT & a_NBT, int a_TileEntityTag)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// cStatisticsFactory:
|
// cStatisticsFactory:
|
||||||
|
|
||||||
cStatisticsFactory::cStatisticsFactory(void) :
|
cStatisticsFactory::cStatisticsFactory(void) :
|
||||||
@ -634,7 +634,3 @@ void cStatisticsFactory::SavePerHeightSpawners(void)
|
|||||||
f.Printf("\n");
|
f.Printf("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -138,7 +138,3 @@ protected:
|
|||||||
void SaveSpawners(void);
|
void SaveSpawners(void);
|
||||||
void SavePerHeightSpawners(void);
|
void SavePerHeightSpawners(void);
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -287,7 +287,3 @@ int GetNumCores(void)
|
|||||||
} // while (Affinity > 0)
|
} // while (Affinity > 0)
|
||||||
return NumCores;
|
return NumCores;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,7 +91,3 @@ int main(int argc, char * argv[])
|
|||||||
LOGINFO("Done");
|
LOGINFO("Done");
|
||||||
return 0;
|
return 0;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// cRegion:
|
// cRegion:
|
||||||
|
|
||||||
cRegion::cRegion(void) :
|
cRegion::cRegion(void) :
|
||||||
@ -66,7 +66,7 @@ bool cRegion::TouchesChunk(int a_ChunkX, int a_ChunkZ) const
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// cRegions:
|
// cRegions:
|
||||||
|
|
||||||
void cRegions::Read(std::istream & a_Stream)
|
void cRegions::Read(std::istream & a_Stream)
|
||||||
@ -161,7 +161,3 @@ void cRegions::AddRegion(const AStringVector & a_Split)
|
|||||||
// Store the region
|
// Store the region
|
||||||
m_Regions.push_back(cRegion(Coords[0], Coords[1], Coords[2], Coords[3], Coords[4], Coords[5], ShouldZapBlocks, ShouldZapEntities));
|
m_Regions.push_back(cRegion(Coords[0], Coords[1], Coords[2], Coords[3], Coords[4], Coords[5], ShouldZapBlocks, ShouldZapEntities));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,20 +39,16 @@ typedef std::vector<cRegion> cRegionVector;
|
|||||||
class cRegions
|
class cRegions
|
||||||
{
|
{
|
||||||
public:
|
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);
|
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; }
|
const cRegionVector & GetAll(void) const { return m_Regions; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
cRegionVector m_Regions;
|
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);
|
void AddRegion(const AStringVector & a_Split);
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -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
|
#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)));
|
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
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class cZapper
|
|||||||
public:
|
public:
|
||||||
cZapper(const AString & a_MCAFolder);
|
cZapper(const AString & a_MCAFolder);
|
||||||
|
|
||||||
/// Zaps all the specified regions
|
/** Zaps all the specified regions */
|
||||||
void ZapRegions(const cRegionVector & a_Regions);
|
void ZapRegions(const cRegionVector & a_Regions);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -39,13 +39,13 @@ protected:
|
|||||||
|
|
||||||
AString m_MCAFolder;
|
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);
|
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);
|
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);
|
void ZapRegionInMCAFile(const cRegion & a_Region, int a_MCAX, int a_MCAZ);
|
||||||
|
|
||||||
/** Loads raw compressed chunk data from the specified file
|
/** 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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
void SerializeNBTTag(const cParsedNBT & a_NBT, int a_Tag, cFastNBTWriter & a_Writer);
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "ChunkGenerator.h"
|
#include "ChunkGenerator.h"
|
||||||
|
|
||||||
int main(int argc, char * argv[]) {
|
int main(int argc, char * argv[])
|
||||||
|
{
|
||||||
cChunkGenerator Generator = cChunkGenerator();
|
cChunkGenerator Generator = cChunkGenerator();
|
||||||
}
|
}
|
||||||
|
@ -237,7 +237,7 @@ void initializeBiomeColors(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Initialize per-biome:
|
// 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];
|
auto & dst = biomeColors[biomeColorMap[i].biome];
|
||||||
const auto & src = biomeColorMap[i].color;
|
const auto & src = biomeColorMap[i].color;
|
||||||
@ -450,7 +450,3 @@ int main(int argc, char ** argv)
|
|||||||
log("GrownBiomeGenVisualiser finished");
|
log("GrownBiomeGenVisualiser finished");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ int main(int argc, char ** argv)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// cMCADefrag:
|
// cMCADefrag:
|
||||||
|
|
||||||
cMCADefrag::cMCADefrag(void) :
|
cMCADefrag::cMCADefrag(void) :
|
||||||
@ -122,7 +122,7 @@ AString cMCADefrag::GetNextFileName(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// cMCADefrag::cThread:
|
// cMCADefrag::cThread:
|
||||||
|
|
||||||
cMCADefrag::cThread::cThread(cMCADefrag & a_Parent) :
|
cMCADefrag::cThread::cThread(cMCADefrag & a_Parent) :
|
||||||
@ -432,7 +432,3 @@ bool cMCADefrag::cThread::CompressChunk(void)
|
|||||||
m_CompressedChunkDataSize = static_cast<int>(CompressedSize + 1);
|
m_CompressedChunkDataSize = static_cast<int>(CompressedSize + 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -138,7 +138,3 @@ protected:
|
|||||||
Returns an empty string when queue empty. */
|
Returns an empty string when queue empty. */
|
||||||
AString GetNextFileName(void);
|
AString GetNextFileName(void);
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,3 @@
|
|||||||
// Used for precompiled header generation
|
// Used for precompiled header generation
|
||||||
|
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -315,7 +315,3 @@ int main(int argc, char * argv[])
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,7 +19,3 @@
|
|||||||
#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
|
#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.
|
#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -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_X = 33;
|
||||||
static const int SIZE_Y = 5;
|
static const int SIZE_Y = 5;
|
||||||
static const int SIZE_Z = 5;
|
static const int SIZE_Z = 5;
|
||||||
@ -115,7 +115,3 @@ int main(int argc, char ** argv)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -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
|
// #define SLEEP_AFTER_PACKET
|
||||||
|
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ struct sChunkMeta
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// cConnection:
|
// cConnection:
|
||||||
|
|
||||||
cConnection::cConnection(SOCKET a_ClientSocket, cServer & a_Server) :
|
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:
|
// packet handling, client-side, initial handshake:
|
||||||
|
|
||||||
bool cConnection::HandleClientHandshake(void)
|
bool cConnection::HandleClientHandshake(void)
|
||||||
@ -826,7 +826,7 @@ bool cConnection::HandleClientHandshake(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// packet handling, client-side, login:
|
// packet handling, client-side, login:
|
||||||
|
|
||||||
bool cConnection::HandleClientLoginEncryptionKeyResponse(void)
|
bool cConnection::HandleClientLoginEncryptionKeyResponse(void)
|
||||||
@ -852,7 +852,7 @@ bool cConnection::HandleClientLoginStart(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// packet handling, client-side, game:
|
// packet handling, client-side, game:
|
||||||
|
|
||||||
bool cConnection::HandleClientAnimation(void)
|
bool cConnection::HandleClientAnimation(void)
|
||||||
@ -1279,7 +1279,7 @@ bool cConnection::HandleClientUnknownPacket(UInt32 a_PacketType, UInt32 a_Packet
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// packet handling, server-side, login:
|
// packet handling, server-side, login:
|
||||||
|
|
||||||
bool cConnection::HandleServerLoginDisconnect(void)
|
bool cConnection::HandleServerLoginDisconnect(void)
|
||||||
@ -1355,7 +1355,7 @@ bool cConnection::HandleServerLoginSuccess(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// packet handling, server-side, game:
|
// packet handling, server-side, game:
|
||||||
|
|
||||||
bool cConnection::HandleServerAttachEntity(void)
|
bool cConnection::HandleServerAttachEntity(void)
|
||||||
@ -2966,7 +2966,3 @@ void cConnection::SendEncryptionKeyResponse(const AString & a_ServerPublicKey, c
|
|||||||
m_ServerState = csEncryptedUnderstood;
|
m_ServerState = csEncryptedUnderstood;
|
||||||
m_IsServerEncrypted = true;
|
m_IsServerEncrypted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,9 +25,11 @@ class cServer;
|
|||||||
|
|
||||||
class cConnection
|
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;
|
cCriticalSection m_CSLog;
|
||||||
FILE * m_LogFile;
|
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
|
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;
|
bool m_HasClientPinged;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -81,43 +83,43 @@ protected:
|
|||||||
2: login
|
2: login
|
||||||
3: game
|
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;
|
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;
|
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 m_IsServerEncrypted;
|
||||||
|
|
||||||
|
|
||||||
bool ConnectToServer(void);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
bool DecodeServersPackets(const char * a_Data, int a_Size);
|
||||||
|
|
||||||
// Packet handling, client-side, initial:
|
// Packet handling, client-side, initial:
|
||||||
@ -224,22 +226,18 @@ protected:
|
|||||||
|
|
||||||
bool HandleServerUnknownPacket(UInt32 a_PacketType, UInt32 a_PacketLen, UInt32 a_PacketReadSoFar);
|
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);
|
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);
|
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);
|
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);
|
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);
|
void StartClientEncryption(const AString & a_EncryptedSecret, const AString & a_EncryptedNonce);
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -195,14 +195,14 @@ typedef unsigned char Byte;
|
|||||||
|
|
||||||
// Common definitions:
|
// 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)))
|
#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 KiB * 1024
|
||||||
|
|
||||||
/// Faster than (int)floorf((float)x / (float)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 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
|
// Own version of assert() that writes failed assertions to the log for review
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
@ -212,7 +212,7 @@ typedef unsigned char Byte;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Pretty much the same as ASSERT() but stays in Release builds
|
// 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
|
// C++11 has std::shared_ptr in <memory>, included earlier
|
||||||
#define SharedPtr std::shared_ptr
|
#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
|
template <typename Type> class cItemCallback
|
||||||
{
|
{
|
||||||
public:
|
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;
|
virtual bool Item(Type * a_Type) = 0;
|
||||||
} ;
|
} ;
|
||||||
|
@ -57,7 +57,3 @@ int main(int argc, char ** argv)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,7 +103,3 @@ void cServer::Run(void)
|
|||||||
LOGINFO("Client disconnected. Ready for another connection.");
|
LOGINFO("Client disconnected. Ready for another connection.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,7 +34,3 @@ public:
|
|||||||
|
|
||||||
UInt16 GetConnectPort(void) const { return m_ConnectPort; }
|
UInt16 GetConnectPort(void) const { return m_ConnectPort; }
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -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[]. */
|
/** Map for converting biome values to colors. Initialized from biomeColors[]. */
|
||||||
static uchar biomeToColor[256 * 4];
|
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
|
static struct
|
||||||
{
|
{
|
||||||
EMCSBiome m_Biome;
|
EMCSBiome m_Biome;
|
||||||
@ -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
|
// which need to be shifted to account for panning inside that chunk
|
||||||
centerx -= (m_X - centerchunkx * 16) * m_Zoom;
|
centerx -= (m_X - centerchunkx * 16) * m_Zoom;
|
||||||
centery -= (m_Z - centerchunkz * 16) * m_Zoom;
|
centery -= (m_Z - centerchunkz * 16) * m_Zoom;
|
||||||
// centerx,y now points to the top left corner of the center chunk
|
// centerx, centery now points to the top left corner of the center chunk
|
||||||
// so now calculate our x,y in relation
|
// so now calculate our x, y in relation
|
||||||
double chunksize = 16 * m_Zoom;
|
double chunksize = 16 * m_Zoom;
|
||||||
centerx += (a_ChunkX - centerchunkx) * chunksize;
|
centerx += (a_ChunkX - centerchunkx) * chunksize;
|
||||||
centery += (a_ChunkZ - centerchunkz) * chunksize;
|
centery += (a_ChunkZ - centerchunkz) * chunksize;
|
||||||
@ -550,7 +550,3 @@ void BiomeView::keyPressEvent(QKeyEvent * a_Event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
// Useful warnings from warning level 4:
|
// Useful warnings from warning level 4:
|
||||||
#pragma warning(3 : 4127) // Conditional expression is constant
|
#pragma warning(3 : 4127) // Conditional expression is constant
|
||||||
#pragma warning(3 : 4189) // Local variable is initialized but not referenced
|
#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 : 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 : 4505) // Unreferenced local function has been removed
|
||||||
#pragma warning(3 : 4701) // Potentially unitialized local variable used
|
#pragma warning(3 : 4701) // Potentially unitialized local variable used
|
||||||
#pragma warning(3 : 4702) // Unreachable code
|
#pragma warning(3 : 4702) // Unreachable code
|
||||||
@ -254,9 +254,9 @@ template class SizeChecker<UInt16, 2>;
|
|||||||
#include "src/Logger.h"
|
#include "src/Logger.h"
|
||||||
#else
|
#else
|
||||||
// Logging functions
|
// 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_list argList;
|
||||||
va_start(argList, a_Format);
|
va_start(argList, a_Format);
|
||||||
@ -271,14 +271,15 @@ void inline LOGERROR(const char* a_Format, ...)
|
|||||||
|
|
||||||
// Common definitions:
|
// 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)))
|
#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 KiB * 1024
|
||||||
#define MiB * 1024 * 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))
|
#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
|
// Own version of assert() that writes failed assertions to the log for review
|
||||||
|
@ -218,14 +218,14 @@ typedef unsigned char Byte;
|
|||||||
|
|
||||||
// Common definitions:
|
// 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)))
|
#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 KiB * 1024
|
||||||
|
|
||||||
/// Faster than (int)floorf((float)x / (float)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 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
|
// Own version of assert() that writes failed assertions to the log for review
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
@ -235,4 +235,4 @@ typedef unsigned char Byte;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Pretty much the same as ASSERT() but stays in Release builds
|
// 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))
|
||||||
|
@ -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
|
class cRCONPacketizer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -30,26 +30,26 @@ public:
|
|||||||
|
|
||||||
cRCONPacketizer(cSocket & a_Socket);
|
cRCONPacketizer(cSocket & a_Socket);
|
||||||
|
|
||||||
/// Sends the packet to the socket and waits until the response is received.
|
/** 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.
|
Returns true if response successfully received, false if the client disconnected or protocol error.
|
||||||
/// Dumps the reply payload to stdout.
|
Dumps the reply payload to stdout. */
|
||||||
bool SendPacket(int a_PacketType, const AString & a_PacketPayload);
|
bool SendPacket(int a_PacketType, const AString & a_PacketPayload);
|
||||||
|
|
||||||
protected:
|
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;
|
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;
|
int m_RequestID;
|
||||||
|
|
||||||
/// Receives the full response and dumps its payload to stdout.
|
/** Receives the full response and dumps its payload to stdout.
|
||||||
/// Returns true if successful, false if the client disconnected or protocol error.
|
Returns true if successful, false if the client disconnected or protocol error. */
|
||||||
bool ReceiveResponse(void);
|
bool ReceiveResponse(void);
|
||||||
|
|
||||||
/// Parses the received response packet and dumps its payload to stdout.
|
/** Parses the received response packet and dumps its payload to stdout.
|
||||||
/// Returns true if successful, false on protocol error
|
Returns true if successful, false on protocol error
|
||||||
/// Assumes that the packet length has already been read from the packet
|
Assumes that the packet length has already been read from the packet
|
||||||
/// If the packet is successfully parsed, increments m_RequestID
|
If the packet is successfully parsed, increments m_RequestID */
|
||||||
bool ParsePacket(cByteBuffer & a_Buffer, int a_PacketLength);
|
bool ParsePacket(cByteBuffer & a_Buffer, int a_PacketLength);
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ bool cRCONPacketizer::ParsePacket(cByteBuffer & a_Buffer, int a_PacketLength)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// main:
|
// main:
|
||||||
|
|
||||||
int RealMain(int argc, char * argv[])
|
int RealMain(int argc, char * argv[])
|
||||||
@ -327,7 +327,3 @@ int main(int argc, char * argv[])
|
|||||||
int res = RealMain(argc, argv);
|
int res = RealMain(argc, argv);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -83,10 +83,10 @@
|
|||||||
|
|
||||||
// Common definitions:
|
// 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)))
|
#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 KiB * 1024
|
||||||
#define MiB * 1024 * 1024
|
#define MiB * 1024 * 1024
|
||||||
|
|
||||||
|
@ -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)
|
void ProcessCFile(const AString & a_CFileIn, const AString & a_CFileOut)
|
||||||
{
|
{
|
||||||
cProcessor p(a_CFileOut);
|
cProcessor p(a_CFileOut);
|
||||||
@ -216,7 +216,3 @@ int main(int argc, char * argv[])
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user