Dispose of the old world before creating a new one
This commit is contained in:
@@ -135,6 +135,10 @@ namespace OpenRA
|
|||||||
public static event Action BeforeGameStart = () => { };
|
public static event Action BeforeGameStart = () => { };
|
||||||
internal static void StartGame(string mapUID, WorldType type)
|
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);
|
Cursor.SetCursor(null);
|
||||||
BeforeGameStart();
|
BeforeGameStart();
|
||||||
|
|
||||||
@@ -143,13 +147,7 @@ namespace OpenRA
|
|||||||
using (new PerfTimer("PrepareMap"))
|
using (new PerfTimer("PrepareMap"))
|
||||||
map = ModData.PrepareMap(mapUID);
|
map = ModData.PrepareMap(mapUID);
|
||||||
using (new PerfTimer("NewWorld"))
|
using (new PerfTimer("NewWorld"))
|
||||||
{
|
OrderManager.World = new World(map, OrderManager, type) { Timestep = Timestep };
|
||||||
OrderManager.World = new World(map, OrderManager, type);
|
|
||||||
OrderManager.World.Timestep = Timestep;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (worldRenderer != null)
|
|
||||||
worldRenderer.Dispose();
|
|
||||||
|
|
||||||
worldRenderer = new WorldRenderer(OrderManager.World);
|
worldRenderer = new WorldRenderer(OrderManager.World);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user