BlockHandler initialisation is a constant expression (#4891)

* BlockHandler initialisation is a constant expression

If we can't make it all namespaces, this is the next best I guess.

+ Tag handlers constexpr, const as needed
+ Inherit constructors
* Privatise handler functions

* More constexpr

Co-authored-by: Alexander Harkness <me@bearbin.net>
This commit is contained in:
Tiger Wang
2020-09-20 13:50:52 +00:00
committed by GitHub
co-authored by Alexander Harkness
parent 6a0669fb98
commit 68cced73af
115 changed files with 1773 additions and 2242 deletions
+4 -8
View File
@@ -13,16 +13,12 @@ class cBlockCobWebHandler :
public cBlockHandler
{
public:
cBlockCobWebHandler(BLOCKTYPE a_BlockType)
: cBlockHandler(a_BlockType)
{
}
using cBlockHandler::cBlockHandler;
private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, cBlockEntity * a_BlockEntity, const cEntity * a_Digger, const cItem * a_Tool) override
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, cBlockEntity * a_BlockEntity, const cEntity * a_Digger, const cItem * a_Tool) const override
{
// Silk touch gives cobweb, anything else gives just string:
if (ToolHasSilkTouch(a_Tool))
@@ -39,7 +35,7 @@ public:
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override
{
UNUSED(a_Meta);
return 3;