symmetry between reading and writing int2

This commit is contained in:
Chris Forbes
2010-11-23 13:06:37 +13:00
parent 2f74207bf6
commit 88398afba6
2 changed files with 7 additions and 6 deletions

View File

@@ -108,10 +108,7 @@ namespace OpenRA
if (TargetActor != null) if (TargetActor != null)
w.Write(UIntFromActor(TargetActor)); w.Write(UIntFromActor(TargetActor));
if (TargetLocation != int2.Zero) if (TargetLocation != int2.Zero)
{ w.Write(TargetLocation);
w.Write(TargetLocation.X);
w.Write(TargetLocation.Y);
}
if (TargetString != null) if (TargetString != null)
w.Write(TargetString); w.Write(TargetString);

View File

@@ -8,10 +8,8 @@
*/ */
#endregion #endregion
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
namespace OpenRA.Network namespace OpenRA.Network
{ {
@@ -54,5 +52,11 @@ namespace OpenRA.Network
var y = r.ReadInt32(); var y = r.ReadInt32();
return new int2(x, y); return new int2(x, y);
} }
public static void Write(this BinaryWriter w, int2 p)
{
w.Write(p.X);
w.Write(p.Y);
}
} }
} }