summaryrefslogtreecommitdiffstats
path: root/src/BlockInfo.h
blob: 1e09b0df5adfbf320c1cca3651b94ccf971f3ce4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

#pragma once






class BlockInfo
{
public:

	BlockInfo();

	/** (Re-)Initializes the internal BlockInfo structures. */
	static void Initialize(void);

	/** Returns the associated BlockInfo structure. */
	static BlockInfo & GetById(unsigned int a_ID);

	NIBBLETYPE m_LightValue;
	NIBBLETYPE m_SpreadLightFalloff;

	bool m_Transparent;
	bool m_OneHitDig;
	bool m_PistonBreakable;
	bool m_IsSnowable;
	bool m_RequiresSpecialTool;
	bool m_IsSolid;
	bool m_FullyOccupiesVoxel;


	inline static NIBBLETYPE GetLightValue        (unsigned int a_ID) { return GetById(a_ID).m_LightValue;          }
	inline static NIBBLETYPE GetSpreadLightFalloff(unsigned int a_ID) { return GetById(a_ID).m_SpreadLightFalloff;  }
	inline static bool IsTransparent              (unsigned int a_ID) { return GetById(a_ID).m_Transparent;         }
	inline static bool IsOneHitDig                (unsigned int a_ID) { return GetById(a_ID).m_OneHitDig;           }
	inline static bool IsPistoneBreakable         (unsigned int a_ID) { return GetById(a_ID).m_PistonBreakable;     }
	inline static bool IsSnowable                 (unsigned int a_ID) { return GetById(a_ID).m_IsSnowable;          }
	inline static bool RequiresSpecialTool        (unsigned int a_ID) { return GetById(a_ID).m_RequiresSpecialTool; }
	inline static bool IsSolid                    (unsigned int a_ID) { return GetById(a_ID).m_IsSolid;             }
	inline static bool FullyOccupiesVoxel         (unsigned int a_ID) { return GetById(a_ID).m_FullyOccupiesVoxel;  }


protected:

	// TODO xdot: Change to std::vector to support dynamic block IDs
	static BlockInfo ms_Info[256];


};