Use name of for exceptions.
This commit is contained in:
committed by
Gustas Kažukauskas
parent
a4966bc299
commit
53f959e4bf
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
world = wr.World;
|
world = wr.World;
|
||||||
terrainInfo = world.Map.Rules.TerrainInfo as ITemplatedTerrainInfo;
|
terrainInfo = world.Map.Rules.TerrainInfo as ITemplatedTerrainInfo;
|
||||||
if (terrainInfo == null)
|
if (terrainInfo == null)
|
||||||
throw new InvalidDataException("EditorTileBrush can only be used with template-based tilesets");
|
throw new InvalidDataException($"{nameof(EditorTileBrush)} can only be used with template-based tilesets");
|
||||||
|
|
||||||
editorActionManager = world.WorldActor.Trait<EditorActionManager>();
|
editorActionManager = world.WorldActor.Trait<EditorActionManager>();
|
||||||
terrainRenderer = world.WorldActor.Trait<ITiledTerrainRenderer>();
|
terrainRenderer = world.WorldActor.Trait<ITiledTerrainRenderer>();
|
||||||
|
|||||||
@@ -62,10 +62,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
var grid = Game.ModData.Manifest.Get<MapGrid>();
|
var grid = Game.ModData.Manifest.Get<MapGrid>();
|
||||||
if (grid.Type != MapGridType.RectangularIsometric)
|
if (grid.Type != MapGridType.RectangularIsometric)
|
||||||
throw new YamlException("IsometricSelectable can only be used in mods that use the RectangularIsometric MapGrid type.");
|
throw new YamlException($"{nameof(IsometricSelectable)} can only be used in mods that use the {nameof(MapGridType.RectangularIsometric)} MapGrid type.");
|
||||||
|
|
||||||
if (Height == 0 && DecorationHeight <= 0)
|
if (Height == 0 && DecorationHeight <= 0)
|
||||||
throw new YamlException("DecorationHeight must be defined and greater than 0 if Height is 0.");
|
throw new YamlException($"{nameof(DecorationHeight)} must be defined and greater than 0 if Height is 0.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public void RulesetLoaded(Ruleset rules, ActorInfo ai)
|
public void RulesetLoaded(Ruleset rules, ActorInfo ai)
|
||||||
{
|
{
|
||||||
if (!rules.Actors[SystemActors.World].HasTraitInfo<TerrainLightingInfo>())
|
if (!rules.Actors[SystemActors.World].HasTraitInfo<TerrainLightingInfo>())
|
||||||
throw new YamlException("TerrainLightSource can only be used with the world TerrainLighting trait.");
|
throw new YamlException($"{nameof(TerrainLightSource)} can only be used with the world {nameof(TerrainLighting)} trait.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override object Create(ActorInitializer init) { return new TerrainLightSource(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new TerrainLightSource(init.Self, this); }
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
map = world.Map;
|
map = world.Map;
|
||||||
terrainInfo = map.Rules.TerrainInfo as DefaultTerrain;
|
terrainInfo = map.Rules.TerrainInfo as DefaultTerrain;
|
||||||
if (terrainInfo == null)
|
if (terrainInfo == null)
|
||||||
throw new InvalidDataException("TerrainRenderer can only be used with the DefaultTerrain parser");
|
throw new InvalidDataException($"{nameof(TerrainRenderer)} can only be used with the {nameof(DefaultTerrain)} parser");
|
||||||
|
|
||||||
tileCache = new DefaultTileCache(terrainInfo);
|
tileCache = new DefaultTileCache(terrainInfo);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user