[Fix] Weapons should work when player is dead.

This commit is contained in:
Allanis 2014-04-28 16:57:22 +01:00
parent bd21f99e7d
commit e39e091425
3 changed files with 8 additions and 7 deletions

View File

@ -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.

View File

@ -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. */

View File

@ -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);