fix (core) : TransportMgr Load up time (#10388)

* fix (core) : TransportMgr Load up time

* white space fix

* merge fix

* merge fix again

* Update TransportMgr.cpp

* Update TransportMgr.cpp

* Update TransportMgr.cpp

* fix conflich with preload grids for continent static transports
This commit is contained in:
acidmanifesto
2022-01-29 10:44:19 -05:00
committed by GitHub
parent 915b6a2738
commit 8207e3ffb5

View File

@@ -423,13 +423,13 @@ void TransportMgr::SpawnContinentTransports()
if (_transportTemplates.empty())
return;
uint32 oldMSTime, count = 0;
oldMSTime = getMSTime();
QueryResult result;
uint32 count = 0;
uint32 oldMSTime = getMSTime();
QueryResult result = WorldDatabase.Query("SELECT guid, entry FROM transports");
if (sWorld->getBoolConfig(CONFIG_ENABLE_CONTINENT_TRANSPORT))
{
result = WorldDatabase.Query("SELECT guid, entry FROM transports");
if (result)
{
do
@@ -442,39 +442,38 @@ void TransportMgr::SpawnContinentTransports()
if (!tInfo->inInstance)
if (CreateTransport(entry, guid))
++count;
} while (result->NextRow());
}
LOG_INFO("server.loading", ">> Spawned {} continent motion transports in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server.loading", " ");
}
if (sWorld->getBoolConfig(CONFIG_ENABLE_CONTINENT_TRANSPORT_PRELOADING))
if (sWorld->getBoolConfig(CONFIG_ENABLE_CONTINENT_TRANSPORT_PRELOADING))
{
// 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");
if (result2)
{
// pussywizard: preload grids for continent static transports
oldMSTime = getMSTime();
result = WorldDatabase.Query("SELECT map, position_x, position_y FROM gameobject g JOIN gameobject_template t ON g.id = t.entry WHERE t.type = 11");
count = 0;
if (result)
do
{
do
{
Field* fields = result->Fetch();
uint16 mapId = fields[0].GetUInt16();
float x = fields[1].GetFloat();
float y = fields[2].GetFloat();
Field* fields = result2->Fetch();
uint16 mapId = fields[0].GetUInt16();
float x = fields[1].GetFloat();
float y = fields[2].GetFloat();
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
if (mapEntry && !mapEntry->Instanceable())
if (Map* map = sMapMgr->CreateBaseMap(mapId))
{
map->LoadGrid(x, y);
++count;
}
} while (result->NextRow());
}
LOG_INFO("server.loading", ">> Preloaded grids for {} continent static transports in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
if (mapEntry && !mapEntry->Instanceable())
if (Map* map = sMapMgr->CreateBaseMap(mapId))
{
map->LoadGrid(x, y);
++count;
}
} while (result2->NextRow());
}
LOG_INFO("server.loading", ">> Preloaded grids for {} continent static transports in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}