From e39e091425eaa16f4bac2d3f655271cec4299106 Mon Sep 17 00:00:00 2001 From: Allanis Date: Mon, 28 Apr 2014 16:57:22 +0100 Subject: [PATCH] [Fix] Weapons should work when player is dead. --- bin/Makefile | 4 ++-- src/ldata.c | 4 +++- src/weapon.c | 7 +++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/bin/Makefile b/bin/Makefile index 7e32a93..edaac30 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -10,7 +10,7 @@ OS := LINUX export OS # Data path. -#LDATA_DEF := \"ldata\" +#LDATA_DEF := \"../ldata\" #CC = clang @@ -35,7 +35,7 @@ CPNG := #$(shell libpng-config libpng --cflags) CGL := CFLAGS := $(CLUA) $(CCSPARSE) $(CSDL) $(CXML) $(CTTF) $(CPNG) $(CGL) $(VERSION) -D$(OS) ifdef LDATA_DEF -CFLAGS += -DLDATA_DEF=$(DATA_DEF) +CFLAGS += -DLDATA_DEF=$(LDATA_DEF) endif # OS Stuff. diff --git a/src/ldata.c b/src/ldata.c index bd2c4a9..e9683a7 100644 --- a/src/ldata.c +++ b/src/ldata.c @@ -16,7 +16,9 @@ #include "ldata.h" #define LDATA_FILENAME "ldata" -#define LDATA_DEF "ldata" +#ifndef LDATA_DEF +#define LDATA_DEF LDATA_FILENAME +#endif #define XML_START_ID "Start" /**< XML document tag of module start file. */ #define START_DATA "../dat/start.xml" /**< Path to module start file. */ diff --git a/src/weapon.c b/src/weapon.c index 0dd086b..ad8aec9 100644 --- a/src/weapon.c +++ b/src/weapon.c @@ -563,8 +563,6 @@ static void weapon_update(Weapon* w, const double dt, WeaponLayer layer) { } for(i = 0; i < pilot_nstack; i++) { - /* Check for player to exist. */ - if((i == 0) && (player == NULL)) continue; psx = pilot_stack[i]->tsx; psy = pilot_stack[i]->tsy; @@ -649,8 +647,8 @@ static void weapon_hit(Weapon* w, Pilot* p, WeaponLayer layer, Vec2* pos) { } pilot_setFlag(p, PILOT_HOSTILE); pilot_rmFlag(p, PILOT_BRIBED); - ai_attacked(p, w->parent); } + ai_attacked(p, w->parent); spfx_add(spfx, pos->x, pos->y, VX(p->solid->vel), VY(p->solid->vel), SPFX_LAYER_BACK); } else @@ -699,8 +697,9 @@ static void weapon_hitBeam(Weapon* w, Pilot* p, WeaponLayer layer, } pilot_rmFlag(p, PILOT_BRIBED); pilot_setFlag(p, PILOT_HOSTILE); - ai_attacked(p, w->parent); } + ai_attacked(p, w->parent); + if(w->lockon == -1.) { /* Code to signal create explosions. */ spfx_add(spfx, pos[0].x, pos[0].y, VX(p->solid->vel), VY(p->solid->vel), SPFX_LAYER_BACK);