diff --git a/logic/Gaming/ActionManager.cs b/logic/Gaming/ActionManager.cs index 37c3d021..8c7cf996 100755 --- a/logic/Gaming/ActionManager.cs +++ b/logic/Gaming/ActionManager.cs @@ -301,7 +301,10 @@ public bool AddMoneyNaturally(Base team) ( () => { - Thread.Sleep(GameData.CheckInterval); + while (!gameMap.Timer.IsGaming) + { + Thread.Sleep(1); + } new FrameRateTaskExecutor ( loopCondition: () => gameMap.Timer.IsGaming, diff --git a/logic/Preparation/Utility/Logger.cs b/logic/Preparation/Utility/Logger.cs index b41006c4..93a14402 100755 --- a/logic/Preparation/Utility/Logger.cs +++ b/logic/Preparation/Utility/Logger.cs @@ -16,12 +16,9 @@ public class LogQueue private readonly Queue logInfoQueue = new(); - public async Task Commit(string info) + public void Commit(string info) { - await Task.Run(() => - { - lock (queueLock) logInfoQueue.Enqueue(info); - }); + lock (queueLock) logInfoQueue.Enqueue(info); } public static bool IsClosed { get; private set; } = false; @@ -79,7 +76,6 @@ private LogQueue() ).Start(); }) { IsBackground = true }.Start(); - var t = new Thread(() => { }); } } @@ -97,7 +93,7 @@ public void ConsoleLog(string msg, bool Duplicate = true) if (!Background) Console.WriteLine(info); if (Duplicate) - _ = LogQueue.Global.Commit(info); + LogQueue.Global.Commit(info); } } public void ConsoleLogDebug(string msg, bool Duplicate = true) @@ -109,7 +105,7 @@ public void ConsoleLogDebug(string msg, bool Duplicate = true) if (!Background) Console.WriteLine(info); if (Duplicate) - _ = LogQueue.Global.Commit(info); + LogQueue.Global.Commit(info); } #endif } @@ -117,14 +113,14 @@ public static void RawConsoleLog(string msg, bool Duplicate = true) { Console.WriteLine(msg); if (Duplicate) - _ = LogQueue.Global.Commit(msg); + LogQueue.Global.Commit(msg); } public static void RawConsoleLogDebug(string msg, bool Duplicate = true) { #if DEBUG Console.WriteLine(msg); if (Duplicate) - _ = LogQueue.Global.Commit(msg); + LogQueue.Global.Commit(msg); #endif }