From b5b119ca750a1790848b514bb00831b050f25fac Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 18 Dec 2016 20:41:37 +0000 Subject: good --- src/MobSpawner.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/MobSpawner.cpp') diff --git a/src/MobSpawner.cpp b/src/MobSpawner.cpp index 60f7cfb43..b6ad261b5 100644 --- a/src/MobSpawner.cpp +++ b/src/MobSpawner.cpp @@ -347,15 +347,14 @@ bool cMobSpawner::CanSpawnHere(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_R -cMonster * cMobSpawner::TryToSpawnHere(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, EMCSBiome a_Biome, int & a_MaxPackSize) +std::unique_ptr cMobSpawner::TryToSpawnHere(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, EMCSBiome a_Biome, int & a_MaxPackSize) { - cMonster * toReturn = nullptr; if (m_NewPack) { m_MobType = ChooseMobType(a_Biome); if (m_MobType == mtInvalidType) { - return toReturn; + return nullptr; } if (m_MobType == mtWolf) { @@ -373,14 +372,15 @@ cMonster * cMobSpawner::TryToSpawnHere(cChunk * a_Chunk, int a_RelX, int a_RelY, if ((m_AllowedTypes.find(m_MobType) != m_AllowedTypes.end()) && CanSpawnHere(a_Chunk, a_RelX, a_RelY, a_RelZ, m_MobType, a_Biome)) { - cMonster * newMob = cMonster::NewMonsterFromType(m_MobType); + auto newMob = cMonster::NewMonsterFromType(m_MobType); if (newMob) { - m_Spawned.insert(newMob); + m_Spawned.insert(std::move(newMob)); } - toReturn = newMob; + return newMob; } - return toReturn; + + return nullptr; } -- cgit v1.2.3