Bulk clearing of whitespace
This commit is contained in:
+64
-64
@@ -32,7 +32,7 @@ class cBlockArea
|
||||
// tolua_end
|
||||
DISALLOW_COPY_AND_ASSIGN(cBlockArea);
|
||||
// tolua_begin
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/** What data is to be queried (bit-mask) */
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
baLight = 4,
|
||||
baSkyLight = 8,
|
||||
} ;
|
||||
|
||||
|
||||
/** The per-block strategy to use when merging another block area into this object.
|
||||
See the Merge function for the description of these */
|
||||
enum eMergeStrategy
|
||||
@@ -57,64 +57,64 @@ public:
|
||||
msSimpleCompare,
|
||||
msMask,
|
||||
} ;
|
||||
|
||||
|
||||
cBlockArea(void);
|
||||
~cBlockArea();
|
||||
|
||||
|
||||
/** Clears the data stored to reclaim memory */
|
||||
void Clear(void);
|
||||
|
||||
|
||||
/** Creates a new area of the specified size and contents.
|
||||
Origin is set to all zeroes.
|
||||
BlockTypes are set to air, block metas to zero, blocklights to zero and skylights to full light.
|
||||
*/
|
||||
void Create(int a_SizeX, int a_SizeY, int a_SizeZ, int a_DataTypes = baTypes | baMetas);
|
||||
|
||||
|
||||
/** Creates a new area of the specified size and contents.
|
||||
Origin is set to all zeroes.
|
||||
BlockTypes are set to air, block metas to zero, blocklights to zero and skylights to full light.
|
||||
*/
|
||||
void Create(const Vector3i & a_Size, int a_DataTypes = baTypes | baMetas);
|
||||
|
||||
|
||||
/** Resets the origin. No other changes are made, contents are untouched. */
|
||||
void SetOrigin(int a_OriginX, int a_OriginY, int a_OriginZ);
|
||||
|
||||
|
||||
/** Resets the origin. No other changes are made, contents are untouched. */
|
||||
void SetOrigin(const Vector3i & a_Origin);
|
||||
|
||||
|
||||
/** Reads an area of blocks specified. Returns true if successful. All coords are inclusive. */
|
||||
bool Read(cForEachChunkProvider * a_ForEachChunkProvider, int a_MinBlockX, int a_MaxBlockX, int a_MinBlockY, int a_MaxBlockY, int a_MinBlockZ, int a_MaxBlockZ, int a_DataTypes = baTypes | baMetas);
|
||||
|
||||
|
||||
/** Reads an area of blocks specified. Returns true if successful. The bounds are included in the read area. */
|
||||
bool Read(cForEachChunkProvider * a_ForEachChunkProvider, const cCuboid & a_Bounds, int a_DataTypes = baTypes | baMetas);
|
||||
|
||||
|
||||
/** Reads an area of blocks specified. Returns true if successful. The bounds are included in the read area. */
|
||||
bool Read(cForEachChunkProvider * a_ForEachChunkProvider, const Vector3i & a_Point1, const Vector3i & a_Point2, int a_DataTypes = baTypes | baMetas);
|
||||
|
||||
|
||||
// TODO: Write() is not too good an interface: if it fails, there's no way to repeat only for the parts that didn't write
|
||||
// A better way may be to return a list of cBlockAreas for each part that didn't succeed writing, so that the caller may try again
|
||||
|
||||
|
||||
/** Writes the area back into cWorld at the coords specified. Returns true if successful in all chunks, false if only partially / not at all */
|
||||
bool Write(cForEachChunkProvider * a_ForEachChunkProvider, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes = baTypes | baMetas);
|
||||
|
||||
|
||||
/** Writes the area back into cWorld at the coords specified. Returns true if successful in all chunks, false if only partially / not at all */
|
||||
bool Write(cForEachChunkProvider * a_ForEachChunkProvider, const Vector3i & a_MinCoords, int a_DataTypes = baTypes | baMetas);
|
||||
|
||||
|
||||
/** Copies this object's contents into the specified BlockArea. */
|
||||
void CopyTo(cBlockArea & a_Into) const;
|
||||
|
||||
|
||||
/** Copies the contents from the specified BlockArea into this object. */
|
||||
void CopyFrom(const cBlockArea & a_From);
|
||||
|
||||
|
||||
/** For testing purposes only, dumps the area into a file. */
|
||||
void DumpToRawFile(const AString & a_FileName);
|
||||
|
||||
|
||||
/** Crops the internal contents by the specified amount of blocks from each border. */
|
||||
void Crop(int a_AddMinX, int a_SubMaxX, int a_AddMinY, int a_SubMaxY, int a_AddMinZ, int a_SubMaxZ);
|
||||
|
||||
|
||||
/** Expands the internal contents by the specified amount of blocks from each border */
|
||||
void Expand(int a_SubMinX, int a_AddMaxX, int a_SubMinY, int a_AddMaxY, int a_SubMinZ, int a_AddMaxZ);
|
||||
|
||||
|
||||
/** Merges another block area into this one, using the specified block combinating strategy
|
||||
This function combines another BlockArea into the current object.
|
||||
The strategy parameter specifies how individual blocks are combined together, using the table below.
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
| A | air | air | A | A |
|
||||
| air | B | B | B | B |
|
||||
| A | B | B | A | B |
|
||||
|
||||
|
||||
So to sum up:
|
||||
- msOverwrite completely overwrites all blocks with the Src's blocks
|
||||
- msFillAir overwrites only those blocks that were air
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
| mycelium | stone | stone | ... and mycelium
|
||||
| A | stone | A | ... but nothing else
|
||||
| A | * | A | Everything else is left as it is
|
||||
|
||||
|
||||
msSpongePrint:
|
||||
Used for most generators, it allows carving out air pockets, too, and uses the Sponge as the NOP block
|
||||
| area block | |
|
||||
@@ -156,7 +156,7 @@ public:
|
||||
+----------+--------+--------+
|
||||
| A | sponge | A | Sponge is the NOP block
|
||||
| * | B | B | Everything else overwrites anything
|
||||
|
||||
|
||||
msDifference:
|
||||
Used to determine the differences between two areas. Only the differring blocks are preserved:
|
||||
| area block | |
|
||||
@@ -183,68 +183,68 @@ public:
|
||||
|
||||
*/
|
||||
void Merge(const cBlockArea & a_Src, int a_RelX, int a_RelY, int a_RelZ, eMergeStrategy a_Strategy);
|
||||
|
||||
|
||||
/** Merges another block area into this one, using the specified block combinating strategy.
|
||||
See Merge() above for details. */
|
||||
void Merge(const cBlockArea & a_Src, const Vector3i & a_RelMinCoords, eMergeStrategy a_Strategy);
|
||||
|
||||
|
||||
/** Fills the entire block area with the specified data */
|
||||
void Fill(int a_DataTypes, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta = 0, NIBBLETYPE a_BlockLight = 0, NIBBLETYPE a_BlockSkyLight = 0x0f);
|
||||
|
||||
|
||||
/** Fills a cuboid inside the block area with the specified data */
|
||||
void FillRelCuboid(int a_MinRelX, int a_MaxRelX, int a_MinRelY, int a_MaxRelY, int a_MinRelZ, int a_MaxRelZ,
|
||||
int a_DataTypes, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta = 0,
|
||||
NIBBLETYPE a_BlockLight = 0, NIBBLETYPE a_BlockSkyLight = 0x0f
|
||||
);
|
||||
|
||||
|
||||
/** Fills a cuboid inside the block area with the specified data. a_Cuboid must be sorted. */
|
||||
void FillRelCuboid(const cCuboid & a_RelCuboid,
|
||||
int a_DataTypes, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta = 0,
|
||||
NIBBLETYPE a_BlockLight = 0, NIBBLETYPE a_BlockSkyLight = 0x0f
|
||||
);
|
||||
|
||||
|
||||
/** Draws a line from between two points with the specified data */
|
||||
void RelLine(int a_RelX1, int a_RelY1, int a_RelZ1, int a_RelX2, int a_RelY2, int a_RelZ2,
|
||||
int a_DataTypes, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta = 0,
|
||||
NIBBLETYPE a_BlockLight = 0, NIBBLETYPE a_BlockSkyLight = 0x0f
|
||||
);
|
||||
|
||||
|
||||
/** Draws a line from between two points with the specified data */
|
||||
void RelLine(const Vector3i & a_Point1, const Vector3i & a_Point2,
|
||||
int a_DataTypes, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta = 0,
|
||||
NIBBLETYPE a_BlockLight = 0, NIBBLETYPE a_BlockSkyLight = 0x0f
|
||||
);
|
||||
|
||||
|
||||
/** Rotates the entire area counter-clockwise around the Y axis */
|
||||
void RotateCCW(void);
|
||||
|
||||
|
||||
/** Rotates the entire area clockwise around the Y axis */
|
||||
void RotateCW(void);
|
||||
|
||||
|
||||
/** Mirrors the entire area around the XY plane */
|
||||
void MirrorXY(void);
|
||||
|
||||
|
||||
/** Mirrors the entire area around the XZ plane */
|
||||
void MirrorXZ(void);
|
||||
|
||||
|
||||
/** Mirrors the entire area around the YZ plane */
|
||||
void MirrorYZ(void);
|
||||
|
||||
|
||||
/** Rotates the entire area counter-clockwise around the Y axis, doesn't use blockhandlers for block meta */
|
||||
void RotateCCWNoMeta(void);
|
||||
|
||||
|
||||
/** Rotates the entire area clockwise around the Y axis, doesn't use blockhandlers for block meta */
|
||||
void RotateCWNoMeta(void);
|
||||
|
||||
|
||||
/** Mirrors the entire area around the XY plane, doesn't use blockhandlers for block meta */
|
||||
void MirrorXYNoMeta(void);
|
||||
|
||||
|
||||
/** Mirrors the entire area around the XZ plane, doesn't use blockhandlers for block meta */
|
||||
void MirrorXZNoMeta(void);
|
||||
|
||||
|
||||
/** Mirrors the entire area around the YZ plane, doesn't use blockhandlers for block meta */
|
||||
void MirrorYZNoMeta(void);
|
||||
|
||||
|
||||
// Setters:
|
||||
void SetRelBlockType (int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType);
|
||||
void SetBlockType (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType);
|
||||
@@ -270,35 +270,35 @@ public:
|
||||
|
||||
void SetBlockTypeMeta (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
|
||||
void SetRelBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
|
||||
|
||||
|
||||
// tolua_end
|
||||
|
||||
|
||||
// These need manual exporting, tolua generates the binding as requiring 2 extra input params
|
||||
void GetBlockTypeMeta (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) const;
|
||||
void GetRelBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) const;
|
||||
|
||||
|
||||
// GetSize() is already exported manually to return 3 numbers, can't auto-export
|
||||
const Vector3i & GetSize(void) const { return m_Size; }
|
||||
|
||||
|
||||
// GetOrigin() is already exported manually to return 3 numbers, can't auto-export
|
||||
const Vector3i & GetOrigin(void) const { return m_Origin; }
|
||||
|
||||
|
||||
// tolua_begin
|
||||
|
||||
|
||||
int GetSizeX(void) const { return m_Size.x; }
|
||||
int GetSizeY(void) const { return m_Size.y; }
|
||||
int GetSizeZ(void) const { return m_Size.z; }
|
||||
|
||||
|
||||
/** Returns the volume of the area, as number of blocks */
|
||||
int GetVolume(void) const { return m_Size.x * m_Size.y * m_Size.z; }
|
||||
|
||||
|
||||
int GetOriginX(void) const { return m_Origin.x; }
|
||||
int GetOriginY(void) const { return m_Origin.y; }
|
||||
int GetOriginZ(void) const { return m_Origin.z; }
|
||||
|
||||
|
||||
/** Returns the datatypes that are stored in the object (bitmask of baXXX values) */
|
||||
int GetDataTypes(void) const;
|
||||
|
||||
|
||||
bool HasBlockTypes (void) const { return (m_BlockTypes != nullptr); }
|
||||
bool HasBlockMetas (void) const { return (m_BlockMetas != nullptr); }
|
||||
bool HasBlockLights (void) const { return (m_BlockLight != nullptr); }
|
||||
@@ -323,7 +323,7 @@ public:
|
||||
If there are no non-ignored blocks within the area, or blocktypes are not present, the returned values are reverse-ranges (MinX <- m_RangeX, MaxX <- 0 etc.)
|
||||
Exported to Lua in ManualBindings.cpp. */
|
||||
void GetNonAirCropRelCoords(int & a_MinRelX, int & a_MinRelY, int & a_MinRelZ, int & a_MaxRelX, int & a_MaxRelY, int & a_MaxRelZ, BLOCKTYPE a_IgnoreBlockType = E_BLOCK_AIR);
|
||||
|
||||
|
||||
// Clients can use these for faster access to all blocktypes. Be careful though!
|
||||
/** Returns the internal pointer to the block types */
|
||||
BLOCKTYPE * GetBlockTypes (void) const { return m_BlockTypes; }
|
||||
@@ -336,32 +336,32 @@ public:
|
||||
protected:
|
||||
friend class cChunkDesc;
|
||||
friend class cSchematicFileSerializer;
|
||||
|
||||
|
||||
class cChunkReader :
|
||||
public cChunkDataCallback
|
||||
{
|
||||
public:
|
||||
cChunkReader(cBlockArea & a_Area);
|
||||
|
||||
|
||||
protected:
|
||||
cBlockArea & m_Area;
|
||||
Vector3i m_Origin;
|
||||
int m_CurrentChunkX;
|
||||
int m_CurrentChunkZ;
|
||||
|
||||
|
||||
void CopyNibbles(NIBBLETYPE * a_AreaDst, const NIBBLETYPE * a_ChunkSrc);
|
||||
|
||||
|
||||
// cChunkDataCallback overrides:
|
||||
virtual bool Coords(int a_ChunkX, int a_ChunkZ) override;
|
||||
virtual void ChunkData(const cChunkData & a_BlockTypes) override;
|
||||
} ;
|
||||
|
||||
|
||||
typedef NIBBLETYPE * NIBBLEARRAY;
|
||||
|
||||
|
||||
|
||||
|
||||
Vector3i m_Origin;
|
||||
Vector3i m_Size;
|
||||
|
||||
|
||||
/** An extra data value sometimes stored in the .schematic file. Used mainly by the WorldEdit plugin.
|
||||
cBlockArea doesn't use this value in any way. */
|
||||
Vector3i m_WEOffset;
|
||||
@@ -370,10 +370,10 @@ protected:
|
||||
NIBBLETYPE * m_BlockMetas; // Each meta is stored as a separate byte for faster access
|
||||
NIBBLETYPE * m_BlockLight; // Each light value is stored as a separate byte for faster access
|
||||
NIBBLETYPE * m_BlockSkyLight; // Each light value is stored as a separate byte for faster access
|
||||
|
||||
|
||||
/** Clears the data stored and prepares a fresh new block area with the specified dimensions */
|
||||
bool SetSize(int a_SizeX, int a_SizeY, int a_SizeZ, int a_DataTypes);
|
||||
|
||||
|
||||
// Basic Setters:
|
||||
void SetRelNibble(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_Value, NIBBLETYPE * a_Array);
|
||||
void SetNibble (int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_Value, NIBBLETYPE * a_Array);
|
||||
@@ -381,11 +381,11 @@ protected:
|
||||
// Basic Getters:
|
||||
NIBBLETYPE GetRelNibble(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE * a_Array) const;
|
||||
NIBBLETYPE GetNibble (int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE * a_Array) const;
|
||||
|
||||
|
||||
// Crop helpers:
|
||||
void CropBlockTypes(int a_AddMinX, int a_SubMaxX, int a_AddMinY, int a_SubMaxY, int a_AddMinZ, int a_SubMaxZ);
|
||||
void CropNibbles (NIBBLEARRAY & a_Array, int a_AddMinX, int a_SubMaxX, int a_AddMinY, int a_SubMaxY, int a_AddMinZ, int a_SubMaxZ);
|
||||
|
||||
|
||||
// Expand helpers:
|
||||
void ExpandBlockTypes(int a_SubMinX, int a_AddMaxX, int a_SubMinY, int a_AddMaxY, int a_SubMinZ, int a_AddMaxZ);
|
||||
void ExpandNibbles (NIBBLEARRAY & a_Array, int a_SubMinX, int a_AddMaxX, int a_SubMinY, int a_AddMaxY, int a_SubMinZ, int a_AddMaxZ);
|
||||
@@ -396,7 +396,7 @@ protected:
|
||||
int a_DataTypes, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta,
|
||||
NIBBLETYPE a_BlockLight, NIBBLETYPE a_BlockSkyLight
|
||||
);
|
||||
|
||||
|
||||
template <bool MetasValid>
|
||||
void MergeByStrategy(const cBlockArea & a_Src, int a_RelX, int a_RelY, int a_RelZ, eMergeStrategy a_Strategy, const NIBBLETYPE * SrcMetas, NIBBLETYPE * DstMetas);
|
||||
// tolua_begin
|
||||
|
||||
Reference in New Issue
Block a user