From 3ff57559e36d3254c64e334fbe3bdd47398fe16f Mon Sep 17 00:00:00 2001 From: x12xx12x <44411062+12xx12@users.noreply.github.com> Date: Thu, 2 Dec 2021 00:31:10 +0100 Subject: ItemHandler initialisation is a constant expression (#5344) * Transition to non-pointer item handler * That is my destructor - I decide when I leave this world * I declare your destruction private and you final --- src/Items/ItemPumpkin.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/Items/ItemPumpkin.h') diff --git a/src/Items/ItemPumpkin.h b/src/Items/ItemPumpkin.h index cd17472b5..d467cd94f 100644 --- a/src/Items/ItemPumpkin.h +++ b/src/Items/ItemPumpkin.h @@ -8,7 +8,7 @@ -class cItemPumpkinHandler: +class cItemPumpkinHandler final: public cItemHandler { using Super = cItemHandler; @@ -19,7 +19,7 @@ public: private: - virtual bool CommitPlacement(cPlayer & a_Player, const cItem & a_HeldItem, const Vector3i a_PlacePosition, const eBlockFace a_ClickedBlockFace, const Vector3i a_CursorPosition) override + virtual bool CommitPlacement(cPlayer & a_Player, const cItem & a_HeldItem, const Vector3i a_PlacePosition, const eBlockFace a_ClickedBlockFace, const Vector3i a_CursorPosition) const override { // First try spawning a snow golem or an iron golem: if (TrySpawnGolem(a_Player, a_PlacePosition)) @@ -39,7 +39,7 @@ private: /** Spawns a snow / iron golem if the shape matches the recipe, supposing that the block placed at the specified coords is a pumpkin. Returns true if the golem blocks are removed (for spawning), false if the recipe is not matched. */ - bool TrySpawnGolem(cPlayer & a_Player, const Vector3i a_PumpkinPos) + bool TrySpawnGolem(cPlayer & a_Player, const Vector3i a_PumpkinPos) const { // A golem can't form with a pumpkin below level 2 or above level 255: if ((a_PumpkinPos.y < 2) || (a_PumpkinPos.y >= cChunkDef::Height)) @@ -69,7 +69,7 @@ private: /** Spawns a snow golem if the shape matches the recipe, supposing that the block placed at the specified coords is a pumpkin. Returns true if the golem blocks are removed (for spawning), false if the recipe is not matched. Assumes that the block below the specified block has already been checked and is a snow block. */ - bool TrySpawnSnowGolem(cWorld & a_World, cPlayer & a_Player, const Vector3i a_PumpkinPos) + bool TrySpawnSnowGolem(cWorld & a_World, cPlayer & a_Player, const Vector3i a_PumpkinPos) const { ASSERT(a_PumpkinPos.y > 1); ASSERT(a_World.GetBlock(a_PumpkinPos.addedY(-1)) == E_BLOCK_SNOW_BLOCK); @@ -106,7 +106,7 @@ private: /** Spawns an iron golem if the shape matches the recipe, supposing that the block placed at the specified coords is a pumpkin. Returns true if the golem blocks are removed (for spawning), false if the recipe is not matched. Assumes that the block below the specified block has already been checked and is an iron block. */ - bool TrySpawnIronGolem(cWorld & a_World, cPlayer & a_Player, const Vector3i a_PumpkinPos) + bool TrySpawnIronGolem(cWorld & a_World, cPlayer & a_Player, const Vector3i a_PumpkinPos) const { ASSERT(a_PumpkinPos.y > 1); ASSERT(a_World.GetBlock(a_PumpkinPos.addedY(-1)) == E_BLOCK_IRON_BLOCK); -- cgit v1.2.3