throw specific exception on missing sound definitions

This commit is contained in:
Matthias Mailänder
2013-04-01 10:11:34 +02:00
parent 0695307730
commit 3dfce53bf8

View File

@@ -259,9 +259,7 @@ namespace OpenRA
var ID = (voicedUnit != null) ? voicedUnit.ActorID : 0; var ID = (voicedUnit != null) ? voicedUnit.ActorID : 0;
var clip = (voicedUnit != null) ? rules.VoicePools.Value[definition].GetNext() : rules.NotificationsPools.Value[definition].GetNext(); string clip;
if (clip == null) return false;
var suffix = rules.DefaultVariant; var suffix = rules.DefaultVariant;
var prefix = rules.DefaultPrefix; var prefix = rules.DefaultPrefix;
@@ -272,7 +270,21 @@ namespace OpenRA
if (!rules.VoicePools.Value.ContainsKey("AttackMove")) if (!rules.VoicePools.Value.ContainsKey("AttackMove"))
rules.VoicePools.Value.Add("AttackMove", rules.VoicePools.Value["Move"]); rules.VoicePools.Value.Add("AttackMove", rules.VoicePools.Value["Move"]);
if (!rules.VoicePools.Value.ContainsKey(definition))
throw new InvalidOperationException("Can't find {0} in voice pool.".F(definition));
clip = rules.VoicePools.Value[definition].GetNext();
} }
else
{
if (!rules.NotificationsPools.Value.ContainsKey(definition))
throw new InvalidOperationException("Can't find {0} in notification pool.".F(definition));
clip = rules.NotificationsPools.Value[definition].GetNext();
}
if (String.IsNullOrEmpty(clip)) return false;
if (variant != null) if (variant != null)
{ {