DumpSyncReport() private method

private DumpSyncReport ( int frame, IEnumerable orders ) : void
frame int
orders IEnumerable
return void
Beispiel #1
0
        void CheckSync(byte[] packet)
        {
            var frame = BitConverter.ToInt32(packet, 0);

            byte[] existingSync;
            if (syncForFrame.TryGetValue(frame, out existingSync))
            {
                if (packet.Length != existingSync.Length)
                {
                    syncReport.DumpSyncReport(frame);
                    OutOfSync(frame);
                }
                else
                {
                    for (int i = 0; i < packet.Length; i++)
                    {
                        if (packet[i] != existingSync[i])
                        {
                            syncReport.DumpSyncReport(frame);

                            if (i < SyncHeaderSize)
                            {
                                OutOfSync(frame, "Tick");
                            }
                            else
                            {
                                OutOfSync(frame, (i - SyncHeaderSize) / 4);
                            }
                        }
                    }
                }
            }
            else
            {
                syncForFrame.Add(frame, packet);
            }
        }
Beispiel #2
0
 void OutOfSync(int frame)
 {
     syncReport.DumpSyncReport(frame, frameData.OrdersForFrame(World, frame));
     throw new InvalidOperationException("Out of sync in frame {0}.\n Compare syncreport.log with other players.".F(frame));
 }
Beispiel #3
0
 void OutOfSync(int frame)
 {
     syncReport.DumpSyncReport(frame);
     throw new InvalidOperationException($"Out of sync in frame {frame}.\n Compare syncreport.log with other players.");
 }