fix(Core): Deeprun Tram Subway timer/syncronization by loading grid (#23009)
This commit is contained in:
@@ -448,31 +448,45 @@ void TransportMgr::SpawnContinentTransports()
|
|||||||
LOG_INFO("server.loading", ">> Spawned {} continent motion transports in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
|
LOG_INFO("server.loading", ">> Spawned {} continent motion transports in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Preloads Deeprun Tram to fix issues with Subway carts syncronization
|
||||||
|
/// @todo: This is a temporary workaround. Consider removing TransportMgr::PreloadGridsFromQuery() as part of fix.
|
||||||
|
/**
|
||||||
|
Takenbacon: "In the long run the most likely ideal fix would be to always spawn all transport types (and thus loading their grid) on map creation"
|
||||||
|
See https://github.com/azerothcore/azerothcore-wotlk/pull/23009 for more details.
|
||||||
|
*/
|
||||||
|
PreloadGridsFromQuery("SELECT map, position_x, position_y FROM gameobject g JOIN gameobject_template t ON g.id = t.entry WHERE t.type = 11 AND g.map = 369", count);
|
||||||
|
|
||||||
if (sWorld->getBoolConfig(CONFIG_ENABLE_CONTINENT_TRANSPORT_PRELOADING))
|
if (sWorld->getBoolConfig(CONFIG_ENABLE_CONTINENT_TRANSPORT_PRELOADING))
|
||||||
{
|
{
|
||||||
// pussywizard: preload grids for continent static transports
|
// pussywizard: preload grids for continent static transports
|
||||||
QueryResult result2 = WorldDatabase.Query("SELECT map, position_x, position_y FROM gameobject g JOIN gameobject_template t ON g.id = t.entry WHERE t.type = 11");
|
PreloadGridsFromQuery("SELECT map, position_x, position_y FROM gameobject g JOIN gameobject_template t ON g.id = t.entry WHERE t.type = 11 AND g.map != 369", count);
|
||||||
|
LOG_INFO("server.loading", ">> Preloaded grids for {} continent static transports in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (result2)
|
void TransportMgr::PreloadGridsFromQuery(std::string const& query, uint32& count)
|
||||||
|
{
|
||||||
|
if (QueryResult result = WorldDatabase.Query(query))
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
Field* fields = result2->Fetch();
|
Field* fields = result->Fetch();
|
||||||
uint16 mapId = fields[0].Get<uint16>();
|
uint16 mapId = fields[0].Get<uint16>();
|
||||||
float x = fields[1].Get<float>();
|
float x = fields[1].Get<float>();
|
||||||
float y = fields[2].Get<float>();
|
float y = fields[2].Get<float>();
|
||||||
|
|
||||||
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
|
if (MapEntry const* mapEntry = sMapStore.LookupEntry(mapId))
|
||||||
if (mapEntry && !mapEntry->Instanceable())
|
{
|
||||||
|
if (!mapEntry->Instanceable())
|
||||||
|
{
|
||||||
if (Map* map = sMapMgr->CreateBaseMap(mapId))
|
if (Map* map = sMapMgr->CreateBaseMap(mapId))
|
||||||
{
|
{
|
||||||
map->LoadGrid(x, y);
|
map->LoadGrid(x, y);
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
} while (result2->NextRow());
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
LOG_INFO("server.loading", ">> Preloaded grids for {} continent static transports in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
|
} while (result->NextRow());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -158,6 +158,8 @@ private:
|
|||||||
TransportInstanceMap _instanceTransports;
|
TransportInstanceMap _instanceTransports;
|
||||||
|
|
||||||
TransportAnimationContainer _transportAnimations;
|
TransportAnimationContainer _transportAnimations;
|
||||||
|
|
||||||
|
void PreloadGridsFromQuery(std::string const& query, uint32& count);
|
||||||
};
|
};
|
||||||
|
|
||||||
#define sTransportMgr TransportMgr::instance()
|
#define sTransportMgr TransportMgr::instance()
|
||||||
|
|||||||
Reference in New Issue
Block a user