void AdvanceGame(TReaderThreadReplyType a1, unsigned int a2, int Delay)
{ // addr = 0x0804B350 -- defined in 'main.c' at line 73
int CreaturesTimeCounterRound;
int CronTimeRound;
TConnection *i;
unsigned int CurrentRound;
int IntMinute;
int IntHourly;
int Hour;
int Minute;
int Brightness;
int Color;
SkillTimeCounter += Delay;
OtherTimeCounter += Delay;
CreaturesTimeCounterRound = Delay + CreaturesTimeCounter;
CronTimeRound = Delay + CronTimeCounter;
CreaturesTimeCounter = CreaturesTimeCounterRound;
CronTimeCounter += Delay;
if ( CreaturesTimeCounterRound > 1749 )
{
CreaturesTimeCounter = CreaturesTimeCounterRound - 1000;
ProcessCreatures();
CronTimeRound = CronTimeCounter;
}
if ( CronTimeRound > 1499 )
{
CronTimeCounter = CronTimeRound - 1000;
ProcessCronSystem();
}
if ( SkillTimeCounter > 1249 )
{
SkillTimeCounter -= 1000;
ProcessSkills();
}
if ( OtherTimeCounter > 999 )
{
OtherTimeCounter -= 1000;
SetRoundNr(++RoundNr);
ProcessConnections();
ProcessMonsterhomes();
ProcessMonsterRaids(Delay);
ProcessCommunicationControl();
ProcessReaderThreadReplies((unsigned __int8 *)Delay, a1, a2, RefreshSector, SendMails);
ProcessWriterThreadReplies((unsigned int *)Delay, (TWriterThreadReplyType)a2);
ProcessCommand();
GetAmbiente(&Brightness, &Color);
if ( Brightness != OldAmbiente )
{
OldAmbiente = Brightness;
for ( i = GetFirstConnection(); i; i = GetNextConnection() )
{
if ( (unsigned int)(i->State - 3) <= 3 )
SendAmbiente(i);
}
}
CurrentRound = RoundNr;
a2 = 10 * (RoundNr / 10);
if ( RoundNr == a2 )
{
NetLoadCheck();
CurrentRound = RoundNr;
}
if ( CurrentRound >= AdvanceGame(int)::NextMinute )
{
GetRealTime(&Hour, &Minute);
RefreshCylinders();
IntMinute = Minute;
if ( Minute == 5 * (Minute / 5) )
{
CreatePlayerList(1);
IntMinute = Minute;
}
if ( IntMinute == 15 * (IntMinute / 15) )
{
SavePlayerDataOrder();
IntMinute = Minute;
}
if ( !IntMinute )
{
NetLoadSummary();
IntMinute = Minute;
}
if ( IntMinute == 55 )
{
WriteKillStatistics();
IntMinute = Minute;
}
IntHourly = IntMinute + 60 * Hour;
a2 = RebootTime;
if ( (IntHourly + 5) % 1440 == RebootTime )
{
if ( Reboot )
BroadcastMessage(18, "Server is saving game in 5 minutes.\nPlease come back in 10 minutes.");
else
BroadcastMessage(18, "Server is going down in 5 minutes.\nPlease log out.");
CloseGame();
a2 = RebootTime;
}
if ( (IntHourly + 3) % 1440 == a2 )
{
if ( Reboot )
BroadcastMessage(18, "Server is saving game in 3 minutes.\nPlease come back in 10 minutes.");
else
BroadcastMessage(18, "Server is going down in 3 minutes.\nPlease log out.");
a2 = RebootTime;
}
if ( (IntHourly + 1) % 1440 == a2 )
{
if ( Reboot )
BroadcastMessage(18, "Server is saving game in one minute.\nPlease log out.");
else
BroadcastMessage(18, "Server is going down in one minute.\nPlease log out.");
a2 = RebootTime;
}
if ( IntHourly == a2 )
{
CloseGame();
LogoutAllPlayers();
SendAll();
if ( Reboot )
RefreshMap();
SaveMap();
SaveMapOn = 0;
EndGame();
}
NextMinute = GetRoundForNextMinute();
}
CleanupDynamicStrings();
}
if ( Delay > Beat )
Log("lag", "Verz÷gerung %d msec.\n", Delay);
if ( Delay <= 999 )
{
MoveCreatures(Delay, a2, Delay);
Lag = 0;
}
else
{
if ( !Lag && RoundNr > 0xA )
error("AdvanceGame: Keine Kreaturbewegung wegen Lag (Verz÷gerung: %d msec).\n", Delay);
Lag = 1;
}
SendAll();
}