Change to use pattern matching
This commit is contained in:
@@ -83,8 +83,7 @@ namespace OpenRA.Mods.D2k.Traits.Buildings
|
||||
{
|
||||
var map = self.World.Map;
|
||||
|
||||
var terrainInfo = self.World.Map.Rules.TerrainInfo as ITemplatedTerrainInfo;
|
||||
if (terrainInfo == null)
|
||||
if (!(self.World.Map.Rules.TerrainInfo is ITemplatedTerrainInfo terrainInfo))
|
||||
throw new InvalidDataException("D2kBuilding requires a template-based tileset.");
|
||||
|
||||
var template = terrainInfo.Templates[info.ConcreteTemplate];
|
||||
|
||||
Reference in New Issue
Block a user