From 60f49b39d42b02c55b44fb68749807ec3353c1e2 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Thu, 11 Jul 2013 17:59:34 +1200 Subject: [PATCH] Fix #3546. --- OpenRA.Game/Sync.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/OpenRA.Game/Sync.cs b/OpenRA.Game/Sync.cs index 7e41470919..78881db317 100755 --- a/OpenRA.Game/Sync.cs +++ b/OpenRA.Game/Sync.cs @@ -82,27 +82,27 @@ namespace OpenRA } else if (type == typeof(WRange)) { - il.EmitCall(OpCodes.Call, ((Func)(a => a.GetHashCode())).Method, null); + il.EmitCall(OpCodes.Call, ((Func)hash).Method, null); il.Emit(OpCodes.Xor); } else if (type == typeof(WPos)) { - il.EmitCall(OpCodes.Call, ((Func)(a => a.GetHashCode())).Method, null); + il.EmitCall(OpCodes.Call, ((Func)hash).Method, null); il.Emit(OpCodes.Xor); } else if (type == typeof(WVec)) { - il.EmitCall(OpCodes.Call, ((Func)(a => a.GetHashCode())).Method, null); + il.EmitCall(OpCodes.Call, ((Func)hash).Method, null); il.Emit(OpCodes.Xor); } else if (type == typeof(WAngle)) { - il.EmitCall(OpCodes.Call, ((Func)(a => a.GetHashCode())).Method, null); + il.EmitCall(OpCodes.Call, ((Func)hash).Method, null); il.Emit(OpCodes.Xor); } else if (type == typeof(WRot)) { - il.EmitCall(OpCodes.Call, ((Func)(a => a.GetHashCode())).Method, null); + il.EmitCall(OpCodes.Call, ((Func)hash).Method, null); il.Emit(OpCodes.Xor); } else if (type == typeof(TypeDictionary)) @@ -217,6 +217,11 @@ namespace OpenRA return 0; } + public static int hash(T t) + { + return t.GetHashCode(); + } + public static void CheckSyncUnchanged( World world, Action fn ) { CheckSyncUnchanged( world, () => { fn(); return true; } );