From 01b8ed5295875262a91b60af878bf2a18c1b7aae Mon Sep 17 00:00:00 2001 From: Mattes D Date: Fri, 3 Apr 2020 08:57:01 +0200 Subject: Pulled the BlockID and BlockInfo headers from Globals.h. (#4591) The BlockID.h file was removed from Globals.h and renamed to BlockType.h (main change) The BlockInfo.h file was removed from Globals.h (main change) The ENUM_BLOCK_ID and ENUM_ITEM_ID enum names were replaced with ENUM_BLOCK_TYPE and ENUM_ITEM_TYPE (cosmetics) The various enums, such as eDimension, eDamageType and eExplosionSource were moved from BlockType.h to Defines.h, together with the helper functions for converting between them and strings (StringToDimension et al.) (minor) Many inline functions were moved from headers to their respective cpp files, so that BlockType.h could be included only into the cpp file, rather than the header. That broke our tests a bit, since they pick bits and pieces out of the main code and provide stubs for the rest; they had to be re-stubbed and re-verified. eMonsterType values are no longer tied to E_ITEM_SPAWN_EGG_META_* values --- src/Items/ItemBigFlower.h | 1 + src/Items/ItemBottle.h | 1 + src/Items/ItemBucket.h | 3 ++- src/Items/ItemChest.h | 1 + src/Items/ItemPickaxe.h | 2 +- src/Items/ItemShears.h | 4 ++-- src/Items/ItemSword.h | 6 +++--- 7 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src/Items') diff --git a/src/Items/ItemBigFlower.h b/src/Items/ItemBigFlower.h index d433c4b87..8e96ad602 100644 --- a/src/Items/ItemBigFlower.h +++ b/src/Items/ItemBigFlower.h @@ -2,6 +2,7 @@ #pragma once #include "ItemHandler.h" +#include "../BlockInfo.h" diff --git a/src/Items/ItemBottle.h b/src/Items/ItemBottle.h index 18767dcde..319bc708f 100644 --- a/src/Items/ItemBottle.h +++ b/src/Items/ItemBottle.h @@ -2,6 +2,7 @@ #pragma once #include "ItemHandler.h" +#include "../BlockInfo.h" #include "../World.h" diff --git a/src/Items/ItemBucket.h b/src/Items/ItemBucket.h index 8affff6ca..7b837d449 100644 --- a/src/Items/ItemBucket.h +++ b/src/Items/ItemBucket.h @@ -2,6 +2,7 @@ #pragma once #include "ItemHandler.h" +#include "../BlockInfo.h" #include "../World.h" #include "../Simulator/FluidSimulator.h" #include "../Blocks/BlockHandler.h" @@ -70,7 +71,7 @@ public: } BLOCKTYPE Block = a_World->GetBlock(BlockPos.x, BlockPos.y, BlockPos.z); - ENUM_ITEM_ID NewItemType; + ENUM_ITEM_TYPE NewItemType; if (IsBlockWater(Block)) { diff --git a/src/Items/ItemChest.h b/src/Items/ItemChest.h index 817020a25..ac4e4b471 100644 --- a/src/Items/ItemChest.h +++ b/src/Items/ItemChest.h @@ -2,6 +2,7 @@ #pragma once #include "ItemHandler.h" +#include "../BlockInfo.h" #include "../Blocks/BlockChest.h" diff --git a/src/Items/ItemPickaxe.h b/src/Items/ItemPickaxe.h index a23e9ec6d..58df18428 100644 --- a/src/Items/ItemPickaxe.h +++ b/src/Items/ItemPickaxe.h @@ -168,7 +168,7 @@ public: virtual float GetBlockBreakingStrength(BLOCKTYPE a_Block) override { - if (!IsBlockMaterialIron(a_Block) && !IsBlockMaterialAnvil(a_Block) && !IsBlockMaterialRock(a_Block)) + if (!IsBlockMaterialIron(a_Block) && (a_Block != E_BLOCK_ANVIL) && !IsBlockMaterialRock(a_Block)) { return super::GetBlockBreakingStrength(a_Block); } diff --git a/src/Items/ItemShears.h b/src/Items/ItemShears.h index 9a6baa5e1..2ceb371f4 100644 --- a/src/Items/ItemShears.h +++ b/src/Items/ItemShears.h @@ -78,11 +78,11 @@ public: virtual float GetBlockBreakingStrength(BLOCKTYPE a_Block) override { - if (IsBlocksWeb(a_Block) || IsBlockMaterialLeaves(a_Block)) + if ((a_Block == E_BLOCK_COBWEB) || IsBlockMaterialLeaves(a_Block)) { return 15.0f; } - else if (IsBlocksWool(a_Block)) + else if (a_Block == E_BLOCK_WOOL) { return 5.0f; } diff --git a/src/Items/ItemSword.h b/src/Items/ItemSword.h index 06543c37e..cdb85727c 100644 --- a/src/Items/ItemSword.h +++ b/src/Items/ItemSword.h @@ -2,6 +2,7 @@ #pragma once #include "ItemHandler.h" +#include "../BlockInfo.h" @@ -12,8 +13,8 @@ class cItemSwordHandler : { typedef cItemHandler super; public: - cItemSwordHandler(int a_ItemType) - : cItemHandler(a_ItemType) + cItemSwordHandler(int a_ItemType): + cItemHandler(a_ItemType) { } @@ -66,7 +67,6 @@ public: if ( IsBlockMaterialPlants(a_Block) || IsBlockMaterialVine(a_Block) || - IsBlockMaterialCoral(a_Block) || IsBlockMaterialLeaves(a_Block) || IsBlockMaterialGourd(a_Block) ) -- cgit v1.2.3