Skip to content

Commit

Permalink
Misc codestyle fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
chaserli committed Nov 12, 2024
1 parent df0e145 commit 542c343
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 25 deletions.
4 changes: 2 additions & 2 deletions src/Ext/Anim/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
5 changes: 1 addition & 4 deletions src/Ext/Bullet/Trajectories/PhobosTrajectory.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
#pragma once

#include <Utilities/Container.h>
#include <Utilities/TemplateDef.h>
#include <Utilities/Savegame.h>

#include <BulletClass.h>

class BulletTypeExt;

enum class TrajectoryFlag : int
{
Invalid = -1,
Expand All @@ -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<PhobosTrajectory> CreateInstance() const = 0;
[[nodiscard]] virtual std::unique_ptr<PhobosTrajectory> CreateInstance() const = 0;

Valueable<double> Trajectory_Speed { 100.0 };
};
Expand Down
4 changes: 2 additions & 2 deletions src/Ext/Rules/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/*
Expand All @@ -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;
}
*/

Expand Down
2 changes: 1 addition & 1 deletion src/Ext/Scenario/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
2 changes: 1 addition & 1 deletion src/Ext/Techno/Body.Internal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<InfantryClass*>(pThis);
auto pickedFLHs = pExt->WeaponBurstFLHs;
std::span<std::vector<CoordStruct>> pickedFLHs = pExt->WeaponBurstFLHs;

if (pThis->Veterancy.IsElite())
{
Expand Down
2 changes: 0 additions & 2 deletions src/New/Entity/LaserTrailClass.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#pragma once

#include <GeneralStructures.h>
#include <LaserDrawClass.h>
#include <HouseClass.h>

#include <New/Type/LaserTrailTypeClass.h>

#include <vector>

class LaserTrailClass
{
Expand Down
2 changes: 1 addition & 1 deletion src/New/Type/AttachEffectTypeClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class AEAttachInfoTypeClass
ValueableVector<int> DurationOverrides;
ValueableVector<int> Delays;
ValueableVector<int> InitialDelays;
NullableVector<int> RecreationDelays;
ValueableVector<int> RecreationDelays;

void LoadFromINI(CCINIClass* pINI, const char* pSection);
bool Load(PhobosStreamReader& stm, bool registerForChange);
Expand Down
15 changes: 6 additions & 9 deletions src/Utilities/Container.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,19 +344,16 @@ class Container
if constexpr (HasOffset<T>)
ResetExtensionPointer(key);

if (auto const val = new extension_type(key))
{
val->EnsureConstanted();
auto const val = new extension_type(key);

if constexpr (HasOffset<T>)
SetExtensionPointer(key, val);
val->EnsureConstanted();

this->Items.insert(key, val);
if constexpr (HasOffset<T>)
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)
Expand Down
6 changes: 3 additions & 3 deletions src/Utilities/Helpers.Alex.h
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -413,13 +413,13 @@ namespace Helpers
}

template <typename Value, typename Option>
inline bool is_any_of(Value&& value, Option&& option)
constexpr bool is_any_of(Value&& value, Option&& option)
{
return value == option;
}

template <typename Value, typename Option, typename... Options>
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>(value), std::forward<Options>(other_options)...);
}
Expand Down

0 comments on commit 542c343

Please sign in to comment.