// this should always be called in a new thread void WorldServerLoop(void *tmp) { WorldLoopRunning = true; while(RunLoops) { if (worldserver.Connected()) { if (!(worldserver.ReceiveData() && worldserver.SendPacketQueue())) { worldserver.Disconnect(); } } else if (worldserver.GetState() == WSCS_Ready) { if (worldserver.ReconnectTimer->Check()) { worldserver.Connect(); } } Sleep(1); } WorldLoopRunning = false; }