From 429f6153901c1b178eff3e3c2b642331b052475b Mon Sep 17 00:00:00 2001 From: bibo38 Date: Fri, 6 Nov 2015 17:11:54 +0100 Subject: Added some code improvements --- src/Blocks/BlockPiston.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/Blocks/BlockPiston.h') diff --git a/src/Blocks/BlockPiston.h b/src/Blocks/BlockPiston.h index 418af6d27..82f079954 100644 --- a/src/Blocks/BlockPiston.h +++ b/src/Blocks/BlockPiston.h @@ -81,10 +81,8 @@ public: } } - /** This method converts the magic piston metadata into a direction vector. - This vector has a length of 1 and points into the direction, in which the piston will extend. - */ - static Vector3i VectorFromMetaData(int a_PistonMeta); + /** Converts piston block's metadata into a unit vector representing the direction in which the piston will extend. */ + static Vector3i MetadataToOffset(NIBBLETYPE a_PistonMeta); static void ExtendPiston(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World); static void RetractPiston(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World); @@ -96,6 +94,8 @@ public: } private: + + typedef std::unordered_set> Vector3iSet; /** Returns true if the piston (specified by blocktype) is a sticky piston */ static inline bool IsSticky(BLOCKTYPE a_BlockType) { return (a_BlockType == E_BLOCK_STICKY_PISTON); } @@ -151,11 +151,11 @@ private: /** Tries to push a block and increases the pushed blocks variable. Returns true if the block is pushable */ static bool CanPushBlock( int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World, bool a_RequirePushable, - std::unordered_set> & a_BlocksPushed, const Vector3i & a_PushDir + Vector3iSet & a_BlocksPushed, const Vector3i & a_PushDir ); /** Moves a list of blocks in a specific direction */ - static void PushBlocks(const std::unordered_set> & a_BlocksToPush, + static void PushBlocks(const Vector3iSet & a_BlocksToPush, cWorld * a_World, const Vector3i & a_PushDir ); } ; -- cgit v1.2.3