Remove invalid caching from GCOT.
This commit is contained in:
@@ -35,9 +35,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
ConditionManager conditionManager;
|
ConditionManager conditionManager;
|
||||||
int conditionToken = ConditionManager.InvalidConditionToken;
|
int conditionToken = ConditionManager.InvalidConditionToken;
|
||||||
|
|
||||||
string cachedTerrain;
|
string cachedTerrain;
|
||||||
CPos cachedLocation;
|
|
||||||
|
|
||||||
public GrantConditionOnTerrain(ActorInitializer init, GrantConditionOnTerrainInfo info)
|
public GrantConditionOnTerrain(ActorInitializer init, GrantConditionOnTerrainInfo info)
|
||||||
{
|
{
|
||||||
@@ -53,9 +51,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
void ITick.Tick(Actor self)
|
void ITick.Tick(Actor self)
|
||||||
{
|
{
|
||||||
var loc = self.Location;
|
var loc = self.Location;
|
||||||
if (conditionManager == null || loc == cachedLocation)
|
if (conditionManager == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// The terrain type may change between ticks without the actor moving
|
||||||
var currentTerrain = loc.Layer == 0 ? self.World.Map.GetTerrainInfo(loc).Type :
|
var currentTerrain = loc.Layer == 0 ? self.World.Map.GetTerrainInfo(loc).Type :
|
||||||
tileSet[self.World.GetCustomMovementLayers()[loc.Layer].GetTerrainIndex(loc)].Type;
|
tileSet[self.World.GetCustomMovementLayers()[loc.Layer].GetTerrainIndex(loc)].Type;
|
||||||
|
|
||||||
@@ -69,7 +68,6 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
}
|
}
|
||||||
|
|
||||||
cachedTerrain = currentTerrain;
|
cachedTerrain = currentTerrain;
|
||||||
cachedLocation = loc;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user