diff options
| author | Treeston <treeston.mmoc@gmail.com> | 2019-07-07 19:18:32 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2021-12-14 22:24:24 +0100 |
| commit | 2225cb120100da741814dec7515b191cc68f07be (patch) | |
| tree | 221e60fd68018a13249726d9bd34be2bcfa58d1c /src/server/game | |
| parent | f21599dc5dab71cc0775d6ed5d2b2f6f2f4c6780 (diff) | |
Entities/Creature: Some asserts are now LOG_ERRORs that block spawning. Fix a group spawning bug exposed by the CoS merge. Improve some command output.
(cherry picked from commit ded18a2690063991d5440df7d3e5d526b884ec16)
Diffstat (limited to 'src/server/game')
| -rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 26 | ||||
| -rw-r--r-- | src/server/game/Maps/Map.cpp | 4 |
2 files changed, 24 insertions, 6 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 4d5dc0b1d58..81c4791e2a5 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1756,14 +1756,32 @@ bool Creature::LoadFromDB(ObjectGuid::LowType spawnId, Map* map, bool addToMap, if (!m_respawnTime && !map->IsSpawnGroupActive(data->spawnGroupData->groupId)) { - // @todo pools need fixing! this is just a temporary crashfix, but they violate dynspawn principles - ASSERT(m_respawnCompatibilityMode || sPoolMgr->IsPartOfAPool<Creature>(spawnId), "Creature (SpawnID " UI64FMTD ") trying to load in inactive spawn group %s.", spawnId, data->spawnGroupData->name.c_str()); + if (!m_respawnCompatibilityMode) + { + // @todo pools need fixing! this is just a temporary thing, but they violate dynspawn principles + if (!sPoolMgr->IsPartOfAPool<Creature>(spawnId)) + { + TC_LOG_ERROR("entities.unit", "Creature (SpawnID " UI64FMTD ") trying to load in inactive spawn group '%s':\n%s", spawnId, data->spawnGroupData->name.c_str(), GetDebugInfo().c_str()); + return false; + } + } + m_respawnTime = GameTime::GetGameTime() + urand(4, 7); } - if (m_respawnTime) // respawn on Update + if (m_respawnTime) { - ASSERT(m_respawnCompatibilityMode || sPoolMgr->IsPartOfAPool<Creature>(spawnId), "Creature (SpawnID " UI64FMTD ") trying to load despite a respawn timer in progress.", spawnId); + if (!m_respawnCompatibilityMode) + { + // @todo same as above + if (!sPoolMgr->IsPartOfAPool<Creature>(spawnId)) + { + TC_LOG_ERROR("entities.unit", "Creature (SpawnID " UI64FMTD ") trying to load despite a respawn timer in progress:\n%s", spawnId, GetDebugInfo().c_str()); + return false; + } + } + + // compatibility mode creatures will be respawned in ::Update() m_deathState = DEAD; if (CanFly()) { diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index f0504dc4252..8d8a6f2d4bd 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -3456,9 +3456,9 @@ bool Map::SpawnGroupSpawn(uint32 groupId, bool ignoreRespawn, bool force, std::v continue; time_t respawnTime = GetRespawnTime(data->type, data->spawnId); - if (respawnTime && respawnTime > GameTime::GetGameTime()) + if (respawnTime) { - if (!force && !ignoreRespawn) + if (!force && !ignoreRespawn && (respawnTime > GameTime::GetGameTime())) continue; // we need to remove the respawn time, otherwise we'd end up double spawning |
