oh ffs. old world was being referenced. fixed so it crashes if you do that.
This commit is contained in:
@@ -52,7 +52,7 @@ namespace OpenRa
|
||||
{
|
||||
var a = w.CreateActor("Bridge", new int2(ni, nj), null);
|
||||
var br = a.traits.Get<Bridge>();
|
||||
br.SetTiles(template, replacedTiles);
|
||||
br.SetTiles(w, template, replacedTiles);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ namespace OpenRa
|
||||
FileSystem.UnmountTemporaryPackages();
|
||||
Rules.LoadRules(mapName, usingAftermath);
|
||||
|
||||
world = null; // trying to access the old world will NRE, rather than silently doing it wrong.
|
||||
world = new World();
|
||||
Game.world.ActorAdded += a =>
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using OpenRa.FileFormats;
|
||||
using OpenRa.Support;
|
||||
using OpenRa.Traits;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace OpenRa
|
||||
{
|
||||
@@ -143,9 +144,7 @@ namespace OpenRa
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
[System.Diagnostics.Conditional( "SANITY_CHECKS" )]
|
||||
[Conditional( "SANITY_CHECKS" )]
|
||||
static void CheckSanePath( List<int2> path )
|
||||
{
|
||||
if( path.Count == 0 )
|
||||
@@ -160,7 +159,7 @@ namespace OpenRa
|
||||
}
|
||||
}
|
||||
|
||||
[System.Diagnostics.Conditional("SANITY_CHECKS")]
|
||||
[Conditional("SANITY_CHECKS")]
|
||||
static void CheckSanePath2(List<int2> path, int2 src, int2 dest)
|
||||
{
|
||||
if (path.Count == 0)
|
||||
|
||||
@@ -39,7 +39,12 @@ namespace OpenRa
|
||||
var p = queue.Pop();
|
||||
cellInfo[ p.Location.X, p.Location.Y ].Seen = true;
|
||||
|
||||
if (passableCost[(int)umt][p.Location.X, p.Location.Y] == float.PositiveInfinity)
|
||||
var custom2 = Game.world.customTerrain[p.Location.X, p.Location.Y];
|
||||
var thisCost = (custom2 != null)
|
||||
? custom2.GetCost(p.Location, umt)
|
||||
: passableCost[(int)umt][p.Location.X, p.Location.Y];
|
||||
|
||||
if (thisCost == float.PositiveInfinity)
|
||||
return p.Location;
|
||||
|
||||
foreach( int2 d in Util.directions )
|
||||
@@ -51,6 +56,7 @@ namespace OpenRa
|
||||
continue;
|
||||
|
||||
var custom = Game.world.customTerrain[newHere.X, newHere.Y];
|
||||
if (custom != null) throw new NotImplementedException();
|
||||
var costHere = (custom != null) ? custom.GetCost(newHere, umt) : passableCost[(int)umt][newHere.X, newHere.Y];
|
||||
|
||||
if (costHere == float.PositiveInfinity)
|
||||
|
||||
@@ -32,17 +32,17 @@ namespace OpenRa.Traits
|
||||
yield return new Renderable(t.Value, Game.CellSize * t.Key, PaletteType.Gold);
|
||||
}
|
||||
|
||||
public void SetTiles(TileTemplate template, Dictionary<int2, int> replacedTiles)
|
||||
public void SetTiles(World world, TileTemplate template, Dictionary<int2, int> replacedTiles)
|
||||
{
|
||||
Template = template;
|
||||
Tiles = replacedTiles;
|
||||
|
||||
foreach (var t in replacedTiles.Keys)
|
||||
Game.world.customTerrain[t.X, t.Y] = this;
|
||||
world.customTerrain[t.X, t.Y] = this;
|
||||
|
||||
if (cachedTheater != Game.world.Map.Theater)
|
||||
if (cachedTheater != world.Map.Theater)
|
||||
{
|
||||
cachedTheater = Game.world.Map.Theater;
|
||||
cachedTheater = world.Map.Theater;
|
||||
sprites = new Cache<TileReference, Sprite>(
|
||||
x => SheetBuilder.Add(Game.world.TileSet.GetBytes(x),
|
||||
new Size(Game.CellSize, Game.CellSize)));
|
||||
|
||||
Reference in New Issue
Block a user