Harmony to 1163's malady

* Looks like a shallow copy wasn't enough, so this fix creates ship_weapons::clear() which is called by ship_weapons's constructor and by ship::clear().
This commit is contained in:
z64555 committed 2017-01-31 12:04:32 -06:00
1 parent 2a574ef267
commit 4153aa80a9
2 files changed
+14 -2

No files matched your search

+6 -2
View File
@@ -5821,7 +5821,7 @@ void ship::clear()
target_shields_delta = 0.0f;
target_weapon_energy_delta = 0.0f;
weapons = ship_weapon();
weapons.clear();
// ---------- special weapons init that isn't setting things to 0
for (i = 0; i < MAX_SHIP_PRIMARY_BANKS; i++)
@@ -5993,7 +5993,7 @@ void ship::clear()
autoaim_fov = 0.0f;
}
ship_weapon::ship_weapon()
void ship_weapon::clear()
{
flags.reset();
@@ -6076,6 +6076,10 @@ ship_weapon::ship_weapon()
last_fired_weapon_signature = -1;
}
ship_weapon::ship_weapon() {
clear();
}
// NOTE: Now that the clear() member function exists, this function only sets the stuff associated with the object and ship class.
void ship_set(int ship_index, int objnum, int ship_type)
{
+8
View File
@@ -158,7 +158,15 @@ public:
size_t primary_bank_pattern_index[MAX_SHIP_PRIMARY_BANKS];
size_t secondary_bank_pattern_index[MAX_SHIP_SECONDARY_BANKS];
/**
* @brief Constructor. Calls clear()
*/
ship_weapon();
/**
* @brief Inits ship_weapon
*/
void clear();
};
//**************************************************************