Skip to content

Commit

Permalink
Fix #4824, #4826
Browse files Browse the repository at this point in the history
  • Loading branch information
ashdnazg committed Jun 20, 2015
1 parent 8fef450 commit e9eca7c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions rts/Sim/Units/Scripts/UnitScript.cpp
Expand Up @@ -646,11 +646,9 @@ void CUnitScript::EmitSfx(int sfxType, int piece)
CWeapon* w = unit->weapons[index];
const SWeaponTarget origTarget = w->GetCurrentTarget();
const float3 origWeaponMuzzlePos = w->weaponMuzzlePos;

w->SetAttackTarget(SWeaponTarget(pos + dir));
w->weaponMuzzlePos = pos;
if (w->Attack(SWeaponTarget(pos + dir))) {
w->Fire(true);
}
w->Fire(true);
w->weaponMuzzlePos = origWeaponMuzzlePos;
bool origRestored = w->Attack(origTarget);
assert(origRestored);
Expand Down
2 changes: 1 addition & 1 deletion rts/Sim/Weapons/Weapon.h
Expand Up @@ -32,6 +32,7 @@ class CWeapon : public CObject

public:
bool Attack(const SWeaponTarget& newTarget);
void SetAttackTarget(const SWeaponTarget& newTarget); //< does not any checks etc. !
void DropCurrentTarget();

bool HaveTarget() const { return (currentTarget.type != Target_None); }
Expand Down Expand Up @@ -104,7 +105,6 @@ class CWeapon : public CObject
void ReAimWeapon();
void HoldIfTargetInvalid();

void SetAttackTarget(const SWeaponTarget& newTarget); //< does not any checks etc. !
bool TryTarget(const float3 tgtPos, const SWeaponTarget& trg) const;

public:
Expand Down

0 comments on commit e9eca7c

Please sign in to comment.