1
0

Changed entity ownership model to use smart pointers

This commit is contained in:
Tiger Wang
2016-12-19 20:12:23 +00:00
parent 07f25253a2
commit 4ef47aed62
39 changed files with 484 additions and 425 deletions

View File

@@ -178,7 +178,7 @@ void cMobSpawnerEntity::SpawnEntity(void)
double PosX = Chunk->GetPosX() * cChunkDef::Width + RelX;
double PosZ = Chunk->GetPosZ() * cChunkDef::Width + RelZ;
cMonster * Monster = cMonster::NewMonsterFromType(m_MobType);
auto Monster = cMonster::NewMonsterFromType(m_MobType);
if (Monster == nullptr)
{
continue;
@@ -186,7 +186,7 @@ void cMobSpawnerEntity::SpawnEntity(void)
Monster->SetPosition(PosX, RelY, PosZ);
Monster->SetYaw(Random.RandReal(360.0f));
if (Chunk->GetWorld()->SpawnMobFinalize(Monster) != cEntity::INVALID_ID)
if (Chunk->GetWorld()->SpawnMobFinalize(std::move(Monster)) != cEntity::INVALID_ID)
{
EntitiesSpawned = true;
Chunk->BroadcastSoundParticleEffect(