basic Sync checking. No protocol stuff yet; just checks that input events are well-behaved.

This commit is contained in:
Bob
2010-01-09 14:25:54 +13:00
parent 1bf7e462d6
commit b24983f0ef
41 changed files with 147 additions and 24 deletions

View File

@@ -147,14 +147,24 @@ namespace OpenRa.Game
public Cursor ChooseCursor()
{
var mi = new MouseInput
{
Location = (Game.CellSize * MousePosition - Game.viewport.Location).ToInt2(),
Button = MouseButton.Right,
Modifiers = GetModifierKeys(),
};
int sync = Game.world.SyncHash();
return orderGenerator.GetCursor(MousePosition.ToInt2(), mi);
try
{
var mi = new MouseInput
{
Location = ( Game.CellSize * MousePosition - Game.viewport.Location ).ToInt2(),
Button = MouseButton.Right,
Modifiers = GetModifierKeys(),
};
return orderGenerator.GetCursor( MousePosition.ToInt2(), mi );
}
finally
{
if( sync != Game.world.SyncHash() )
throw new InvalidOperationException( "Desync in Controller.ChooseCursor" );
}
}
Cache<int, List<Actor>> controlGroups = new Cache<int, List<Actor>>(_ => new List<Actor>());