From a0914131253ed9ecb39e3e7eb10fa25d6ee27512 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Wed, 6 Feb 2013 18:22:30 +0000 Subject: Added a new API call to cBlockArea: Crop(). Also fixed cBlockArea:MakeIndex(), the indexing was wrong. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1194 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/BlockArea.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source/BlockArea.h') diff --git a/source/BlockArea.h b/source/BlockArea.h index d9b21d933..797c37de6 100644 --- a/source/BlockArea.h +++ b/source/BlockArea.h @@ -59,6 +59,9 @@ public: // 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 + /// 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); + // 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); @@ -135,6 +138,8 @@ protected: virtual void BlockSkyLight(const NIBBLETYPE * a_BlockSkyLight) override; } ; + typedef NIBBLETYPE * NIBBLEARRAY; + int m_OriginX; int m_OriginY; @@ -157,6 +162,10 @@ 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); // tolua_begin } ; -- cgit v1.2.3