Let's not crash if WeaponInfo.Report[] is empty
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
using OpenRA.GameRules;
|
using OpenRA.GameRules;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
@@ -56,7 +57,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
self.World.Add(args.weapon.Projectile.Create(args));
|
self.World.Add(args.weapon.Projectile.Create(args));
|
||||||
|
|
||||||
if (args.weapon.Report != null)
|
if (args.weapon.Report != null && args.weapon.Report.Any())
|
||||||
Sound.Play(args.weapon.Report.Random(self.World.SharedRandom) + ".aud", self.CenterLocation);
|
Sound.Play(args.weapon.Report.Random(self.World.SharedRandom) + ".aud", self.CenterLocation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ namespace OpenRA.Mods.RA
|
|||||||
facing = 0
|
facing = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
if (args.weapon.Report != null)
|
if (args.weapon.Report != null && args.weapon.Report.Any())
|
||||||
Sound.Play(args.weapon.Report.Random(attacker.World.SharedRandom) + ".aud", pos);
|
Sound.Play(args.weapon.Report.Random(attacker.World.SharedRandom) + ".aud", pos);
|
||||||
|
|
||||||
DoImpacts(args);
|
DoImpacts(args);
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ namespace OpenRA.Mods.RA
|
|||||||
if (projectile != null)
|
if (projectile != null)
|
||||||
self.World.Add(projectile);
|
self.World.Add(projectile);
|
||||||
|
|
||||||
if (args.weapon.Report != null)
|
if (args.weapon.Report != null && args.weapon.Report.Any())
|
||||||
Sound.Play(args.weapon.Report.Random(self.World.SharedRandom) + ".aud", self.CenterLocation);
|
Sound.Play(args.weapon.Report.Random(self.World.SharedRandom) + ".aud", self.CenterLocation);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user