Core/Transports: no longer allow transports to spawn on invalid maps

This commit is contained in:
Ovahlord
2024-03-10 06:16:59 +01:00
parent 8502558037
commit 263bae78ee

View File

@@ -223,6 +223,29 @@ void TransportMgr::LoadTransportTemplates()
if (!goInfo->moTransport.taxiPathID)
continue;
if (!sTaxiPathStore.LookupEntry(goInfo->moTransport.taxiPathID))
{
TC_LOG_ERROR("sql.sql", "Transport {} (name: {}) has an invalid path specified in `gameobject_template`.`Data0` ({}) field, skipped.", entry, goInfo->name.c_str(), goInfo->moTransport.taxiPathID);
continue;
}
bool hasValidMaps = true;
for (uint32 mapId : _transportTemplates[entry].MapIds)
{
if (!sMapStore.LookupEntry(mapId))
{
hasValidMaps = false;
break;
}
}
if (!hasValidMaps)
{
TC_LOG_ERROR("sql.sql", "Transport {} (name: {}) is trying to spawn on a map which does not exist, skipped.", entry, goInfo->name.c_str());
_transportTemplates.erase(entry);
continue;
}
// paths are generated per template, saves us from generating it again in case of instanced transports
TransportTemplate& transport = _transportTemplates[entry];