Shift movement cost/speed into IMove; regressions in a few areas

This commit is contained in:
Paul Chote
2010-06-25 17:05:56 +12:00
parent 6a5869f2c6
commit 29fa9e3aeb
20 changed files with 178 additions and 132 deletions

View File

@@ -52,15 +52,16 @@ namespace OpenRA
public List<int2> FindUnitPath(int2 from, int2 target, Actor self)
{
var umt = self.traits.Get<Mobile>().GetMovementType();
// Todo: Reenable cache on something that isn't umt
//var umt = self.traits.Get<Mobile>().GetMovementType();
using (new PerfSample("find_unit_path"))
{
var cached = CachedPaths.FirstOrDefault(p => p.from == from && p.to == target && p.umt == umt);
if (cached != null)
{
cached.tick = Game.LocalTick;
return new List<int2>(cached.result);
}
//var cached = CachedPaths.FirstOrDefault(p => p.from == from && p.to == target && p.umt == umt);
//if (cached != null)
//{
// cached.tick = Game.LocalTick;
// return new List<int2>(cached.result);
//}
var pb = FindBidiPath(
PathSearch.FromPoint(self, target, from, true)
@@ -71,8 +72,8 @@ namespace OpenRA
CheckSanePath2(pb, from, target);
CachedPaths.RemoveAll(p => Game.LocalTick - p.tick > MaxPathAge);
CachedPaths.Add(new CachedPath { from = from, to = target, umt = umt, result = pb, tick = Game.LocalTick });
//CachedPaths.RemoveAll(p => Game.LocalTick - p.tick > MaxPathAge);
//CachedPaths.Add(new CachedPath { from = from, to = target, umt = umt, result = pb, tick = Game.LocalTick });
return new List<int2>(pb);
}
}