]> git.deb.at Git - rhonda/impostor.git/commitdiff
Initialize Color to -1 instead of Red
authorminiduikboot <mini@duikbo.at>
Sun, 30 May 2021 16:23:12 +0000 (18:23 +0200)
committerminiduikboot <mini@duikbo.at>
Sun, 30 May 2021 16:30:47 +0000 (18:30 +0200)
This could lead to an AC disconnect if the host picked red and waited
for other players to rejoin before joining back himself. Before this
commit, the host would SetColor himself to Red, but this would be
flagged as all other players would have been set to Red as enums
initialize to 0 (= Red) by default.

After the host SetColor'd himself, the host will send over the color
array, which initializes player colors to -1. This commit follows AU by
also initializing the color to -1, preventing the AC from flagging the
duplicate colors.

src/Impostor.Server/Net/Inner/Objects/InnerPlayerInfo.cs

index 1a4ac1cb2b0e1876262167ec1eb52ff6394a9ca3..e51906cbb704b04d628fa9e878099216980fd732 100644 (file)
@@ -21,7 +21,7 @@ namespace Impostor.Server.Net.Inner.Objects
 
         public string PlayerName { get; internal set; } = string.Empty;
 
-        public ColorType Color { get; internal set; }
+        public ColorType Color { get; internal set; } = (ColorType)(-1);
 
         public HatType Hat { get; internal set; }