Merge pull request #12179 from abcdefg30/startCrash

Log an error when no cells are available to spawn starting units
This commit is contained in:
Oliver Brakmann
2016-12-21 21:22:25 +01:00
committed by GitHub

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;