diff --git a/src/ai.c b/src/ai.c index 4daa080..a814e66 100644 --- a/src/ai.c +++ b/src/ai.c @@ -529,8 +529,8 @@ void ai_think(Pilot* pilot) { cur_pilot->solid->dir); /* Fire weapons if needs be. */ - if(ai_isFlag(AI_PRIMARY)) pilot_shoot(pilot, cur_pilot->target, 0); /* Primary. */ - if(ai_isFlag(AI_SECONDARY)) pilot_shoot(pilot, cur_pilot->target, 1); /* Secondary. */ + if(ai_isFlag(AI_PRIMARY)) pilot_shoot(pilot, 0); /* Primary. */ + if(ai_isFlag(AI_SECONDARY)) pilot_shoot(pilot, 1); /* Secondary. */ } /** diff --git a/src/pilot.c b/src/pilot.c index b68ee6b..2f2139c 100644 --- a/src/pilot.c +++ b/src/pilot.c @@ -57,7 +57,7 @@ extern void player_dead(void); extern void player_destroyed(void); extern int gui_load(const char* name); /* Internal. */ -static void pilot_shootWeapon(Pilot* p, PilotOutfit* w, const unsigned int t); +static void pilot_shootWeapon(Pilot* p, PilotOutfit* w); static void pilot_update(Pilot* pilot, const double dt); static void pilot_hyperspace(Pilot* pilot); void pilot_render(Pilot* pilot); @@ -204,7 +204,7 @@ int pilot_freeSpace(Pilot* p) { } /* Mkay, this is how we shoot. Listen up. */ -void pilot_shoot(Pilot* p, const unsigned int target, const int secondary) { +void pilot_shoot(Pilot* p, const int secondary) { int i; Outfit* o; @@ -216,11 +216,11 @@ void pilot_shoot(Pilot* p, const unsigned int target, const int secondary) { o = p->outfits[i].outfit; if(!outfit_isProp(o, OUTFIT_PROP_WEAP_SECONDARY) && (outfit_isBolt(o) || outfit_isBeam(o))) /** @todo Possibly make the neater. */ - pilot_shootWeapon(p, &p->outfits[i], target); + pilot_shootWeapon(p, &p->outfits[i]); } } else { if(!p->secondary) return; /* No secondary weapon. */ - pilot_shootWeapon(p, p->secondary, target); + pilot_shootWeapon(p, p->secondary); } } @@ -258,14 +258,14 @@ void pilot_shootStop(Pilot* p, const int secondary) { } /** - * @fn static void pilot_shootWeapon(Pilot* p, PilotOutfit* w, const unsigned int t) + * @fn static void pilot_shootWeapon(Pilot* p, PilotOutfit* w) * * @brief Actually handles the shooting, how often the player can shoot and such. * @param p Pilot that is shooting. * @param w Pilot's outfit to shoot. * @param t Pilot's target. */ -static void pilot_shootWeapon(Pilot* p, PilotOutfit* w, const unsigned int t) { +static void pilot_shootWeapon(Pilot* p, PilotOutfit* w) { int quantity, delay; /* WElll... Trying to shoot when you have no ammo?? FUUU */ quantity = pilot_oquantity(p,w); @@ -282,7 +282,7 @@ static void pilot_shootWeapon(Pilot* p, PilotOutfit* w, const unsigned int t) { p->energy -= outfit_energy(w->outfit); weapon_add(w->outfit, p->solid->dir, - &p->solid->pos, &p->solid->vel, p->id, t); + &p->solid->pos, &p->solid->vel, p->id, p->target); } /* Beam Weapons. */ @@ -292,7 +292,7 @@ static void pilot_shootWeapon(Pilot* p, PilotOutfit* w, const unsigned int t) { /** @todo Handle warmup stage. */ w->state = PILOT_OUTFIT_ON; w->beamid = beam_start(w->outfit, p->solid->dir, - &p->solid->pos, &p->solid->vel, p->id, t); + &p->solid->pos, &p->solid->vel, p->id, p->target); } /* @@ -302,7 +302,7 @@ static void pilot_shootWeapon(Pilot* p, PilotOutfit* w, const unsigned int t) { */ 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)) + if((w->outfit->type != OUTFIT_TYPE_MISSILE_DUMB) && (p->id == p->target)) return; /* Must have ammo left. */ @@ -315,7 +315,7 @@ static void pilot_shootWeapon(Pilot* p, PilotOutfit* w, const unsigned int t) { p->energy -= outfit_energy(w->outfit); weapon_add(p->ammo->outfit, p->solid->dir, &p->solid->pos, - &p->solid->vel, p->id, t); + &p->solid->vel, p->id, p->target); p->ammo->quantity -= 1; /* There's no getting this one back. */ if(p->ammo->quantity <= 0) /* Out of ammo. */ diff --git a/src/pilot.h b/src/pilot.h index 3a7d789..b2a8604 100644 --- a/src/pilot.h +++ b/src/pilot.h @@ -221,7 +221,7 @@ Fleet* fleet_get(const char* name); int pilot_getJumps(const Pilot* p); /* Misc. */ -void pilot_shoot(Pilot* p, const unsigned int target, const int secondary); +void pilot_shoot(Pilot* p, const int secondary); void pilot_shootStop(Pilot* p, const int secondary); void pilot_hit(Pilot* p, const Solid* w, const unsigned int shooter, const DamageType dtype, const double damage); diff --git a/src/player.c b/src/player.c index d92ecbb..2d0e8e0 100644 --- a/src/player.c +++ b/src/player.c @@ -1564,7 +1564,7 @@ void player_think(Pilot* pplayer) { /* Primary weapon. */ if(player_isFlag(PLAYER_PRIMARY)) { - pilot_shoot(pplayer, player->target, 0); + pilot_shoot(pplayer, 0); player_setFlag(PLAYER_PRIMARY_L); } else if(player_isFlag(PLAYER_PRIMARY_L)) { @@ -1580,7 +1580,7 @@ void player_think(Pilot* pplayer) { outfit_isBeam(pplayer->secondary->outfit)) { pilot_shootStop(pplayer, 1); } else - pilot_shoot(pplayer, player->target, 1); + pilot_shoot(pplayer, 1); player_setFlag(PLAYER_SECONDARY_L); } else if(player_isFlag(PLAYER_SECONDARY_L)) {