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/Mobs/Monster.cpp | 1 + src/Mobs/MonsterTypes.h | 69 +++++++++++++++++++++++-------------------------- src/Mobs/Path.cpp | 1 + src/Mobs/PathFinder.cpp | 1 + src/Mobs/SnowGolem.cpp | 1 + 5 files changed, 36 insertions(+), 37 deletions(-) (limited to 'src/Mobs') diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index 233ca70b3..5a01663e5 100644 --- a/src/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp @@ -2,6 +2,7 @@ #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules #include "IncludeAllMonsters.h" +#include "../BlockInfo.h" #include "../Root.h" #include "../Server.h" #include "../ClientHandle.h" diff --git a/src/Mobs/MonsterTypes.h b/src/Mobs/MonsterTypes.h index 96b4d0df0..6aaa61dc6 100644 --- a/src/Mobs/MonsterTypes.h +++ b/src/Mobs/MonsterTypes.h @@ -6,47 +6,42 @@ // tolua_begin -/** Identifies individual monster type, as well as their network type-ID. */ +/** Identifies individual monster type. */ enum eMonsterType { mtInvalidType = -1, - mtBat = E_META_SPAWN_EGG_BAT, - mtBlaze = E_META_SPAWN_EGG_BLAZE, - mtCaveSpider = E_META_SPAWN_EGG_CAVE_SPIDER, - mtChicken = E_META_SPAWN_EGG_CHICKEN, - mtCow = E_META_SPAWN_EGG_COW, - mtCreeper = E_META_SPAWN_EGG_CREEPER, - mtEnderDragon = E_META_SPAWN_EGG_ENDER_DRAGON, - mtEnderman = E_META_SPAWN_EGG_ENDERMAN, - mtGhast = E_META_SPAWN_EGG_GHAST, - mtGiant = E_META_SPAWN_EGG_GIANT, - mtGuardian = E_META_SPAWN_EGG_GUARDIAN, - mtHorse = E_META_SPAWN_EGG_HORSE, - mtIronGolem = E_META_SPAWN_EGG_IRON_GOLEM, - mtMagmaCube = E_META_SPAWN_EGG_MAGMA_CUBE, - mtMooshroom = E_META_SPAWN_EGG_MOOSHROOM, - mtOcelot = E_META_SPAWN_EGG_OCELOT, - mtPig = E_META_SPAWN_EGG_PIG, - mtRabbit = E_META_SPAWN_EGG_RABBIT, - mtSheep = E_META_SPAWN_EGG_SHEEP, - mtSilverfish = E_META_SPAWN_EGG_SILVERFISH, - mtSkeleton = E_META_SPAWN_EGG_SKELETON, - mtSlime = E_META_SPAWN_EGG_SLIME, - mtSnowGolem = E_META_SPAWN_EGG_SNOW_GOLEM, - mtSpider = E_META_SPAWN_EGG_SPIDER, - mtSquid = E_META_SPAWN_EGG_SQUID, - mtVillager = E_META_SPAWN_EGG_VILLAGER, - mtWitch = E_META_SPAWN_EGG_WITCH, - mtWither = E_META_SPAWN_EGG_WITHER, - mtWolf = E_META_SPAWN_EGG_WOLF, - mtZombie = E_META_SPAWN_EGG_ZOMBIE, - mtZombiePigman = E_META_SPAWN_EGG_ZOMBIE_PIGMAN, - mtMax = 120, // This is just a hotfix for https://forum.cuberite.org/thread-1616.html. Tolua is too bad to find the highest value, so this is needed. + mtBat, + mtBlaze, + mtCaveSpider, + mtChicken, + mtCow, + mtCreeper, + mtEnderDragon, + mtEnderman, + mtGhast, + mtGiant, + mtGuardian, + mtHorse, + mtIronGolem, + mtMagmaCube, + mtMooshroom, + mtOcelot, + mtPig, + mtRabbit, + mtSheep, + mtSilverfish, + mtSkeleton, + mtSlime, + mtSnowGolem, + mtSpider, + mtSquid, + mtVillager, + mtWitch, + mtWither, + mtWolf, + mtZombie, + mtZombiePigman, } ; // tolua_end - - - - diff --git a/src/Mobs/Path.cpp b/src/Mobs/Path.cpp index fa57fa1ca..a2a5cf51c 100644 --- a/src/Mobs/Path.cpp +++ b/src/Mobs/Path.cpp @@ -2,6 +2,7 @@ #include "Globals.h" #include "Path.h" +#include "../BlockInfo.h" #include "../Chunk.h" #define JUMP_G_COST 20 diff --git a/src/Mobs/PathFinder.cpp b/src/Mobs/PathFinder.cpp index a4f237fbd..f2542cebc 100644 --- a/src/Mobs/PathFinder.cpp +++ b/src/Mobs/PathFinder.cpp @@ -1,5 +1,6 @@ #include "Globals.h" #include "PathFinder.h" +#include "../BlockInfo.h" #include "../Chunk.h" diff --git a/src/Mobs/SnowGolem.cpp b/src/Mobs/SnowGolem.cpp index 3ea97173f..ce94c9dae 100644 --- a/src/Mobs/SnowGolem.cpp +++ b/src/Mobs/SnowGolem.cpp @@ -2,6 +2,7 @@ #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules #include "SnowGolem.h" +#include "../BlockInfo.h" #include "../World.h" -- cgit v1.2.3