diff --git a/OpenRA.Mods.Common/Traits/World/MapOptions.cs b/OpenRA.Mods.Common/Traits/World/MapOptions.cs index 82c1f25c71..d17234199b 100644 --- a/OpenRA.Mods.Common/Traits/World/MapOptions.cs +++ b/OpenRA.Mods.Common/Traits/World/MapOptions.cs @@ -16,7 +16,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Controls the game speed, tech level, and short game lobby options.")] - public class MapOptionsInfo : ITraitInfo, ILobbyOptions + public class MapOptionsInfo : ITraitInfo, ILobbyOptions, IRulesetLoaded { [Desc("Default value of the short game checkbox in the lobby.")] public readonly bool ShortGameEnabled = true; @@ -57,6 +57,13 @@ namespace OpenRA.Mods.Common.Traits GameSpeed, GameSpeedLocked); } + void IRulesetLoaded.RulesetLoaded(Ruleset rules, ActorInfo info) + { + var gameSpeeds = Game.ModData.Manifest.Get().Speeds; + if (!gameSpeeds.ContainsKey(GameSpeed)) + throw new YamlException("Invalid default game speed '{0}'.".F(GameSpeed)); + } + public object Create(ActorInitializer init) { return new MapOptions(this); } }