mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/World: Allow specifying minimum world updates diff in config
This commit is contained in:
@@ -67,8 +67,6 @@ namespace fs = boost::filesystem;
|
||||
#define _TRINITY_CORE_CONFIG "worldserver.conf"
|
||||
#endif
|
||||
|
||||
#define WORLD_SLEEP_CONST 1
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "ServiceWin32.h"
|
||||
char serviceName[] = "worldserver";
|
||||
@@ -472,6 +470,7 @@ void ShutdownCLIThread(std::thread* cliThread)
|
||||
|
||||
void WorldUpdateLoop()
|
||||
{
|
||||
uint32 minUpdateDiff = uint32(sConfigMgr->GetIntDefault("MinWorldUpdateTime", 1));
|
||||
uint32 realCurrTime = 0;
|
||||
uint32 realPrevTime = getMSTime();
|
||||
|
||||
@@ -486,10 +485,10 @@ void WorldUpdateLoop()
|
||||
realCurrTime = getMSTime();
|
||||
|
||||
uint32 diff = getMSTimeDiff(realPrevTime, realCurrTime);
|
||||
if (!diff)
|
||||
if (diff < minUpdateDiff)
|
||||
{
|
||||
// sleep until enough time passes that we can update all timers
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
std::this_thread::sleep_for(Milliseconds(minUpdateDiff - diff));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -334,6 +334,13 @@ SessionAddDelay = 10000
|
||||
|
||||
GridCleanUpDelay = 300000
|
||||
|
||||
#
|
||||
# MinWorldUpdateTime
|
||||
# Description: Minimum time (milliseconds) between world update ticks (for mostly idle servers).
|
||||
# Default: 1 - (0.001 second)
|
||||
|
||||
MinWorldUpdateTime = 1
|
||||
|
||||
#
|
||||
# MapUpdateInterval
|
||||
# Description: Time (milliseconds) for map update interval.
|
||||
|
||||
Reference in New Issue
Block a user