]> git.deb.at Git - rhonda/impostor.git/commitdiff
Add Message24EndGameHostMigration serialization
authorminiduikboot <mini@duikbo.at>
Sun, 30 Jun 2024 21:29:53 +0000 (23:29 +0200)
committerminiduikboot <mini@duikbo.at>
Tue, 20 Aug 2024 19:41:38 +0000 (21:41 +0200)
Looks like Innersloth added this but hasn't actually used this. Weird..

When sent it makes the new host perform a full rejoin, which gums up
Impostor's spawning logic. Fixing that causes the client to gum itself
up. Sigh.

After some testing it seems like host migration still works fine, so
this investigation wasn't needed. Committing for posterity.

Co-Authored-By: js6pak <me@6pak.dev>
src/Impostor.Api/Net/Messages/MessageFlags.cs
src/Impostor.Api/Net/Messages/S2C/Message24EndGameHostMigrationS2C.cs [new file with mode: 0644]

index 8be5a58192e6151f4d7b901b4f0bdd07614fff6a..a1a9a11a4074a320c7d4203a3804b6e6e8a5ac9a 100644 (file)
@@ -28,6 +28,7 @@ namespace Impostor.Api.Net.Messages
         public const byte SetActivePodType = 21;
         public const byte QueryPlatformIds = 22;
         public const byte QueryLobbyInfo = 23;
+        public const byte EndGameHostMigration = 24;
 
         private static readonly Dictionary<byte, string> FlagCache;
 
diff --git a/src/Impostor.Api/Net/Messages/S2C/Message24EndGameHostMigrationS2C.cs b/src/Impostor.Api/Net/Messages/S2C/Message24EndGameHostMigrationS2C.cs
new file mode 100644 (file)
index 0000000..18f1d24
--- /dev/null
@@ -0,0 +1,21 @@
+using Impostor.Api.Games;
+
+namespace Impostor.Api.Net.Messages.S2C
+{
+    public class Message24EndGameHostMigrationS2C
+    {
+        public static void Serialize(IMessageWriter writer, GameCode gameCode, int hostClientId)
+        {
+            writer.StartMessage(MessageFlags.EndGameHostMigration);
+            gameCode.Serialize(writer);
+            writer.Write(hostClientId);
+            writer.EndMessage();
+        }
+
+        public static void Deserialize(IMessageReader reader, out GameCode gameCode, out int hostClientId)
+        {
+            gameCode = reader.ReadInt32();
+            hostClientId = reader.ReadInt32();
+        }
+    }
+}