more tweaks
This commit is contained in:
@@ -51,11 +51,11 @@ namespace OpenRa
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
var custom = Game.world.customTerrain[newHere.X, newHere.Y];
|
var custom = Game.world.customTerrain[newHere.X, newHere.Y];
|
||||||
if (custom != null
|
var costHere = (custom != null) ? custom.GetCost(newHere, umt) : passableCost[(int)umt][newHere.X, newHere.Y];
|
||||||
&& custom.GetCost(newHere, umt) == float.PositiveInfinity)
|
|
||||||
continue;
|
if (costHere == float.PositiveInfinity)
|
||||||
if (passableCost[(int)umt][newHere.X, newHere.Y] == float.PositiveInfinity)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!Game.world.BuildingInfluence.CanMoveHere(newHere) &&
|
if (!Game.world.BuildingInfluence.CanMoveHere(newHere) &&
|
||||||
Game.world.BuildingInfluence.GetBuildingAt(newHere) != ignoreBuilding)
|
Game.world.BuildingInfluence.GetBuildingAt(newHere) != ignoreBuilding)
|
||||||
continue;
|
continue;
|
||||||
@@ -73,10 +73,7 @@ namespace OpenRa
|
|||||||
if( est == float.PositiveInfinity )
|
if( est == float.PositiveInfinity )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
float cellCost = ((d.X * d.Y != 0) ? 1.414213563f : 1.0f) *
|
float cellCost = ((d.X * d.Y != 0) ? 1.414213563f : 1.0f) * costHere;
|
||||||
(custom != null
|
|
||||||
? custom.GetCost(newHere, umt) :
|
|
||||||
passableCost[(int)umt][newHere.X, newHere.Y]);
|
|
||||||
float newCost = cellInfo[ p.Location.X, p.Location.Y ].MinCost + cellCost;
|
float newCost = cellInfo[ p.Location.X, p.Location.Y ].MinCost + cellCost;
|
||||||
|
|
||||||
if( newCost >= cellInfo[ newHere.X, newHere.Y ].MinCost )
|
if( newCost >= cellInfo[ newHere.X, newHere.Y ].MinCost )
|
||||||
|
|||||||
@@ -22,10 +22,8 @@ namespace OpenRa.Traits
|
|||||||
|
|
||||||
public Bridge(Actor self) { self.RemoveOnDeath = false; }
|
public Bridge(Actor self) { self.RemoveOnDeath = false; }
|
||||||
|
|
||||||
static Cache<TileReference, Sprite> Sprites =
|
static string cachedTheater;
|
||||||
new Cache<TileReference, Sprite>(
|
static Cache<TileReference, Sprite> sprites;
|
||||||
x => SheetBuilder.Add(Game.world.TileSet.GetBytes(x),
|
|
||||||
new Size(Game.CellSize, Game.CellSize)));
|
|
||||||
|
|
||||||
public IEnumerable<Renderable> Render(Actor self)
|
public IEnumerable<Renderable> Render(Actor self)
|
||||||
{
|
{
|
||||||
@@ -42,13 +40,22 @@ namespace OpenRa.Traits
|
|||||||
foreach (var t in replacedTiles.Keys)
|
foreach (var t in replacedTiles.Keys)
|
||||||
Game.world.customTerrain[t.X, t.Y] = this;
|
Game.world.customTerrain[t.X, t.Y] = this;
|
||||||
|
|
||||||
|
if (cachedTheater != Game.world.Map.Theater)
|
||||||
|
{
|
||||||
|
cachedTheater = Game.world.Map.Theater;
|
||||||
|
sprites = new Cache<TileReference, Sprite>(
|
||||||
|
x => SheetBuilder.Add(Game.world.TileSet.GetBytes(x),
|
||||||
|
new Size(Game.CellSize, Game.CellSize)));
|
||||||
|
}
|
||||||
|
|
||||||
TileSprites = replacedTiles.ToDictionary(
|
TileSprites = replacedTiles.ToDictionary(
|
||||||
a => a.Key,
|
a => a.Key,
|
||||||
a => Sprites[new TileReference { tile = (ushort)template.Index, image = (byte)a.Value }]);
|
a => sprites[new TileReference { tile = (ushort)template.Index, image = (byte)a.Value }]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetCost(int2 p, UnitMovementType umt)
|
public float GetCost(int2 p, UnitMovementType umt)
|
||||||
{
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
var origTile = Tiles[p]; // if this explodes, then SetTiles did something horribly wrong.
|
var origTile = Tiles[p]; // if this explodes, then SetTiles did something horribly wrong.
|
||||||
return float.PositiveInfinity;
|
return float.PositiveInfinity;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user