From 9c9a7e07ca0dc18f400a4b31471f68eccd747d0c Mon Sep 17 00:00:00 2001 From: Allanis <allanis@saracraft.net> Date: Wed, 30 Oct 2013 21:50:44 +0000 Subject: [PATCH] [Fix] Remove the outfit when you run out of ammo. --- src/pilot.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pilot.c b/src/pilot.c index e39086e..648d277 100644 --- a/src/pilot.c +++ b/src/pilot.c @@ -316,6 +316,8 @@ static void pilot_shootWeapon(Pilot* p, PilotOutfit* w, const unsigned int t) { &p->solid->vel, p->id, t); p->ammo->quantity -= 1; /* There's no getting this one back. */ + if(p->ammo->quantity <= 0) /* Out of ammo. */ + pilot_rmOutfit(p, p->ammo->outfit, 0); /* It'll set p->ammo to NULL. */ } else { WARN("Shooting unknown weapon type: %s", w->outfit->name); }