From 5f4ab8fe447eec33feb39c776877d8cceb1223f1 Mon Sep 17 00:00:00 2001 From: Anthony Gauthier Date: Thu, 26 Jul 2018 10:59:19 -0400 Subject: [PATCH 1/5] Simple README error fixed --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 723a3c797..b4896eb36 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ We also believe in [software modularity](https://en.wikipedia.org/wiki/Modular_p ## Learning project AzerothCore is a learning project. -If you want to learn how to use C++, SQL, git, etc... you came to the right place! We will gladly to help you: **programming is our passion**. +If you want to learn how to use C++, SQL, git, etc... you came to the right place! We will gladly help you: **programming is our passion**. If you want to contribute, in [our wiki](https://github.com/azerothcore/azerothcore-wotlk/wiki) you fill find a lot of resources that will guide you. Also you can poke us in [our discord chat server](https://discord.gg/gkt4y2x). From ea8c85c88649d7d2280b80a71dc2bda2fa9b92ba Mon Sep 17 00:00:00 2001 From: Kartselyanski Date: Tue, 12 Jun 2018 23:50:18 +0300 Subject: [PATCH 2/5] Make the continent transport and preloading optional. --- src/server/game/Maps/TransportMgr.cpp | 86 +++++++++++--------- src/server/game/World/World.cpp | 3 + src/server/game/World/World.h | 2 + src/server/worldserver/worldserver.conf.dist | 21 +++++ 4 files changed, 72 insertions(+), 40 deletions(-) diff --git a/src/server/game/Maps/TransportMgr.cpp b/src/server/game/Maps/TransportMgr.cpp index 4bfae7434..0a297e365 100644 --- a/src/server/game/Maps/TransportMgr.cpp +++ b/src/server/game/Maps/TransportMgr.cpp @@ -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) diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index b4d37fa41..6b82f1c78 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1299,6 +1299,9 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_BIRTHDAY_TIME] = sConfigMgr->GetIntDefault("BirthdayTime", 1222964635); + m_bool_configs[CONFIG_ENABLE_CONTINENT_TRANSPORT] = sConfigMgr->GetBoolDefault("IsContinentTransport.Enabled", true); + m_bool_configs[CONFIG_ENABLE_CONTINENT_TRANSPORT_PRELOADING] = sConfigMgr->GetBoolDefault("IsPreloadedContinentTransport.Enabled", false); + // call ScriptMgr if we're reloading the configuration sScriptMgr->OnAfterConfigLoad(reload); } diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 089f1fa64..33afd021c 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -158,6 +158,8 @@ enum WorldBoolConfigs CONFIG_QUEST_IGNORE_AUTO_ACCEPT, CONFIG_QUEST_IGNORE_AUTO_COMPLETE, CONFIG_WARDEN_ENABLED, + CONFIG_ENABLE_CONTINENT_TRANSPORT, + CONFIG_ENABLE_CONTINENT_TRANSPORT_PRELOADING, BOOL_CONFIG_VALUE_COUNT }; diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index f22a09199..5009c3e11 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -1450,6 +1450,27 @@ AccountInstancesPerHour = 5 BirthdayTime = 1222964635 +# +# IsContinentTransport.Enabled +# Description: Controls the continent transport (ships, zeppelins etc..) +# Default: 1 - (Enabled) +# +# + +IsContinentTransport.Enabled = 1 + +# +# IsPreloadedContinentTransport.Enabled +# Description: Should we preload the transport? +# (Not recommended on low-end servers as it consumes 100% more ram) +# and it's not really necessary to be enabled. +# +# Default: 0 - (Disabled) +# +# + +IsPreloadedContinentTransport.Enabled = 0 + # ################################################################################################### From 21aae9eec528708933c3ab4f99ef8b9bed2a8ca7 Mon Sep 17 00:00:00 2001 From: Kartselyanski Date: Wed, 13 Jun 2018 01:46:41 +0300 Subject: [PATCH 3/5] Should be out of the check. --- src/server/game/Maps/TransportMgr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/game/Maps/TransportMgr.cpp b/src/server/game/Maps/TransportMgr.cpp index 0a297e365..5746676ba 100644 --- a/src/server/game/Maps/TransportMgr.cpp +++ b/src/server/game/Maps/TransportMgr.cpp @@ -403,11 +403,11 @@ void TransportMgr::SpawnContinentTransports() if (_transportTemplates.empty()) return; + uint32 oldMSTime = getMSTime(); + uint32 count = 0; if (sWorld->getBoolConfig(CONFIG_ENABLE_CONTINENT_TRANSPORT)) { - uint32 oldMSTime = getMSTime(); QueryResult result = WorldDatabase.Query("SELECT guid, entry FROM transports"); - uint32 count = 0; if (result) { do From 1f51bf41cd3cfab64d006e41fb02e4ea818c0cd0 Mon Sep 17 00:00:00 2001 From: Kartselyanski Date: Wed, 13 Jun 2018 02:48:43 +0300 Subject: [PATCH 4/5] And another one... --- src/server/game/Maps/TransportMgr.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/server/game/Maps/TransportMgr.cpp b/src/server/game/Maps/TransportMgr.cpp index 5746676ba..02b888293 100644 --- a/src/server/game/Maps/TransportMgr.cpp +++ b/src/server/game/Maps/TransportMgr.cpp @@ -403,11 +403,13 @@ void TransportMgr::SpawnContinentTransports() if (_transportTemplates.empty()) return; - uint32 oldMSTime = getMSTime(); - uint32 count = 0; + uint32 oldMSTime, count = 0; + oldMSTime = getMSTime(); + QueryResult result; + if (sWorld->getBoolConfig(CONFIG_ENABLE_CONTINENT_TRANSPORT)) { - QueryResult result = WorldDatabase.Query("SELECT guid, entry FROM transports"); + result = WorldDatabase.Query("SELECT guid, entry FROM transports"); if (result) { do From c6be57c2329bf950ae72f15a900b50125eac4e05 Mon Sep 17 00:00:00 2001 From: FALL1N1 <1922208+FALL1N1@users.noreply.github.com> Date: Thu, 26 Jul 2018 16:50:50 +0300 Subject: [PATCH 5/5] Move preloading in the continent transport check --- src/server/game/Maps/TransportMgr.cpp | 48 +++++++++++++-------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/server/game/Maps/TransportMgr.cpp b/src/server/game/Maps/TransportMgr.cpp index 02b888293..1d0325cb1 100644 --- a/src/server/game/Maps/TransportMgr.cpp +++ b/src/server/game/Maps/TransportMgr.cpp @@ -427,35 +427,35 @@ void TransportMgr::SpawnContinentTransports() } 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) + + if (sWorld->getBoolConfig(CONFIG_ENABLE_CONTINENT_TRANSPORT_PRELOADING)) { - do + // 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) { - Field* fields = result->Fetch(); - uint16 mapId = fields[0].GetUInt16(); - float x = fields[1].GetFloat(); - float y = fields[2].GetFloat(); + 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; - } + 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(">> Preloaded grids for %u continent static transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } }