From 14dce238450b419a5df2aa171ee91981910463b0 Mon Sep 17 00:00:00 2001 From: "lapayo94@gmail.com" Date: Sun, 15 Jul 2012 20:36:34 +0000 Subject: A new Block handling system :o It was really a lot of work :D Took me the complete weekend :D Would really like to here your opinion on this =) The aim of this is to put all the actions for one block in one place so it is not spread around the source. (ToPickup, Action in cWorld, Action in cChunk, Action here, action there :D) git-svn-id: http://mc-server.googlecode.com/svn/trunk@671 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cWorld.h | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'source/cWorld.h') diff --git a/source/cWorld.h b/source/cWorld.h index 0a4d0280e..e0e87b708 100644 --- a/source/cWorld.h +++ b/source/cWorld.h @@ -54,6 +54,7 @@ typedef cItemCallback cFurnaceCallback; + class cWorld //tolua_export { //tolua_export public: @@ -330,6 +331,17 @@ public: /// Stops threads that belong to this world (part of deinit) void StopThreads(void); + void TickQueuedBlocks(float a_Dt); + + struct BlockTickQueueItem + { + int X; + int Y; + int Z; + float ToWait; + }; + + void QueueBlockForTick(int a_X, int a_Y, int a_Z, float a_Time); void CastThunderbolt (int a_X, int a_Y, int a_Z); //tolua_export void SetWeather ( eWeather a_Weather ); //tolua_export @@ -339,14 +351,14 @@ public: cChunkGenerator & GetGenerator(void) { return m_Generator; } cWorldStorage & GetStorage (void) { return m_Storage; } cChunkMap * GetChunkMap (void) { return m_ChunkMap; } - - bool IsPlacingItemLegal(Int16 a_ItemType, int a_BlockX, int a_BlockY, int a_BlockZ); - + /// Sets the blockticking to start at the specified block. Only one blocktick per chunk may be set, second call overwrites the first call void SetNextBlockTick(int a_BlockX, int a_BlockY, int a_BlockZ); // tolua_export int GetMaxSugarcaneHeight(void) const { return m_MaxSugarcaneHeight; } // tolua_export int GetMaxCactusHeight (void) const { return m_MaxCactusHeight; } // tolua_export + + bool IsBlockDirectlyWatered(int a_X, int a_Y, int a_Z); private: @@ -370,6 +382,9 @@ private: // The cRedstone class simulates redstone and needs access to m_RSList friend class cRedstone; std::vector m_RSList; + + std::vector m_BlockTickQueue; + std::vector m_BlockTickQueueCopy; //Second is for safely removing the objects from the queue cSimulatorManager * m_SimulatorManager; cSandSimulator * m_SandSimulator; -- cgit v1.2.3