fixed soundspam

This commit is contained in:
Chris Forbes
2009-11-17 21:28:03 +13:00
parent 1f04184f0f
commit 93403ca6fd
2 changed files with 8 additions and 2 deletions

View File

@@ -105,14 +105,19 @@ namespace OpenRa.Game
if (!Rules.TechTree.BuildableItems(order.Player, group).Contains(order.TargetString)) if (!Rules.TechTree.BuildableItems(order.Player, group).Contains(order.TargetString))
return; /* you can't build that!! */ return; /* you can't build that!! */
bool hasPlayedSound = false;
order.Player.BeginProduction(group, order.Player.BeginProduction(group,
new ProductionItem(order.TargetString, (int)time, ui.Cost, new ProductionItem(order.TargetString, (int)time, ui.Cost,
() => Game.world.AddFrameEndTask( () => Game.world.AddFrameEndTask(
_ => _ =>
{ {
var isBuilding = group == "Building" || group == "Defense"; var isBuilding = group == "Building" || group == "Defense";
if (order.Player == Game.LocalPlayer) if (!hasPlayedSound && order.Player == Game.LocalPlayer)
Game.PlaySound( isBuilding ? "conscmp1.aud" : "unitrdy1.aud", false); {
Game.PlaySound(isBuilding ? "conscmp1.aud" : "unitrdy1.aud", false);
hasPlayedSound = true;
}
if (!isBuilding) if (!isBuilding)
Game.BuildUnit(order.Player, order.TargetString); Game.BuildUnit(order.Player, order.TargetString);
}))); })));

View File

@@ -142,6 +142,7 @@ Global
{76F621A1-3D8E-4A99-9F7E-B071EB657817}.Debug (x86)|Mixed Platforms.ActiveCfg = Debug|Any CPU {76F621A1-3D8E-4A99-9F7E-B071EB657817}.Debug (x86)|Mixed Platforms.ActiveCfg = Debug|Any CPU
{76F621A1-3D8E-4A99-9F7E-B071EB657817}.Debug (x86)|Mixed Platforms.Build.0 = Debug|Any CPU {76F621A1-3D8E-4A99-9F7E-B071EB657817}.Debug (x86)|Mixed Platforms.Build.0 = Debug|Any CPU
{76F621A1-3D8E-4A99-9F7E-B071EB657817}.Debug (x86)|Win32.ActiveCfg = Debug|Any CPU {76F621A1-3D8E-4A99-9F7E-B071EB657817}.Debug (x86)|Win32.ActiveCfg = Debug|Any CPU
{76F621A1-3D8E-4A99-9F7E-B071EB657817}.Debug (x86)|Win32.Build.0 = Debug|Any CPU
{76F621A1-3D8E-4A99-9F7E-B071EB657817}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {76F621A1-3D8E-4A99-9F7E-B071EB657817}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{76F621A1-3D8E-4A99-9F7E-B071EB657817}.Debug|Any CPU.Build.0 = Debug|Any CPU {76F621A1-3D8E-4A99-9F7E-B071EB657817}.Debug|Any CPU.Build.0 = Debug|Any CPU
{76F621A1-3D8E-4A99-9F7E-B071EB657817}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {76F621A1-3D8E-4A99-9F7E-B071EB657817}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU