[Fix] Some obscure bugs like not being able to shoot secondary weapons right away.

This commit is contained in:
Allanis 2013-09-30 22:43:33 +01:00
parent 090bcb96c8
commit 6dd9de9835

View File

@ -270,7 +270,9 @@ static void pilot_shootWeapon(Pilot* p, PilotOutfit* w, const unsigned int t) {
delay = outfit_delay(w->outfit);
/* Check to see if weapon is ready. */
if((SDL_GetTicks() - w->timer) < (unsigned int)(delay/quantity)) return;
if((w->timer > 0) &&
(SDL_GetTicks() - w->timer) < (unsigned int)(delay/quantity))
return;
/* Regular bolt weapons. */
if(outfit_isBolt(w->outfit)) {
/* Enough energy? */
@ -287,7 +289,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, p->solid->dir,
w->beamid = beam_start(w->outfit, p->solid->dir,
&p->solid->pos, &p->solid->vel, p->id, t);
}
@ -749,6 +751,8 @@ int pilot_addOutfit(Pilot* pilot, Outfit* outfit, int quantity) {
pilot->outfits = realloc(pilot->outfits, (pilot->noutfits+1)*sizeof(PilotOutfit));
pilot->outfits[pilot->noutfits].outfit = outfit;
pilot->outfits[pilot->noutfits].quantity = q;
pilot->outfits[pilot->noutfits].timer = 0;
pilot->outfits[pilot->noutfits].beamid = 0;
/* Can't be over max. */
if(pilot->outfits[pilot->noutfits].quantity > outfit->max) {