summaryrefslogtreecommitdiffstats
path: root/src/BlockInfo.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-06-24 22:15:48 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-06-24 22:15:48 +0200
commitbd5df3d3b975c448e3d8f4227d86a742d0ad3b12 (patch)
tree30193169848d8ea39e2e5a423bd9e1a8e189c5f6 /src/BlockInfo.cpp
parentConforms to standards (diff)
parentMerge pull request #1125 from Howaner/Entities (diff)
downloadcuberite-bd5df3d3b975c448e3d8f4227d86a742d0ad3b12.tar
cuberite-bd5df3d3b975c448e3d8f4227d86a742d0ad3b12.tar.gz
cuberite-bd5df3d3b975c448e3d8f4227d86a742d0ad3b12.tar.bz2
cuberite-bd5df3d3b975c448e3d8f4227d86a742d0ad3b12.tar.lz
cuberite-bd5df3d3b975c448e3d8f4227d86a742d0ad3b12.tar.xz
cuberite-bd5df3d3b975c448e3d8f4227d86a742d0ad3b12.tar.zst
cuberite-bd5df3d3b975c448e3d8f4227d86a742d0ad3b12.zip
Diffstat (limited to 'src/BlockInfo.cpp')
-rw-r--r--src/BlockInfo.cpp21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/BlockInfo.cpp b/src/BlockInfo.cpp
index 32fdec905..b084d0915 100644
--- a/src/BlockInfo.cpp
+++ b/src/BlockInfo.cpp
@@ -9,6 +9,7 @@
cBlockInfo cBlockInfo::ms_Info[256];
+static bool g_IsBlockInfoInitialized = false;
@@ -43,6 +44,11 @@ cBlockInfo::~cBlockInfo()
cBlockInfo & cBlockInfo::Get(BLOCKTYPE a_Type)
{
+ if (!g_IsBlockInfoInitialized)
+ {
+ cBlockInfo::Initialize();
+ g_IsBlockInfoInitialized = true;
+ }
return ms_Info[a_Type];
}
@@ -448,18 +454,3 @@ void cBlockInfo::Initialize(void)
-
-// This is actually just some code that needs to run at program startup, so it is wrapped into a global var's constructor:
-class cBlockInfoInitializer
-{
-public:
- cBlockInfoInitializer(void)
- {
- cBlockInfo::Initialize();
- }
-} BlockInfoInitializer;
-
-
-
-
-