From 484b482c4b4c6b26856c55ca6935d1e832582a75 Mon Sep 17 00:00:00 2001
From: Allanis <allanis@saracraft.net>
Date: Thu, 23 May 2013 21:36:51 +0100
Subject: [PATCH] [Fix] Issue with pilot being marked as hostile when not
 hostile. :/

---
 src/weapon.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/weapon.c b/src/weapon.c
index b2a7c28..49455ff 100644
--- a/src/weapon.c
+++ b/src/weapon.c
@@ -323,8 +323,10 @@ static void weapon_hit(Weapon* w, Pilot* p, WeaponLayer layer) {
   if(!pilot_isPlayer(p)) {
     if((player_target == p->id) || (RNG(0,2) == 0)) {
       if((w->parent == PLAYER_ID) &&
-          (!pilot_isFlag(p, PILOT_HOSTILE) || (RNG(0, 2) == 0)))
+          (!pilot_isFlag(p, PILOT_HOSTILE) || (RNG(0, 2) == 0))) {
         faction_modPlayer(p->faction, -1); // Slowly lower faction.
+        pilot_setFlag(p, PILOT_HOSTILE);
+      }
       ai_attacked(p, w->parent);
     }
     spfx_add(outfit_spfx(w->outfit),
@@ -335,10 +337,6 @@ static void weapon_hit(Weapon* w, Pilot* p, WeaponLayer layer) {
              VX(w->solid->pos), VY(w->solid->pos),
              VX(p->solid->vel), VY(p->solid->vel), SPFX_LAYER_FRONT);
 
-  if(w->parent == PLAYER_ID)
-    // Make hostile to player.
-    pilot_setFlag(p, PILOT_HOSTILE);
-
   // Let the ship know that is should take some kind of damage.
   pilot_hit(p, w->solid, w->parent, outfit_dmgShield(w->outfit), outfit_dmgShield(w->outfit));
   // We don't need the weapon particle any longer.