From dd476bbf5c39f7bb44fbf9030c807f9f9204d2fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Mon, 25 Feb 2013 20:52:48 +0100 Subject: [PATCH] add the total number of values extracted from RNG to sync report --- OpenRA.FileFormats/Thirdparty/Random.cs | 2 ++ OpenRA.Game/Network/SyncReport.cs | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenRA.FileFormats/Thirdparty/Random.cs b/OpenRA.FileFormats/Thirdparty/Random.cs index 8ef212f0c3..05aca361b2 100644 --- a/OpenRA.FileFormats/Thirdparty/Random.cs +++ b/OpenRA.FileFormats/Thirdparty/Random.cs @@ -20,6 +20,7 @@ namespace OpenRA.Thirdparty int index = 0; public int Last; + public int TotalCount = 0; public Random() : this(Environment.TickCount) { } @@ -41,6 +42,7 @@ namespace OpenRA.Thirdparty y ^= y >> 18; index = (index + 1) % 624; + TotalCount++; Last = (int)(y % int.MaxValue); return Last; } diff --git a/OpenRA.Game/Network/SyncReport.cs b/OpenRA.Game/Network/SyncReport.cs index f060b8ccf6..a5d7f966ad 100755 --- a/OpenRA.Game/Network/SyncReport.cs +++ b/OpenRA.Game/Network/SyncReport.cs @@ -36,6 +36,7 @@ namespace OpenRA.Network { report.Frame = orderManager.NetFrameNumber; report.SyncedRandom = orderManager.world.SharedRandom.Last; + report.TotalCount = orderManager.world.SharedRandom.TotalCount; report.Traits.Clear(); foreach (var a in orderManager.world.ActorsWithTrait()) { @@ -58,7 +59,7 @@ namespace OpenRA.Network if (r.Frame == frame) { Log.Write("sync", "Sync for net frame {0} -------------", r.Frame); - Log.Write("sync", "SharedRandom: "+r.SyncedRandom); + Log.Write("sync", "SharedRandom: {0} (#{1})", r.SyncedRandom, r.TotalCount); Log.Write("sync", "Synced Traits:"); foreach (var a in r.Traits) Log.Write("sync", "\t {0} {1} {2} {3} ({4})".F( @@ -77,6 +78,7 @@ namespace OpenRA.Network { public int Frame; public int SyncedRandom; + public int TotalCount; public List Traits = new List(); }