Log an error when no cells are available to spawn starting units

This commit is contained in:
abcdefg30
2016-10-05 15:49:24 +02:00
parent 7513707b8d
commit deb082c91e

View File

@@ -89,7 +89,10 @@ namespace OpenRA.Mods.Common.Traits
var mi = w.Map.Rules.Actors[s.ToLowerInvariant()].TraitInfo<MobileInfo>();
var validCells = supportSpawnCells.Where(c => mi.CanEnterCell(w, null, c));
if (!validCells.Any())
throw new InvalidOperationException("No cells available to spawn starting unit {0}".F(s));
{
Log.Write("debug", "No cells available to spawn starting unit {0} for player {1}".F(s, p));
continue;
}
var cell = validCells.Random(w.SharedRandom);
var subCell = mi.SharesCell ? w.ActorMap.FreeSubCell(cell) : 0;