Fixed UnloadCargo stacking using new subcell API exposure

This commit is contained in:
atlimit8
2014-08-08 14:27:54 -05:00
parent 9efcf231e1
commit ff7ad53dee
8 changed files with 35 additions and 12 deletions

View File

@@ -627,18 +627,19 @@ namespace OpenRA.Mods.RA.Move
{
var pos = self.CenterPosition;
subCell = self.World.ActorMap.FreeSubCell(cell, subCell);
if (subCell == -1)
subCell = self.World.ActorMap.FreeSubCell(cell, subCell);
// TODO: solve/reduce cell is full problem
if (subCell < 0)
subCell = self.World.Map.SubCellDefaultIndex;
// Reserve the exit cell
SetPosition(self, cell);
SetPosition(self, cell, subCell);
SetVisualPosition(self, pos);
// Animate transition
var to = self.World.Map.CenterOfCell(cell);
var to = self.World.Map.CenterOfCell(cell) + self.World.Map.SubCellOffsets[subCell];
var speed = MovementSpeedForCell(self, cell);
var length = speed > 0 ? (to - pos).Length / speed : 0;