Cache WeaponInfo look-ups

This commit is contained in:
atlimit8
2015-10-03 22:29:40 -05:00
parent f2f2fd8871
commit 49d7604bd9
12 changed files with 82 additions and 53 deletions

View File

@@ -23,12 +23,12 @@ namespace OpenRA.Mods.Cnc.Effects
readonly Animation anim;
readonly Player firedBy;
readonly string palette;
readonly string weapon;
readonly WeaponInfo weapon;
int weaponDelay;
bool impacted = false;
public IonCannon(Player firedBy, string weapon, World world, CPos location, string effect, string palette, int delay)
public IonCannon(Player firedBy, WeaponInfo weapon, World world, CPos location, string effect, string palette, int delay)
{
this.firedBy = firedBy;
this.weapon = weapon;
@@ -44,7 +44,6 @@ namespace OpenRA.Mods.Cnc.Effects
anim.Tick();
if (!impacted && weaponDelay-- <= 0)
{
var weapon = world.Map.Rules.Weapons[this.weapon.ToLowerInvariant()];
weapon.Impact(target, firedBy.PlayerActor, Enumerable.Empty<int>());
impacted = true;
}