From 07d36673f79bb3265fbf24e74cff12fcef78baf8 Mon Sep 17 00:00:00 2001 From: Cmd-GZ Date: Sat, 4 Jul 2026 03:47:43 +0800 Subject: [PATCH] Fix: 2 bugs about the confusion about local players and computer players: 1. The game will show you a certain computer player's perspective if it's computer's turn in the first turn 2. (Critical)Local player will be regarded as a computer player somehow because the nextPCs haven't been initialized when they join into a new room --- src/Graphwar/GameData.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Graphwar/GameData.java b/src/Graphwar/GameData.java index 9b59423..e18470a 100644 --- a/src/Graphwar/GameData.java +++ b/src/Graphwar/GameData.java @@ -115,6 +115,7 @@ public void connect(String ip, int port) throws IOException currentTurn = -1; turnTimeUp = false; nextTurnSent = false; + nextPCs.clear(); new Thread(this).start(); @@ -151,7 +152,7 @@ public Player getFirstLocalPlayer() { Player player = itr.next(); - if(player.isLocalPlayer()) + if(player.isLocalPlayer() && !(player instanceof ComputerPlayer)) { return player; }