diff options
author | madmaxoft <github@xoft.cz> | 2013-10-20 13:33:23 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2013-10-20 13:33:23 +0200 |
commit | d16d0a7ab75ca2b63de55a3e68ea58075c42277d (patch) | |
tree | cffe915f423afabb976bee8d3a06fc2b950512ad /source/MobSpawner.cpp | |
parent | Moved all MobTypesManager functions to cMonster. (diff) | |
download | cuberite-d16d0a7ab75ca2b63de55a3e68ea58075c42277d.tar cuberite-d16d0a7ab75ca2b63de55a3e68ea58075c42277d.tar.gz cuberite-d16d0a7ab75ca2b63de55a3e68ea58075c42277d.tar.bz2 cuberite-d16d0a7ab75ca2b63de55a3e68ea58075c42277d.tar.lz cuberite-d16d0a7ab75ca2b63de55a3e68ea58075c42277d.tar.xz cuberite-d16d0a7ab75ca2b63de55a3e68ea58075c42277d.tar.zst cuberite-d16d0a7ab75ca2b63de55a3e68ea58075c42277d.zip |
Diffstat (limited to '')
-rw-r--r-- | source/MobSpawner.cpp | 76 |
1 files changed, 33 insertions, 43 deletions
diff --git a/source/MobSpawner.cpp b/source/MobSpawner.cpp index 75232b30f..1b3796f70 100644 --- a/source/MobSpawner.cpp +++ b/source/MobSpawner.cpp @@ -4,46 +4,6 @@ #include "MobSpawner.h" #include "Mobs/IncludeAllMonsters.h" -cMobSpawner::tMobTypes& cMobSpawner::m_MobTypes() -{ - static tMobTypes* value = new tMobTypes(initMobTypesBeforeCx11()); - return *value; -} - -cMobSpawner::tMobTypes cMobSpawner::initMobTypesBeforeCx11() -{ - std::set<cMonster::eType> toReturn; - toReturn.insert(cMonster::mtCreeper); - toReturn.insert(cMonster::mtSkeleton); - toReturn.insert(cMonster::mtSpider); - toReturn.insert(cMonster::mtGiant); - toReturn.insert(cMonster::mtZombie); - toReturn.insert(cMonster::mtSlime); - toReturn.insert(cMonster::mtGhast); - toReturn.insert(cMonster::mtZombiePigman); - toReturn.insert(cMonster::mtEnderman); - toReturn.insert(cMonster::mtCaveSpider); - toReturn.insert(cMonster::mtSilverfish); - toReturn.insert(cMonster::mtBlaze); - toReturn.insert(cMonster::mtMagmaCube); - toReturn.insert(cMonster::mtEnderDragon); - toReturn.insert(cMonster::mtWither); - toReturn.insert(cMonster::mtBat); - toReturn.insert(cMonster::mtWitch); - toReturn.insert(cMonster::mtPig); - toReturn.insert(cMonster::mtSheep); - toReturn.insert(cMonster::mtCow); - toReturn.insert(cMonster::mtChicken); - toReturn.insert(cMonster::mtSquid); - toReturn.insert(cMonster::mtWolf); - toReturn.insert(cMonster::mtMooshroom); - toReturn.insert(cMonster::mtSnowGolem); - toReturn.insert(cMonster::mtOcelot); - toReturn.insert(cMonster::mtIronGolem); - toReturn.insert(cMonster::mtVillager); - return toReturn; -} - @@ -80,6 +40,10 @@ bool cMobSpawner::CheckPackCenter(BLOCKTYPE a_BlockType) } } + + + + void cMobSpawner::addIfAllowed(cMonster::eType toAdd, std::set<cMonster::eType>& toAddIn) { std::set<cMonster::eType>::iterator itr = m_AllowedTypes.find(toAdd); @@ -89,6 +53,10 @@ void cMobSpawner::addIfAllowed(cMonster::eType toAdd, std::set<cMonster::eType>& } } + + + + cMonster::eType cMobSpawner::ChooseMobType(EMCSBiome a_Biome) { std::set<cMonster::eType> allowedMobs; @@ -153,6 +121,9 @@ cMonster::eType cMobSpawner::ChooseMobType(EMCSBiome a_Biome) } + + + bool cMobSpawner::CanSpawnHere(cMonster::eType a_MobType, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, BLOCKTYPE a_BlockType_below, NIBBLETYPE a_BlockMeta_below, BLOCKTYPE a_BlockType_above, NIBBLETYPE a_BlockMeta_above, EMCSBiome a_Biome, int a_Level) { bool toReturn = false; @@ -230,6 +201,9 @@ bool cMobSpawner::CanSpawnHere(cMonster::eType a_MobType, BLOCKTYPE a_BlockType, } + + + cMonster* cMobSpawner::TryToSpawnHere(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, BLOCKTYPE a_BlockType_below, NIBBLETYPE a_BlockMeta_below, BLOCKTYPE a_BlockType_above, NIBBLETYPE a_BlockMeta_above, EMCSBiome a_Biome, int a_Level, int& a_MaxPackSize) { cMonster* toReturn = NULL; @@ -264,17 +238,33 @@ cMonster* cMobSpawner::TryToSpawnHere(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockM return toReturn; } + + + + void cMobSpawner::NewPack() { m_NewPack = true; } -cMobSpawner::tSpawnedContainer& cMobSpawner::getSpawned() + + + + +cMobSpawner::tSpawnedContainer & cMobSpawner::getSpawned(void) { return m_Spawned; } -bool cMobSpawner::CanSpawnSomething() + + + + +bool cMobSpawner::CanSpawnAnything(void) { - return m_AllowedTypes.size() > 0; + return !m_AllowedTypes.empty(); } + + + + |