From de91ebd91fbf164e301b23d593c96cbc7ec6cd82 Mon Sep 17 00:00:00 2001 From: Allanis Date: Fri, 30 Aug 2013 17:54:02 +0100 Subject: [PATCH] [Fix] Bug concerning not being able to shoot seeker weapons. --- dat/outfit.xml | 6 +++--- dat/ship.xml | 12 ++++++------ src/ai.c | 2 ++ src/pilot.c | 29 ++++++++++++++++++----------- 4 files changed, 29 insertions(+), 20 deletions(-) diff --git a/dat/outfit.xml b/dat/outfit.xml index 8dd6d2e..702ffa6 100644 --- a/dat/outfit.xml +++ b/dat/outfit.xml @@ -455,8 +455,8 @@ 40 10 - - + + 2 3 @@ -476,7 +476,7 @@ 2 2 700 - The Mace rocket is a very heavy fast accelerating rocket designed for high speed collisions. The rockets doesn't have too much explosive, instead it has a lot of fuel for the acceleration it uses to combust. Most of the damage it does is from the impact and not the explosion though. + The Mace rocket is a very heavy fast accelerating rocket designed for high speed collisions. The rockets doesn't have too much explosive, instead it has a lot of fuel for the acceleration it uses to combust. Most of the damage it does is from the impact and not the explosion though. mace diff --git a/dat/ship.xml b/dat/ship.xml index 5206de8..fe7bd17 100644 --- a/dat/ship.xml +++ b/dat/ship.xml @@ -315,7 +315,7 @@ 11500000 House Goddard 9999 - A Dvaered Goddard. + A Draktharr Goddard. 100 80 @@ -453,9 +453,9 @@ engine 1 400000 - House Dvaered + House Draktharr 8 - The Vendetta displays the House Dvaered philosophy very well. Give a ship as many intimidating guns as you can, layer it with as much armour and you can, and sort of forget about giving it proper electronics. It's amazing to see that these fly. + The Vendetta displays the House Draktharr philosophy very well. Give a ship as many intimidating guns as you can, layer it with as much armour and you can, and sort of forget about giving it proper electronics. It's amazing to see that these fly. 200 125 @@ -510,9 +510,9 @@ 5 - Laser Cannon - Mace Launcher - Mace Rocket + Laser Cannon + Mace Launcher + Mace Rocket diff --git a/src/ai.c b/src/ai.c index 314014b..d205296 100644 --- a/src/ai.c +++ b/src/ai.c @@ -944,6 +944,8 @@ static int ai_secondary(lua_State* L) { char* type; const char* otype; + po = NULL; + /* Search for a type. */ type = NULL; if(lua_isstring(L, 1)) diff --git a/src/pilot.c b/src/pilot.c index 7a226f6..a27dd5a 100644 --- a/src/pilot.c +++ b/src/pilot.c @@ -248,19 +248,26 @@ static void pilot_shootWeapon(Pilot* p, PilotOutfit* w, const unsigned int t) { } } /* Missile launchers. */ - /* Must be secondary weapon, Shooter can't be the target. */ - else if(outfit_isLauncher(w->outfit) && (w == p->secondary) && (p->id != t)) { - if(p->ammo && (p->ammo->quantity > 0)) { - /* Enough energy? */ - if(outfit_energy(w->outfit) > p->energy) return; + /* Must be secondary weapon. */ + else if(outfit_isLauncher(w->outfit) && (w == p->secondary)) { + /* Shooter can't be the target - Sanity check for the player. */ + if((w->outfit->type != OUTFIT_TYPE_MISSILE_DUMB) && (p->id == t)) + return; - p->energy -= outfit_energy(w->outfit); - weapon_add(p->ammo->outfit, p->solid->dir, &p->solid->pos, - &p->solid->vel, p->id, t); + /* Must have ammo left. */ + if(p->ammo && (p->ammo->quantity <= 0)) + return; - w->timer = SDL_GetTicks(); /* Can't shoot for a while. */ - p->ammo->quantity -= 1; /* There's no getting this one back. */ - } + /* Enough energy? */ + if(outfit_energy(w->outfit) > p->energy) + return; + + p->energy -= outfit_energy(w->outfit); + weapon_add(p->ammo->outfit, p->solid->dir, &p->solid->pos, + &p->solid->vel, p->id, t); + + w->timer = SDL_GetTicks(); /* Can't shoot for a while. */ + p->ammo->quantity -= 1; /* There's no getting this one back. */ } }