Skip to content

Commit

Permalink
fix crash in firepoint gauge
Browse files Browse the repository at this point in the history
The gauge assumes that all firepoints will always have weapons, but it's possible for a ship to have less than the maximum number of weapons.
  • Loading branch information
Goober5000 committed Sep 3, 2023
1 parent e5824b4 commit 4ce02ce
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions code/hud/hudreticle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,11 @@ void HudGaugeReticle::getFirepointStatus() {
int bankactive = 0;
ship_weapon *swp = &shipp->weapons;

// If this firepoint doesn't actually have a weapon mounted, skip all of this
if (swp->primary_bank_weapons[i] < 0) {
continue;
}

if (!timestamp_elapsed(shipp->weapons.next_primary_fire_stamp[i]))
bankactive = 1;
else if (timestamp_elapsed(shipp->weapons.primary_animation_done_time[i]))
Expand Down

0 comments on commit 4ce02ce

Please sign in to comment.