unit/unit blocking works sensibly for first-half; a few glitches due to second-half

This commit is contained in:
Chris Forbes
2009-10-26 13:04:16 +13:00
parent aa04c869a0
commit 2058134380
2 changed files with 9 additions and 4 deletions

View File

@@ -72,8 +72,8 @@ namespace OpenRa.Game
continue;
if (Game.BuildingInfluence.GetBuildingAt(newHere - offset) != null)
continue;
if (Game.UnitInfluence.GetUnitAt(newHere - offset) != null)
continue;
//if (Game.UnitInfluence.GetUnitAt(newHere - offset) != null)
// continue;
double cellCost = ( ( d.X * d.Y != 0 ) ? 1.414213563 : 1.0 ) * passableCost[(int)umt][ newHere.X, newHere.Y ];
double newCost = cellInfo[ here.X, here.Y ].MinCost + cellCost;

View File

@@ -160,7 +160,10 @@ namespace OpenRa.Game.Traits
if( firstFacing != mobile.facing )
mobile.currentAction = new Turn( firstFacing ) { NextAction = this };
else
{
{
var unitAtDest = Game.UnitInfluence.GetUnitAt(nextCell);
if ( unitAtDest != null && unitAtDest != self )
return; /* todo: repath, sometimes */
mobile.toCell = nextCell;
path.RemoveAt( path.Count - 1 );
moveFractionTotal = ( dir.X != 0 && dir.Y != 0 ) ? 35 : 25;
@@ -169,7 +172,9 @@ namespace OpenRa.Game.Traits
CalculateMoveFraction();
fromFacing = mobile.facing;
toFacing = mobile.facing;
OnComplete = OnCompleteFirstHalf;
OnComplete = OnCompleteFirstHalf;
Game.UnitInfluence.Update(mobile);
}
mobile.currentAction.Tick( self, mobile );
}