From 5177c5b1ebec070aa568588f19a525ad2e99598a Mon Sep 17 00:00:00 2001 From: Nilanth Animosus Date: Sat, 21 Jul 2018 18:38:27 +0100 Subject: [PATCH] Fixed clients being unable to see vote counts The clients would check their saved submarines instead of the submarines the server had when receiving the vote count. --- Barotrauma/BarotraumaClient/Source/Networking/Voting.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Barotrauma/BarotraumaClient/Source/Networking/Voting.cs b/Barotrauma/BarotraumaClient/Source/Networking/Voting.cs index 6b41a5dac..0b30e3d84 100644 --- a/Barotrauma/BarotraumaClient/Source/Networking/Voting.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/Voting.cs @@ -152,7 +152,12 @@ namespace Barotrauma { int votes = inc.ReadByte(); string subName = inc.ReadString(); - Submarine sub = Submarine.SavedSubmarines.FirstOrDefault(sm => sm.Name == subName); + List serversubs = new List(); + foreach (GUIComponent item in GameMain.NetLobbyScreen?.SubList?.children) + { + if (item.UserData != null && item.UserData is Submarine) serversubs.Add(item.UserData as Submarine); + } + Submarine sub = serversubs.FirstOrDefault(sm => sm.Name == subName); SetVoteText(GameMain.NetLobbyScreen.SubList, sub, votes); } }