From d51518dc579d8159ee7c7382e570b00da400936b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 12 Mar 2020 10:01:28 -0400 Subject: [PATCH] CPlayerEnergyDrain: Make constructor explicit Prevents error-prone implicit constructions from occurring. --- Runtime/World/CPlayer.hpp | 2 +- Runtime/World/CPlayerEnergyDrain.cpp | 2 +- Runtime/World/CPlayerEnergyDrain.hpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Runtime/World/CPlayer.hpp b/Runtime/World/CPlayer.hpp index 033f7951f..ea6b8b169 100644 --- a/Runtime/World/CPlayer.hpp +++ b/Runtime/World/CPlayer.hpp @@ -138,7 +138,7 @@ private: std::vector x25c_ballTransitionsRes; TUniqueId x26c_attachedActor = kInvalidUniqueId; float x270_attachedActorTime = 0.f; - CPlayerEnergyDrain x274_energyDrain = CPlayerEnergyDrain(4); + CPlayerEnergyDrain x274_energyDrain{4}; float x288_startingJumpTimeout = 0.f; float x28c_sjTimer = 0.f; float x290_minJumpTimeout = 0.f; diff --git a/Runtime/World/CPlayerEnergyDrain.cpp b/Runtime/World/CPlayerEnergyDrain.cpp index 8cd9919a9..c4b51ebfd 100644 --- a/Runtime/World/CPlayerEnergyDrain.cpp +++ b/Runtime/World/CPlayerEnergyDrain.cpp @@ -4,7 +4,7 @@ namespace urde { -CPlayerEnergyDrain::CPlayerEnergyDrain(u32 capacity) { x0_sources.reserve(capacity); } +CPlayerEnergyDrain::CPlayerEnergyDrain(u32 numSources) { x0_sources.reserve(numSources); } void CPlayerEnergyDrain::AddEnergyDrainSource(TUniqueId id, float intensity) { x0_sources.emplace_back(id, intensity); } diff --git a/Runtime/World/CPlayerEnergyDrain.hpp b/Runtime/World/CPlayerEnergyDrain.hpp index 3b2bf9ba7..403b71e2c 100644 --- a/Runtime/World/CPlayerEnergyDrain.hpp +++ b/Runtime/World/CPlayerEnergyDrain.hpp @@ -12,7 +12,7 @@ class CPlayerEnergyDrain { float x10_energyDrainTime = 0.0f; public: - CPlayerEnergyDrain(u32); + explicit CPlayerEnergyDrain(u32 numSources); const std::vector& GetEnergyDrainSources() const { return x0_sources; } void AddEnergyDrainSource(TUniqueId, float); void RemoveEnergyDrainSource(TUniqueId id);