From 2c091ac1241cfedc02da3c2e184a23df053fecd4 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 12 Mar 2020 17:19:33 -0400 Subject: [PATCH] CGunWeapon: Make destructor virtual This class is used as polymorphic type, so the destructor should be marked as virtual to prevent any potential undefined behavior. This also more closely matches the GM8E v0 binary itself. --- Runtime/Weapon/CGunWeapon.cpp | 2 ++ Runtime/Weapon/CGunWeapon.hpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Runtime/Weapon/CGunWeapon.cpp b/Runtime/Weapon/CGunWeapon.cpp index 1d144da87..617f5a783 100644 --- a/Runtime/Weapon/CGunWeapon.cpp +++ b/Runtime/Weapon/CGunWeapon.cpp @@ -75,6 +75,8 @@ CGunWeapon::CGunWeapon(CAssetId ancsId, EWeaponType type, TUniqueId playerId, EM BuildDependencyList(x200_beamId); } +CGunWeapon::~CGunWeapon() = default; + void CGunWeapon::AllocResPools(CPlayerState::EBeamId beam) { const auto& wPair = g_tweakGunRes->GetWeaponPair(beam); const char* const* muzzleNames = &skMuzzleNames[size_t(beam) * 2]; diff --git a/Runtime/Weapon/CGunWeapon.hpp b/Runtime/Weapon/CGunWeapon.hpp index a413a4d7e..879548feb 100644 --- a/Runtime/Weapon/CGunWeapon.hpp +++ b/Runtime/Weapon/CGunWeapon.hpp @@ -116,6 +116,8 @@ protected: public: CGunWeapon(CAssetId ancsId, EWeaponType type, TUniqueId playerId, EMaterialTypes playerMaterial, const zeus::CVector3f& scale); + virtual ~CGunWeapon(); + void AsyncLoadSuitArm(CStateManager& mgr); virtual void Reset(CStateManager& mgr); virtual void PlayAnim(NWeaponTypes::EGunAnimType type, bool loop);