From 8d809c66ba9f3501d9ada5209cd148c63a9855d1 Mon Sep 17 00:00:00 2001 From: Elijah R Date: Wed, 3 Jan 2024 19:38:24 -0500 Subject: [PATCH] two minor bugfixes - the remaining turn time now properly is zero when there are no users in the queue - the chat history is now in the correct order --- collab-vm-server-1.3/TurnQueue.cs | 4 ++++ collab-vm-server-1.3/User.cs | 2 +- collab-vm-server-1.3/VM.cs | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/collab-vm-server-1.3/TurnQueue.cs b/collab-vm-server-1.3/TurnQueue.cs index 1744c06..8dc4b6d 100644 --- a/collab-vm-server-1.3/TurnQueue.cs +++ b/collab-vm-server-1.3/TurnQueue.cs @@ -56,6 +56,9 @@ public class TurnQueue if (!queue.TryPeek(out var u)) return; Utilities.Log(LogLevel.DEBUG, $"It is now {u.Username}'s turn"); currentTurnRemainingTime = turnTime; + } else { + timer.Stop(); + currentTurnRemainingTime = 0; } SendTurnUpdate(); } @@ -116,6 +119,7 @@ public class TurnQueue if (queue.Count == 0) { timer.Stop(); + currentTurnRemainingTime = 0; } SendTurnUpdate(); } diff --git a/collab-vm-server-1.3/User.cs b/collab-vm-server-1.3/User.cs index 017a457..ff1d195 100644 --- a/collab-vm-server-1.3/User.cs +++ b/collab-vm-server-1.3/User.cs @@ -166,7 +166,7 @@ public class User await this.vm.AddUser(this); List chatmsg = new(); chatmsg.Add("chat"); - foreach (ChatMessage msg in vm.ChatHistory) + foreach (ChatMessage msg in vm.ChatHistory.ToArray()) { chatmsg.Add(msg.Username); chatmsg.Add(msg.Message); diff --git a/collab-vm-server-1.3/VM.cs b/collab-vm-server-1.3/VM.cs index 6fd4d05..d6a2a00 100644 --- a/collab-vm-server-1.3/VM.cs +++ b/collab-vm-server-1.3/VM.cs @@ -160,7 +160,7 @@ public class VM else await u.SendChat(user.Username!, messageSanitized); } - ChatHistory.PushFront(new ChatMessage {Username = user.Username!, Message = messageSanitized}); + ChatHistory.PushBack(new ChatMessage {Username = user.Username!, Message = messageSanitized}); } public async Task SendMouse(int x, int y, int mask)