From adae2b70b1733a280fe342ca6d0dca7e37301f4f Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Tue, 29 Jul 2014 22:31:31 +0200 Subject: Added cBlockInfo::CanBeTerraformed and made finishers use it I might have forgotten some of them though --- src/BlockInfo.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/BlockInfo.h') diff --git a/src/BlockInfo.h b/src/BlockInfo.h index e6ce566c5..4c66c095a 100644 --- a/src/BlockInfo.h +++ b/src/BlockInfo.h @@ -45,6 +45,9 @@ public: /** Does this block fully occupy its voxel - is it a 'full' block? */ bool m_FullyOccupiesVoxel; + /** Can a finisher change it? */ + bool m_CanBeTerraformed; + // tolua_end /** Associated block handler. */ @@ -60,6 +63,7 @@ public: inline static bool IsSnowable (BLOCKTYPE a_Type) { return Get(a_Type).m_IsSnowable; } inline static bool IsSolid (BLOCKTYPE a_Type) { return Get(a_Type).m_IsSolid; } inline static bool FullyOccupiesVoxel (BLOCKTYPE a_Type) { return Get(a_Type).m_FullyOccupiesVoxel; } + inline static bool CanBeTerraformed (BLOCKTYPE a_Type) { return Get(a_Type).m_CanBeTerraformed; } // tolua_end -- cgit v1.2.3 From acae3c9c657e48d0dc8c4b2965e5b3d69c53b279 Mon Sep 17 00:00:00 2001 From: Masy98 Date: Tue, 9 Sep 2014 16:00:26 +0200 Subject: Moved sound-configs into BlockID.h and fixed/ added loads of sounds --- src/BlockInfo.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/BlockInfo.h') diff --git a/src/BlockInfo.h b/src/BlockInfo.h index 4c66c095a..567070a7f 100644 --- a/src/BlockInfo.h +++ b/src/BlockInfo.h @@ -48,6 +48,9 @@ public: /** Can a finisher change it? */ bool m_CanBeTerraformed; + /** Sound when placing this block */ + AString m_PlaceSound; + // tolua_end /** Associated block handler. */ @@ -64,6 +67,7 @@ public: inline static bool IsSolid (BLOCKTYPE a_Type) { return Get(a_Type).m_IsSolid; } inline static bool FullyOccupiesVoxel (BLOCKTYPE a_Type) { return Get(a_Type).m_FullyOccupiesVoxel; } inline static bool CanBeTerraformed (BLOCKTYPE a_Type) { return Get(a_Type).m_CanBeTerraformed; } + inline static AString GetPlaceSound (BLOCKTYPE a_Type) { return Get(a_Type).m_PlaceSound; } // tolua_end -- cgit v1.2.3 From 6e7c0e33b5dd6d86d66ac2eb1a07a33652a708fd Mon Sep 17 00:00:00 2001 From: Tycho Date: Wed, 17 Sep 2014 18:40:10 +0100 Subject: Added first test to show the object can be created --- src/BlockInfo.h | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'src/BlockInfo.h') diff --git a/src/BlockInfo.h b/src/BlockInfo.h index 567070a7f..bfa62a132 100644 --- a/src/BlockInfo.h +++ b/src/BlockInfo.h @@ -11,14 +11,27 @@ class cBlockHandler; - // tolua_begin class cBlockInfo { public: /** Returns the associated BlockInfo structure for the specified block type. */ - static cBlockInfo & Get(BLOCKTYPE a_Type); + + /** This accessor makes sure that the cBlockInfo structures are properly initialized exactly once. +It does so by using the C++ singleton approximation - storing the actual singleton as the function's static variable. +It works only if it is called for the first time before the app spawns other threads. */ + static cBlockInfo & Get(BLOCKTYPE a_Type) + { + static cBlockInfo ms_Info[256]; + static bool IsBlockInfoInitialized = false; + if (!IsBlockInfoInitialized) + { + cBlockInfo::Initialize(ms_Info); + IsBlockInfoInitialized = true; + } + return ms_Info[a_Type]; + } /** How much light do the blocks emit on their own? */ @@ -78,7 +91,19 @@ protected: typedef cBlockInfo cBlockInfoArray[256]; /** Creates a default BlockInfo structure, initializes all values to their defaults */ - cBlockInfo(); + cBlockInfo() + : m_LightValue(0x00) + , m_SpreadLightFalloff(0x0f) + , m_Transparent(false) + , m_OneHitDig(false) + , m_PistonBreakable(false) + , m_IsSnowable(false) + , m_IsSolid(true) + , m_FullyOccupiesVoxel(false) + , m_CanBeTerraformed(false) + , m_PlaceSound("") + , m_Handler(NULL) + {} /** Cleans up the stored values */ ~cBlockInfo(); -- cgit v1.2.3 From 799c96661d7dc8ea89517fa0be205e72ea2f717e Mon Sep 17 00:00:00 2001 From: Tycho Date: Thu, 25 Sep 2014 15:45:39 +0100 Subject: Fixed style --- src/BlockInfo.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/BlockInfo.h') diff --git a/src/BlockInfo.h b/src/BlockInfo.h index bfa62a132..1e4cf2ca0 100644 --- a/src/BlockInfo.h +++ b/src/BlockInfo.h @@ -19,8 +19,8 @@ public: /** Returns the associated BlockInfo structure for the specified block type. */ /** This accessor makes sure that the cBlockInfo structures are properly initialized exactly once. -It does so by using the C++ singleton approximation - storing the actual singleton as the function's static variable. -It works only if it is called for the first time before the app spawns other threads. */ + It does so by using the C++ singleton approximation - storing the actual singleton as the function's static variable. + It works only if it is called for the first time before the app spawns other threads. */ static cBlockInfo & Get(BLOCKTYPE a_Type) { static cBlockInfo ms_Info[256]; -- cgit v1.2.3