extract replay saving from OrderManager

This commit is contained in:
Bob
2010-10-10 20:32:39 +13:00
parent 07023b6c35
commit 915ad7fb7b
6 changed files with 121 additions and 98 deletions

View File

@@ -68,7 +68,12 @@ namespace OpenRA
lastConnectionState = ConnectionState.PreConnecting;
ConnectionStateChanged();
orderManager = new OrderManager(new NetworkConnection(host, port), ChooseReplayFilename());
var replayFilename = ChooseReplayFilename();
string path = Path.Combine( Game.SupportDir, "Replays" );
if( !Directory.Exists( path ) ) Directory.CreateDirectory( path );
var replayFile = File.Create( Path.Combine( path, replayFilename ) );
orderManager = new OrderManager( new ReplayRecorderConnection( new NetworkConnection( host, port ), replayFile ) );
}
static string ChooseReplayFilename()
@@ -117,7 +122,7 @@ namespace OpenRA
lastTime += Settings.Game.Timestep;
Widget.DoTick(world);
Sound.Tick();
orderManager.TickImmediate(world);
Sync.CheckSyncUnchanged( world, () => { orderManager.TickImmediate( world ); } );
var isNetTick = LocalTick % NetTickScale == 0;