Improved Core's WebAmin interface a bit.
Can now kick players through WebAdmin Can now enable/disable whitelist through WebAdmin Tick speed is limited in a better way now, instead of always sleeping 50ms before each tick, it now add only sleeps additional time when the tick time was faster than 50ms. Server should run slightly faster because of this (and use more cpu%) git-svn-id: http://mc-server.googlecode.com/svn/trunk@167 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
@@ -278,11 +278,9 @@ void cServer::StartListenClient()
|
||||
|
||||
bool cServer::Tick(float a_Dt)
|
||||
{
|
||||
//LOG("1. Tick");
|
||||
//LOG("1. Tick %0.2f", a_Dt);
|
||||
if( a_Dt > 100.f ) a_Dt = 100.f; // Don't go over 1/10 second
|
||||
|
||||
cSleep::MilliSleep( 50 ); // Don't tick too much
|
||||
|
||||
m_Millisecondsf += a_Dt;
|
||||
if( m_Millisecondsf > 1.f )
|
||||
{
|
||||
@@ -331,6 +329,7 @@ void ServerTickThread( void * a_Param )
|
||||
|
||||
cTimer Timer;
|
||||
|
||||
long long msPerTick = 50; // TODO - Put this in server config file
|
||||
long long LastTime = Timer.GetNowTime();
|
||||
|
||||
bool bKeepGoing = true;
|
||||
@@ -339,6 +338,13 @@ void ServerTickThread( void * a_Param )
|
||||
long long NowTime = Timer.GetNowTime();
|
||||
float DeltaTime = (float)(NowTime-LastTime);
|
||||
bKeepGoing = CServerObj->Tick( DeltaTime );
|
||||
long long TickTime = Timer.GetNowTime() - NowTime;
|
||||
|
||||
if( TickTime < msPerTick ) // Stretch tick time until it's at least msPerTick
|
||||
{
|
||||
cSleep::MilliSleep( (unsigned int)( msPerTick - TickTime ) );
|
||||
}
|
||||
|
||||
LastTime = NowTime;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user