Core/Pools: Fix pools with 1 member never spawning anything anymore (#26620)

* Core/Pools: Fix pools with 1 member never spawning anything anymore

Attempts to fix a 6 years old bug and never fixed by the original author.

* Remove respawn times from db once a respawn has been handled

* Allow to specify if Despawn1Object() should save or not the respawn time. We don't need to do that when respawning an object.

* Apply the same fix to GameObjects too
This commit is contained in:
Giacomo Pozzoni
2021-06-26 14:21:18 +02:00
committed by GitHub
parent 6c5b641dd4
commit c8ca48823d
4 changed files with 23 additions and 15 deletions

View File

@@ -3267,6 +3267,7 @@ void Map::ProcessRespawns()
sPoolMgr->UpdatePool(poolId, next->type, next->spawnId);
// step 3: get rid of the actual entry
RemoveRespawnTime(next->type, next->spawnId, nullptr, true);
delete next;
}
else if (CheckRespawn(next)) // see if we're allowed to respawn
@@ -3279,12 +3280,14 @@ void Map::ProcessRespawns()
DoRespawn(next->type, next->spawnId, next->gridId);
// step 3: get rid of the actual entry
RemoveRespawnTime(next->type, next->spawnId, nullptr, true);
delete next;
}
else if (!next->respawnTime)
{ // just remove this respawn entry without rescheduling
_respawnTimes.pop();
GetRespawnMapForType(next->type).erase(next->spawnId);
RemoveRespawnTime(next->type, next->spawnId, nullptr, true);
delete next;
}
else