From 68cced73afe546328cf94ed07c57deee47bfadec Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 20 Sep 2020 14:50:52 +0100 Subject: 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 --- src/Items/ItemChest.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/Items/ItemChest.h') diff --git a/src/Items/ItemChest.h b/src/Items/ItemChest.h index ecd957a59..8548f8d25 100644 --- a/src/Items/ItemChest.h +++ b/src/Items/ItemChest.h @@ -50,9 +50,8 @@ public: NIBBLETYPE ClickedBlockMeta; a_World.GetBlockTypeMeta(a_ClickedBlockPos, ClickedBlockType, ClickedBlockMeta); cChunkInterface ChunkInterface(a_World.GetChunkMap()); - auto blockHandler = BlockHandler(ClickedBlockType); Vector3i PlacePos; - if (blockHandler->DoesIgnoreBuildCollision(ChunkInterface, a_ClickedBlockPos, a_Player, ClickedBlockMeta)) + if (cBlockHandler::For(ClickedBlockType).DoesIgnoreBuildCollision(ChunkInterface, a_ClickedBlockPos, a_Player, ClickedBlockMeta)) { PlacePos = a_ClickedBlockPos; } @@ -69,8 +68,7 @@ public: BLOCKTYPE PlaceBlock; NIBBLETYPE PlaceMeta; a_World.GetBlockTypeMeta(PlacePos, PlaceBlock, PlaceMeta); - blockHandler = BlockHandler(PlaceBlock); - if (!blockHandler->DoesIgnoreBuildCollision(ChunkInterface, PlacePos, a_Player, PlaceMeta)) + if (!cBlockHandler::For(PlaceBlock).DoesIgnoreBuildCollision(ChunkInterface, PlacePos, a_Player, PlaceMeta)) { return false; } -- cgit v1.2.3