Make the continent transport and preloading optional.

This commit is contained in:
Kartselyanski
2018-06-12 23:50:18 +03:00
committed by Barbz
parent 5f4ab8fe44
commit ea8c85c886
4 changed files with 72 additions and 40 deletions

View File

@@ -403,52 +403,58 @@ void TransportMgr::SpawnContinentTransports()
if (_transportTemplates.empty())
return;
uint32 oldMSTime = getMSTime();
QueryResult result = WorldDatabase.Query("SELECT guid, entry FROM transports");
uint32 count = 0;
if (result)
if (sWorld->getBoolConfig(CONFIG_ENABLE_CONTINENT_TRANSPORT))
{
do
uint32 oldMSTime = getMSTime();
QueryResult result = WorldDatabase.Query("SELECT guid, entry FROM transports");
uint32 count = 0;
if (result)
{
Field* fields = result->Fetch();
uint32 guid = fields[0].GetUInt32();
uint32 entry = fields[1].GetUInt32();
do
{
Field* fields = result->Fetch();
uint32 guid = fields[0].GetUInt32();
uint32 entry = fields[1].GetUInt32();
if (TransportTemplate const* tInfo = GetTransportTemplate(entry))
if (!tInfo->inInstance)
if (CreateTransport(entry, guid))
if (TransportTemplate const* tInfo = GetTransportTemplate(entry))
if (!tInfo->inInstance)
if (CreateTransport(entry, guid))
++count;
} while (result->NextRow());
}
sLog->outString(">> Spawned %u continent motion transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
if (sWorld->getBoolConfig(CONFIG_ENABLE_CONTINENT_TRANSPORT_PRELOADING))
{
// 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
{
Field* fields = result->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());
} while (result->NextRow());
}
sLog->outString(">> Preloaded grids for %u continent static transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
sLog->outString(">> Spawned %u continent motion transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
// 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
{
Field* fields = result->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());
}
sLog->outString(">> Preloaded grids for %u continent static transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void TransportMgr::CreateInstanceTransports(Map* map)