Skip to content

Commit e1a2fe0

Browse files
authored
Merge pull request #3059 from JohnAFernandez/Fix-Missile-Capacity-Bug
Fix the support ship refilling ships to the wrong secondary capacity
2 parents 3108b2f + 521430f commit e1a2fe0

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

code/missionui/missionweaponchoice.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3426,6 +3426,7 @@ void wl_bash_ship_weapons(ship_weapon *swp, wss_unit *slot)
34263426
if ( (slot->wep_count[sidx] > 0) && (slot->wep[sidx] >= 0) ) {
34273427
swp->secondary_bank_weapons[j] = slot->wep[sidx];
34283428
swp->secondary_bank_ammo[j] = slot->wep_count[sidx];
3429+
swp->secondary_bank_start_ammo[j] = (int)std::lround(Ship_info[slot->ship_class].secondary_bank_ammo_capacity[i] / Weapon_info[swp->secondary_bank_weapons[j]].cargo_size);
34293430
j++;
34303431
}
34313432
}

code/network/multimsgs.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6159,6 +6159,7 @@ void process_post_sync_data_packet(ubyte *data, header *hinfo)
61596159
for (j = 0; j < shipp->weapons.num_primary_banks; j++) {
61606160
GET_SHORT(val_short);
61616161
shipp->weapons.primary_bank_weapons[j] = static_cast<int>(val_short);
6162+
shipp->weapons.primary_bank_start_ammo[j] = (int)std::lround(Ship_info[shipp->ship_info_index].primary_bank_ammo_capacity[j] / Weapon_info[shipp->weapons.primary_bank_weapons[j]].cargo_size);
61626163
}
61636164

61646165
// secondary weapon info
@@ -6167,6 +6168,7 @@ void process_post_sync_data_packet(ubyte *data, header *hinfo)
61676168
shipp->weapons.secondary_bank_weapons[j] = static_cast<int>(val_short);
61686169
GET_SHORT(val_short);
61696170
shipp->weapons.secondary_bank_ammo[j] = static_cast<int>(val_short);
6171+
shipp->weapons.secondary_bank_start_ammo[j] = (int)std::lround(Ship_info[shipp->ship_info_index].secondary_bank_ammo_capacity[j] / Weapon_info[shipp->weapons.secondary_bank_weapons[j]].cargo_size);
61706172
}
61716173

61726174
// other flags

code/ship/ship.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class ship_weapon {
134134
// end dynamic weapon linking
135135

136136
int secondary_bank_ammo[MAX_SHIP_SECONDARY_BANKS]; // Number of missiles left in secondary bank
137-
int secondary_bank_start_ammo[MAX_SHIP_SECONDARY_BANKS]; // Number of missiles starting in secondary bank
137+
int secondary_bank_start_ammo[MAX_SHIP_SECONDARY_BANKS]; // Number of missiles starting in secondary bank -- Every time the secondary bank changes, this must change too!
138138
int secondary_bank_capacity[MAX_SHIP_SECONDARY_BANKS]; // Max number of missiles in bank
139139
int secondary_next_slot[MAX_SHIP_SECONDARY_BANKS]; // Next slot to fire in the bank
140140
int secondary_bank_rearm_time[MAX_SHIP_SECONDARY_BANKS]; // timestamp which indicates when bank can get new missile

0 commit comments

Comments
 (0)