Replace invalid tiles on map load.

This commit is contained in:
Paul Chote
2020-12-14 17:52:57 +00:00
committed by Matthias Mailänder
parent 09db4a0e25
commit c02846e2cb
2 changed files with 24 additions and 6 deletions

View File

@@ -241,5 +241,19 @@ namespace OpenRA
return tpl.Contains(r.Index) ? tpl[r.Index] : null;
}
public bool TryGetTileInfo(TerrainTile r, out TerrainTileInfo info)
{
if (!Templates.TryGetValue(r.Type, out var tpl) || !tpl.Contains(r.Index))
{
info = null;
return false;
}
info = tpl[r.Index];
return info != null;
}
public TerrainTile DefaultTerrainTile { get { return new TerrainTile(Templates.First().Key, 0); } }
}
}