diff --git a/src/Ext/Anim/Body.cpp b/src/Ext/Anim/Body.cpp index 7ff60ec1d0..20c6fece68 100644 --- a/src/Ext/Anim/Body.cpp +++ b/src/Ext/Anim/Body.cpp @@ -383,7 +383,7 @@ void AnimExt::InvalidateTechnoPointers(TechnoClass* pTechno) if (!pExt) { auto const ID = pAnim->Type ? pAnim->Type->get_ID() : "N/A"; - Debug::FatalErrorAndExit(__FUNCTION__": Animation of type[% s] has no ExtData!", ID); + Debug::FatalErrorAndExit(__FUNCTION__": Animation of type[%s] has no ExtData!", ID); } if (pExt->Invoker == pTechno) @@ -403,7 +403,7 @@ void AnimExt::InvalidateParticleSystemPointers(ParticleSystemClass* pParticleSys if (!pExt) { auto const ID = pAnim->Type ? pAnim->Type->get_ID() : "N/A"; - Debug::FatalErrorAndExit(__FUNCTION__": Animation of type[% s] has no ExtData!", ID); + Debug::FatalErrorAndExit(__FUNCTION__": Animation of type[%s] has no ExtData!", ID); } if (pExt->AttachedSystem == pParticleSystem) diff --git a/src/Ext/Bullet/Trajectories/PhobosTrajectory.h b/src/Ext/Bullet/Trajectories/PhobosTrajectory.h index d4e6d1bd9c..e51f24ffb4 100644 --- a/src/Ext/Bullet/Trajectories/PhobosTrajectory.h +++ b/src/Ext/Bullet/Trajectories/PhobosTrajectory.h @@ -1,13 +1,10 @@ #pragma once -#include #include #include #include -class BulletTypeExt; - enum class TrajectoryFlag : int { Invalid = -1, @@ -33,7 +30,7 @@ class PhobosTrajectoryType virtual bool Save(PhobosStreamWriter& Stm) const; virtual TrajectoryFlag Flag() const = 0; virtual void Read(CCINIClass* const pINI, const char* pSection) = 0; - virtual std::unique_ptr CreateInstance() const = 0; + [[nodiscard]] virtual std::unique_ptr CreateInstance() const = 0; Valueable Trajectory_Speed { 100.0 }; }; diff --git a/src/Ext/Rules/Body.cpp b/src/Ext/Rules/Body.cpp index 0c57e70790..55fe00f963 100644 --- a/src/Ext/Rules/Body.cpp +++ b/src/Ext/Rules/Body.cpp @@ -411,7 +411,7 @@ void RulesExt::ExtData::ReplaceVoxelLightSources() { needCacheFlush = true; auto source = this->VoxelLightSource.Get().Normalized(); - Game::VoxelLightSource = Matrix3D::VoxelDefaultMatrix.get() * source; + Game::VoxelLightSource = Matrix3D::VoxelDefaultMatrix() * source; } /* @@ -420,7 +420,7 @@ void RulesExt::ExtData::ReplaceVoxelLightSources() { needCacheFlush = true; auto source = this->VoxelShadowLightSource.Get().Normalized(); - Game::VoxelShadowLightSource = Matrix3D::VoxelDefaultMatrix.get() * source; + Game::VoxelShadowLightSource = Matrix3D::VoxelDefaultMatrix() * source; } */ diff --git a/src/Ext/Scenario/Hooks.cpp b/src/Ext/Scenario/Hooks.cpp index 912b96c145..dd20388715 100644 --- a/src/Ext/Scenario/Hooks.cpp +++ b/src/Ext/Scenario/Hooks.cpp @@ -8,7 +8,7 @@ DEFINE_HOOK(0x6870D7, ReadScenario_LoadingScreens, 0x5) LEA_STACK(CCINIClass*, pINI, STACK_OFFSET(0x174, -0x158)); - auto const pScenario = ScenarioClass::Instance.get(); + auto const pScenario = ScenarioClass::Instance(); auto const scenarioName = pScenario->FileName; auto const defaultsSection = "Defaults"; diff --git a/src/Ext/Techno/Body.Internal.cpp b/src/Ext/Techno/Body.Internal.cpp index 98d6242541..e643505f45 100644 --- a/src/Ext/Techno/Body.Internal.cpp +++ b/src/Ext/Techno/Body.Internal.cpp @@ -80,7 +80,7 @@ CoordStruct TechnoExt::GetBurstFLH(TechnoClass* pThis, int weaponIndex, bool& FL auto const pExt = TechnoTypeExt::ExtMap.Find(pThis->GetTechnoType()); auto pInf = abstract_cast(pThis); - auto pickedFLHs = pExt->WeaponBurstFLHs; + std::span> pickedFLHs = pExt->WeaponBurstFLHs; if (pThis->Veterancy.IsElite()) { diff --git a/src/New/Entity/LaserTrailClass.h b/src/New/Entity/LaserTrailClass.h index f5d54f937e..0fb61bde96 100644 --- a/src/New/Entity/LaserTrailClass.h +++ b/src/New/Entity/LaserTrailClass.h @@ -1,12 +1,10 @@ #pragma once #include -#include #include #include -#include class LaserTrailClass { diff --git a/src/New/Type/AttachEffectTypeClass.h b/src/New/Type/AttachEffectTypeClass.h index a9cddaf3de..bb54e9b57f 100644 --- a/src/New/Type/AttachEffectTypeClass.h +++ b/src/New/Type/AttachEffectTypeClass.h @@ -205,7 +205,7 @@ class AEAttachInfoTypeClass ValueableVector DurationOverrides; ValueableVector Delays; ValueableVector InitialDelays; - NullableVector RecreationDelays; + ValueableVector RecreationDelays; void LoadFromINI(CCINIClass* pINI, const char* pSection); bool Load(PhobosStreamReader& stm, bool registerForChange); diff --git a/src/Utilities/Container.h b/src/Utilities/Container.h index a26669270e..a6d43d0eb8 100644 --- a/src/Utilities/Container.h +++ b/src/Utilities/Container.h @@ -344,19 +344,16 @@ class Container if constexpr (HasOffset) ResetExtensionPointer(key); - if (auto const val = new extension_type(key)) - { - val->EnsureConstanted(); + auto const val = new extension_type(key); - if constexpr (HasOffset) - SetExtensionPointer(key, val); + val->EnsureConstanted(); - this->Items.insert(key, val); + if constexpr (HasOffset) + SetExtensionPointer(key, val); - return val; - } + this->Items.insert(key, val); - return nullptr; + return val; } extension_type_ptr TryAllocate(base_type_ptr key, bool bCond, const std::string_view& nMessage) diff --git a/src/Utilities/Helpers.Alex.h b/src/Utilities/Helpers.Alex.h index 9dc439a546..2cf70ad297 100644 --- a/src/Utilities/Helpers.Alex.h +++ b/src/Utilities/Helpers.Alex.h @@ -245,7 +245,7 @@ namespace Helpers // Starkku: Reimplemented using AircraftTrackerClass. if (includeInAir) { - auto const airTracker = &AircraftTrackerClass::Instance.get(); + auto const airTracker = &AircraftTrackerClass::Instance; airTracker->FillCurrentVector(MapClass::Instance->GetCellAt(coords), Game::F2I(spread)); for (auto pTechno = airTracker->Get(); pTechno; pTechno = airTracker->Get()) @@ -413,13 +413,13 @@ namespace Helpers } template - inline bool is_any_of(Value&& value, Option&& option) + constexpr bool is_any_of(Value&& value, Option&& option) { return value == option; } template - inline bool is_any_of(Value&& value, Option&& first_option, Options&&... other_options) + constexpr bool is_any_of(Value&& value, Option&& first_option, Options&&... other_options) { return value == first_option || is_any_of(std::forward(value), std::forward(other_options)...); }