Beispiel #1
0
        void _updateManagers(object source, ElapsedEventArgs ar)
        {
            if (_disableObjectUpdates)
            {
                return;
            }

            try
            {
                _timeAtLastUpdate = TimeKeeper.MsSinceInitialization;

                if (TimeKeeper.MsSinceInitialization - _timeAtLastUpdate > ServerConfig.ObjectUpdatePeriod)
                {
                    ConsoleManager.WriteLine("WARNING. TIMED UPDATES LATE BY " + (TimeKeeper.MsSinceInitialization - _timeAtLastUpdate - ServerConfig.ObjectUpdatePeriod) + " ms.");
                }

                _galaxyManager.UpdateAreas(TimeKeeper.MsSinceInitialization);
                _clientUpdateManager.Update();     // Checks time of clients, used to detect speed hacking
                _projectileManager.Update();
                _collisionManager.Update(_registrationManager, _projectileManager);

                _connectionManager.Update();
                _shipManager.Update();

                Logger.Flush();
            }
            catch (Exception e)
            {
                ConsoleManager.WriteLine(e.ToString(), ConsoleMessageType.Error);
                ConsoleManager.WriteLine(e.Message, ConsoleMessageType.Error);
                //exceptionLogger.Write(e.ToString());
                //exceptionLogger.Write(e.Message);
                //exceptionLogger.Write("\n\n");
                //exceptionLogger.Flush();
            }

            var t = source as System.Timers.Timer;

            if (t != null)
            {
                t.Start();
            }
        }