Changed entity ownership model to use smart pointers
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user