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
+27 -28
View File
@@ -423,13 +423,13 @@ void TransportMgr::SpawnContinentTransports()
if (_transportTemplates.empty()) if (_transportTemplates.empty())
return; return;
uint32 oldMSTime, count = 0; uint32 count = 0;
oldMSTime = getMSTime(); uint32 oldMSTime = getMSTime();
QueryResult result; QueryResult result = WorldDatabase.Query("SELECT guid, entry FROM transports");
if (sWorld->getBoolConfig(CONFIG_ENABLE_CONTINENT_TRANSPORT)) if (sWorld->getBoolConfig(CONFIG_ENABLE_CONTINENT_TRANSPORT))
{ {
result = WorldDatabase.Query("SELECT guid, entry FROM transports");
if (result) if (result)
{ {
do do
@@ -442,39 +442,38 @@ void TransportMgr::SpawnContinentTransports()
if (!tInfo->inInstance) if (!tInfo->inInstance)
if (CreateTransport(entry, guid)) if (CreateTransport(entry, guid))
++count; ++count;
} while (result->NextRow()); } while (result->NextRow());
} }
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));
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 do
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 Field* fields = result2->Fetch();
{ uint16 mapId = fields[0].GetUInt16();
Field* fields = result->Fetch(); float x = fields[1].GetFloat();
uint16 mapId = fields[0].GetUInt16(); float y = fields[2].GetFloat();
float x = fields[1].GetFloat();
float y = fields[2].GetFloat();
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId); MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
if (mapEntry && !mapEntry->Instanceable()) if (mapEntry && !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 (result->NextRow()); } while (result2->NextRow());
}
LOG_INFO("server.loading", ">> Preloaded grids for {} continent static transports in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
} }
LOG_INFO("server.loading", ">> Preloaded grids for {} continent static transports in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
} }
} }