Fix inactive games not being reactivated when a move is made

This commit is contained in:
Andrio Celos 2022-12-29 19:19:02 +11:00
parent 673eb18aa9
commit 0236d75e6d

View File

@ -68,7 +68,6 @@ internal class Program {
Console.WriteLine("Locking server for update.");
}
}
}
}
@ -166,7 +165,7 @@ internal class Program {
return;
}
lock (games) {
if (!games.TryGetValue(gameID, out var game) && !inactiveGames.TryGetValue(gameID, out game)) {
if (!TryGetGame(gameID, out var game)) {
SetErrorResponse(e.Response, new(HttpStatusCode.NotFound, "GameNotFound", "Game not found."));
return;
}
@ -547,6 +546,7 @@ internal class Program {
inactiveGames.Remove(gameID);
games[gameID] = game;
game.AbandonedSince = DateTime.UtcNow;
Console.WriteLine($"{games.Count} games active; {inactiveGames.Count} inactive");
return true;
}
return false;