From d2058fbcbc7c9b21f6495985aea5fdd206ab3c0c Mon Sep 17 00:00:00 2001 From: penev92 Date: Tue, 30 Jun 2015 14:49:47 +0300 Subject: [PATCH] Dispose of the old world before creating a new one --- OpenRA.Game/Game.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 1433810319..9f3ef7729e 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -135,6 +135,10 @@ namespace OpenRA public static event Action BeforeGameStart = () => { }; internal static void StartGame(string mapUID, WorldType type) { + // Dispose of the old world before creating a new one. + if (worldRenderer != null) + worldRenderer.Dispose(); + Cursor.SetCursor(null); BeforeGameStart(); @@ -143,13 +147,7 @@ namespace OpenRA using (new PerfTimer("PrepareMap")) map = ModData.PrepareMap(mapUID); using (new PerfTimer("NewWorld")) - { - OrderManager.World = new World(map, OrderManager, type); - OrderManager.World.Timestep = Timestep; - } - - if (worldRenderer != null) - worldRenderer.Dispose(); + OrderManager.World = new World(map, OrderManager, type) { Timestep = Timestep }; worldRenderer = new WorldRenderer(OrderManager.World);