mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-10 04:37:45 +00:00
Put world server mainloop on a 300 ms tick
This commit is contained in:
parent
00cb4ade45
commit
4f7f3edfce
2 changed files with 9 additions and 2 deletions
|
@ -349,10 +349,16 @@ void WorldServer::mainLoop()
|
|||
|
||||
while( isRunning() )
|
||||
{
|
||||
std::this_thread::sleep_for( std::chrono::milliseconds( 50 ) );
|
||||
auto tickCount = Common::Util::getTimeMs();
|
||||
|
||||
if( tickCount - m_lastServerTick < 300 )
|
||||
{
|
||||
std::this_thread::sleep_for( std::chrono::milliseconds( 50 ) );
|
||||
continue;
|
||||
}
|
||||
m_lastServerTick = tickCount;
|
||||
|
||||
auto currTime = Common::Util::getTimeSeconds();
|
||||
auto tickCount = Common::Util::getTimeMs();
|
||||
|
||||
taskMgr.update( tickCount );
|
||||
terriMgr.updateTerritoryInstances( tickCount );
|
||||
|
|
|
@ -74,6 +74,7 @@ namespace Sapphire::World
|
|||
uint16_t m_port;
|
||||
std::string m_ip;
|
||||
int64_t m_lastDBPingTime;
|
||||
uint64_t m_lastServerTick{ 0 };
|
||||
bool m_bRunning;
|
||||
uint16_t m_worldId;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue