Remove lazy loading of binary map data.
This commit is contained in:
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!bi.AllowInvalidPlacement && world.ActorMap.GetActorsAt(cell).Any(a => a != toIgnore))
|
||||
return false;
|
||||
|
||||
var tile = world.Map.MapTiles.Value[cell];
|
||||
var tile = world.Map.Tiles[cell];
|
||||
var tileInfo = world.Map.Rules.TileSet.GetTileInfo(tile);
|
||||
|
||||
// TODO: This is bandaiding over bogus tilesets.
|
||||
|
||||
@@ -49,7 +49,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var world = self.World;
|
||||
var map = world.Map;
|
||||
|
||||
var tiles = map.MapTiles.Value;
|
||||
var pos = map.CellContaining(self.CenterPosition);
|
||||
var terrainType = map.GetTerrainInfo(pos).Type;
|
||||
|
||||
|
||||
@@ -158,7 +158,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!checkTerrainType)
|
||||
return true;
|
||||
|
||||
var tiles = self.World.Map.MapTiles.Value;
|
||||
var terrainType = self.World.Map.GetTerrainInfo(self.Location).Type;
|
||||
|
||||
return info.AllowedTerrainTypes.Contains(terrainType);
|
||||
@@ -172,7 +171,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var ramp = 0;
|
||||
if (self.World.Map.Contains(self.Location))
|
||||
{
|
||||
var tile = self.World.Map.MapTiles.Value[self.Location];
|
||||
var tile = self.World.Map.Tiles[self.Location];
|
||||
var ti = self.World.Map.Rules.TileSet.GetTileInfo(tile);
|
||||
if (ti != null)
|
||||
ramp = ti.RampType;
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
// Take all templates to overlay from the map
|
||||
foreach (var cell in w.Map.AllCells.Where(cell => bridgeTypes.ContainsKey(w.Map.MapTiles.Value[cell].Type)))
|
||||
foreach (var cell in w.Map.AllCells.Where(cell => bridgeTypes.ContainsKey(w.Map.Tiles[cell].Type)))
|
||||
ConvertBridgeToActor(w, cell);
|
||||
|
||||
// Link adjacent (long)-bridges so that artwork is updated correctly
|
||||
@@ -65,8 +65,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return;
|
||||
|
||||
// Correlate the tile "image" aka subtile with its position to find the template origin
|
||||
var tile = w.Map.MapTiles.Value[cell].Type;
|
||||
var index = w.Map.MapTiles.Value[cell].Index;
|
||||
var tile = w.Map.Tiles[cell].Type;
|
||||
var index = w.Map.Tiles[cell].Index;
|
||||
var template = w.Map.Rules.TileSet.Templates[tile];
|
||||
var ni = cell.X - index % template.Size.X;
|
||||
var nj = cell.Y - index / template.Size.X;
|
||||
@@ -80,7 +80,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}).Trait<Bridge>();
|
||||
|
||||
var subTiles = new Dictionary<CPos, byte>();
|
||||
var mapTiles = w.Map.MapTiles.Value;
|
||||
var mapTiles = w.Map.Tiles;
|
||||
|
||||
// For each subtile in the template
|
||||
for (byte ind = 0; ind < template.Size.X * template.Size.Y; ind++)
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Resources = self.TraitsImplementing<ResourceType>()
|
||||
.ToDictionary(r => r.Info.ResourceType, r => r);
|
||||
|
||||
Map.MapResources.Value.CellEntryChanged += UpdateCell;
|
||||
Map.Resources.CellEntryChanged += UpdateCell;
|
||||
}
|
||||
|
||||
public void WorldLoaded(World w, WorldRenderer wr)
|
||||
@@ -87,7 +87,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public void UpdateCell(CPos cell)
|
||||
{
|
||||
var uv = cell.ToMPos(Map);
|
||||
var tile = Map.MapResources.Value[uv];
|
||||
var tile = Map.Resources[uv];
|
||||
|
||||
var t = Tiles[cell];
|
||||
if (t.Density > 0)
|
||||
@@ -127,7 +127,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
// Set density based on the number of neighboring resources
|
||||
var adjacent = 0;
|
||||
var type = Tiles[c].Type;
|
||||
var resources = Map.MapResources.Value;
|
||||
var resources = Map.Resources;
|
||||
for (var u = -1; u < 2; u++)
|
||||
{
|
||||
for (var v = -1; v < 2; v++)
|
||||
@@ -205,7 +205,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
foreach (var kv in spriteLayers.Values)
|
||||
kv.Dispose();
|
||||
|
||||
Map.MapResources.Value.CellEntryChanged -= UpdateCell;
|
||||
Map.Resources.CellEntryChanged -= UpdateCell;
|
||||
|
||||
disposed = true;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
foreach (var cell in w.Map.AllCells)
|
||||
{
|
||||
ResourceType t;
|
||||
if (!resources.TryGetValue(w.Map.MapResources.Value[cell].Type, out t))
|
||||
if (!resources.TryGetValue(w.Map.Resources[cell].Type, out t))
|
||||
continue;
|
||||
|
||||
if (!AllowResourceAt(t, cell))
|
||||
@@ -193,7 +193,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
if (!rt.Info.AllowOnRamps)
|
||||
{
|
||||
var tile = world.Map.MapTiles.Value[cell];
|
||||
var tile = world.Map.Tiles[cell];
|
||||
var tileInfo = world.Map.Rules.TileSet.GetTileInfo(tile);
|
||||
if (tileInfo != null && tileInfo.RampType > 0)
|
||||
return false;
|
||||
|
||||
@@ -57,11 +57,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
foreach (var uv in wr.Viewport.AllVisibleCells.CandidateMapCoords)
|
||||
{
|
||||
if (!map.MapHeight.Value.Contains(uv))
|
||||
if (!map.Height.Contains(uv))
|
||||
continue;
|
||||
|
||||
var height = (int)map.MapHeight.Value[uv];
|
||||
var tile = map.MapTiles.Value[uv];
|
||||
var height = (int)map.Height[uv];
|
||||
var tile = map.Tiles[uv];
|
||||
var ti = tileSet.GetTileInfo(tile);
|
||||
var ramp = ti != null ? ti.RampType : 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user