diff --git a/YRpp b/YRpp index 646099b78e..dd9c4cf1d7 160000 --- a/YRpp +++ b/YRpp @@ -1 +1 @@ -Subproject commit 646099b78e03ad354912b2bd2ccc9fff913c76b5 +Subproject commit dd9c4cf1d742d0b6db6a5edd8d715b8dd15ce1b9 diff --git a/src/Ext/AnimType/Body.cpp b/src/Ext/AnimType/Body.cpp index a80c7750a0..4f909f3b9a 100644 --- a/src/Ext/AnimType/Body.cpp +++ b/src/Ext/AnimType/Body.cpp @@ -84,7 +84,7 @@ void AnimTypeExt::ExtData::LoadFromINIFile(CCINIClass* pINI) INI_EX exINI(pINI); this->Palette.LoadFromINI(pINI, pID, "CustomPalette"); - this->CreateUnit.Read(exINI, pID, "CreateUnit", true); + this->CreateUnit.Read(exINI, pID, "CreateUnit"); this->CreateUnit_Facing.Read(exINI, pID, "CreateUnit.Facing"); this->CreateUnit_InheritDeathFacings.Read(exINI, pID, "CreateUnit.InheritFacings"); this->CreateUnit_InheritTurretFacings.Read(exINI, pID, "CreateUnit.InheritTurretFacings"); @@ -99,7 +99,7 @@ void AnimTypeExt::ExtData::LoadFromINIFile(CCINIClass* pINI) this->HideIfNoOre_Threshold.Read(exINI, pID, "HideIfNoOre.Threshold"); this->Layer_UseObjectLayer.Read(exINI, pID, "Layer.UseObjectLayer"); this->UseCenterCoordsIfAttached.Read(exINI, pID, "UseCenterCoordsIfAttached"); - this->Weapon.Read(exINI, pID, "Weapon", true); + this->Weapon.Read(exINI, pID, "Weapon"); this->Damage_Delay.Read(exINI, pID, "Damage.Delay"); this->Damage_DealtByInvoker.Read(exINI, pID, "Damage.DealtByInvoker"); this->Damage_ApplyOncePerLoop.Read(exINI, pID, "Damage.ApplyOncePerLoop"); @@ -108,7 +108,7 @@ void AnimTypeExt::ExtData::LoadFromINIFile(CCINIClass* pINI) this->WakeAnim.Read(exINI, pID, "WakeAnim"); this->SplashAnims.Read(exINI, pID, "SplashAnims"); this->SplashAnims_PickRandom.Read(exINI, pID, "SplashAnims.PickRandom"); - this->AttachedSystem.Read(exINI, pID, "AttachedSystem", true); + this->AttachedSystem.Read(exINI, pID, "AttachedSystem"); this->AltPalette_ApplyLighting.Read(exINI, pID, "AltPalette.ApplyLighting"); this->MakeInfantryOwner.Read(exINI, pID, "MakeInfantryOwner"); } diff --git a/src/Ext/BuildingType/Body.cpp b/src/Ext/BuildingType/Body.cpp index 5afbf93566..3c4236b313 100644 --- a/src/Ext/BuildingType/Body.cpp +++ b/src/Ext/BuildingType/Body.cpp @@ -138,7 +138,7 @@ void BuildingTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) this->Grinding_DisallowTypes.Read(exINI, pSection, "Grinding.DisallowTypes"); this->Grinding_Sound.Read(exINI, pSection, "Grinding.Sound"); this->Grinding_PlayDieSound.Read(exINI, pSection, "Grinding.PlayDieSound"); - this->Grinding_Weapon.Read(exINI, pSection, "Grinding.Weapon", true); + this->Grinding_Weapon.Read(exINI, pSection, "Grinding.Weapon"); this->DisplayIncome.Read(exINI, pSection, "DisplayIncome"); this->DisplayIncome_Houses.Read(exINI, pSection, "DisplayIncome.Houses"); diff --git a/src/Ext/Bullet/Hooks.DetonateLogics.cpp b/src/Ext/Bullet/Hooks.DetonateLogics.cpp index 72c072cae9..a4d7332e31 100644 --- a/src/Ext/Bullet/Hooks.DetonateLogics.cpp +++ b/src/Ext/Bullet/Hooks.DetonateLogics.cpp @@ -80,9 +80,16 @@ DEFINE_HOOK(0x4690C1, BulletClass_Logics_DetonateOnAllMapObjects, 0x8) } }; + auto copy_dvc = [](const DynamicVectorClass& dvc) + { + std::vector vec(dvc.Count); + std::copy(dvc.begin(), dvc.end(), vec.begin()); + return vec; + }; + if ((pWHExt->DetonateOnAllMapObjects_AffectTargets & AffectedTarget::Aircraft) != AffectedTarget::None) { - auto const aircraft = DynamicVectorClass(*AircraftClass::Array); + auto const aircraft = copy_dvc(*AircraftClass::Array); for (auto pAircraft : aircraft) tryDetonate(pAircraft); @@ -90,7 +97,7 @@ DEFINE_HOOK(0x4690C1, BulletClass_Logics_DetonateOnAllMapObjects, 0x8) if ((pWHExt->DetonateOnAllMapObjects_AffectTargets & AffectedTarget::Building) != AffectedTarget::None) { - auto const buildings = DynamicVectorClass(*BuildingClass::Array); + auto const buildings = copy_dvc(*BuildingClass::Array); for (auto pBuilding : buildings) tryDetonate(pBuilding); @@ -98,7 +105,7 @@ DEFINE_HOOK(0x4690C1, BulletClass_Logics_DetonateOnAllMapObjects, 0x8) if ((pWHExt->DetonateOnAllMapObjects_AffectTargets & AffectedTarget::Infantry) != AffectedTarget::None) { - auto const infantry = DynamicVectorClass(*InfantryClass::Array); + auto const infantry = copy_dvc(*InfantryClass::Array); for (auto pInf : infantry) tryDetonate(pInf); @@ -106,7 +113,7 @@ DEFINE_HOOK(0x4690C1, BulletClass_Logics_DetonateOnAllMapObjects, 0x8) if ((pWHExt->DetonateOnAllMapObjects_AffectTargets & AffectedTarget::Unit) != AffectedTarget::None) { - auto const units = DynamicVectorClass(*UnitClass::Array); + auto const units = copy_dvc(*UnitClass::Array); for (auto const pUnit : units) tryDetonate(pUnit); diff --git a/src/Ext/BulletType/Body.cpp b/src/Ext/BulletType/Body.cpp index c5646e2664..4f9807557c 100644 --- a/src/Ext/BulletType/Body.cpp +++ b/src/Ext/BulletType/Body.cpp @@ -35,7 +35,7 @@ void BulletTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) this->Armor.Read(exINI, pSection, "Armor"); this->Interceptable.Read(exINI, pSection, "Interceptable"); this->Interceptable_DeleteOnIntercept.Read(exINI, pSection, "Interceptable.DeleteOnIntercept"); - this->Interceptable_WeaponOverride.Read(exINI, pSection, "Interceptable.WeaponOverride", true); + this->Interceptable_WeaponOverride.Read(exINI, pSection, "Interceptable.WeaponOverride"); this->Gravity.Read(exINI, pSection, "Gravity"); PhobosTrajectoryType::CreateType(this->TrajectoryType, pINI, pSection, "Trajectory"); diff --git a/src/Ext/SWType/Body.cpp b/src/Ext/SWType/Body.cpp index ff898b3548..7544aafc15 100644 --- a/src/Ext/SWType/Body.cpp +++ b/src/Ext/SWType/Body.cpp @@ -135,7 +135,7 @@ void SWTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) } this->Detonate_Warhead.Read(exINI, pSection, "Detonate.Warhead"); - this->Detonate_Weapon.Read(exINI, pSection, "Detonate.Weapon", true); + this->Detonate_Weapon.Read(exINI, pSection, "Detonate.Weapon"); this->Detonate_Damage.Read(exINI, pSection, "Detonate.Damage"); this->Detonate_AtFirer.Read(exINI, pSection, "Detonate.AtFirer"); diff --git a/src/Ext/TechnoType/Body.cpp b/src/Ext/TechnoType/Body.cpp index e3c61db5ff..30e4eba863 100644 --- a/src/Ext/TechnoType/Body.cpp +++ b/src/Ext/TechnoType/Body.cpp @@ -151,7 +151,7 @@ void TechnoTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) this->InitialStrength = Math::clamp(this->InitialStrength, 1, pThis->Strength); this->ReloadInTransport.Read(exINI, pSection, "ReloadInTransport"); - this->ShieldType.Read(exINI, pSection, "ShieldType", true); + this->ShieldType.Read(exINI, pSection, "ShieldType"); this->Ammo_AddOnDeploy.Read(exINI, pSection, "Ammo.AddOnDeploy"); this->Ammo_AutoDeployMinimumAmount.Read(exINI, pSection, "Ammo.AutoDeployMinimumAmount"); @@ -191,9 +191,9 @@ void TechnoTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) this->ChronoRangeMinimum.Read(exINI, pSection, "ChronoRangeMinimum"); this->ChronoDelay.Read(exINI, pSection, "ChronoDelay"); - this->WarpInWeapon.Read(exINI, pSection, "WarpInWeapon", true); - this->WarpInMinRangeWeapon.Read(exINI, pSection, "WarpInMinRangeWeapon", true); - this->WarpOutWeapon.Read(exINI, pSection, "WarpOutWeapon", true); + this->WarpInWeapon.Read(exINI, pSection, "WarpInWeapon"); + this->WarpInMinRangeWeapon.Read(exINI, pSection, "WarpInMinRangeWeapon"); + this->WarpOutWeapon.Read(exINI, pSection, "WarpOutWeapon"); this->WarpInWeapon_UseDistanceAsDamage.Read(exINI, pSection, "WarpInWeapon.UseDistanceAsDamage"); this->OreGathering_Anims.Read(exINI, pSection, "OreGathering.Anims"); diff --git a/src/Ext/WarheadType/Body.cpp b/src/Ext/WarheadType/Body.cpp index d43b7e6efd..75c6bdc2c4 100644 --- a/src/Ext/WarheadType/Body.cpp +++ b/src/Ext/WarheadType/Body.cpp @@ -148,7 +148,7 @@ void WarheadTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) this->Shield_Break.Read(exINI, pSection, "Shield.Break"); this->Shield_BreakAnim.Read(exINI, pSection, "Shield.BreakAnim"); this->Shield_HitAnim.Read(exINI, pSection, "Shield.HitAnim"); - this->Shield_BreakWeapon.Read(exINI, pSection, "Shield.BreakWeapon", true); + this->Shield_BreakWeapon.Read(exINI, pSection, "Shield.BreakWeapon"); this->Shield_AbsorbPercent.Read(exINI, pSection, "Shield.AbsorbPercent"); this->Shield_PassPercent.Read(exINI, pSection, "Shield.PassPercent"); this->Shield_ReceivedDamage_Minimum.Read(exINI, pSection, "Shield.ReceivedDamage.Minimum"); diff --git a/src/Ext/WeaponType/Body.cpp b/src/Ext/WeaponType/Body.cpp index 30d9ae1bbd..6fbf40d362 100644 --- a/src/Ext/WeaponType/Body.cpp +++ b/src/Ext/WeaponType/Body.cpp @@ -44,7 +44,7 @@ void WeaponTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) this->Bolt_Arcs.Read(exINI, pSection, "Bolt.Arcs"); - this->RadType.Read(exINI, pSection, "RadType", true); + this->RadType.Read(exINI, pSection, "RadType"); this->Strafing_Shots.Read(exINI, pSection, "Strafing.Shots"); this->Strafing_SimulateBurst.Read(exINI, pSection, "Strafing.SimulateBurst"); @@ -53,7 +53,7 @@ void WeaponTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) this->Burst_Delays.Read(exINI, pSection, "Burst.Delays"); this->Burst_FireWithinSequence.Read(exINI, pSection, "Burst.FireWithinSequence"); this->AreaFire_Target.Read(exINI, pSection, "AreaFire.Target"); - this->FeedbackWeapon.Read(exINI, pSection, "FeedbackWeapon", true); + this->FeedbackWeapon.Read(exINI, pSection, "FeedbackWeapon"); this->Laser_IsSingleColor.Read(exINI, pSection, "IsSingleColor"); this->ROF_RandomDelay.Read(exINI, pSection, "ROF.RandomDelay"); this->OmniFire_TurnToTarget.Read(exINI, pSection, "OmniFire.TurnToTarget"); diff --git a/src/Misc/Hooks.INIInheritance.cpp b/src/Misc/Hooks.INIInheritance.cpp index 738a940e76..0834a036f9 100644 --- a/src/Misc/Hooks.INIInheritance.cpp +++ b/src/Misc/Hooks.INIInheritance.cpp @@ -29,7 +29,7 @@ namespace INIInheritance INI_EX exINI(ini); T result; - if (!detail::read(result, exINI, section, entry, false)) + if (!detail::read(result, exINI, section, entry)) result = defaultValue; return result; } @@ -44,7 +44,7 @@ namespace INIInheritance GET_STACK(T*, defaultValue, 0x10); INI_EX exINI(ini); - if (!detail::read(*result, exINI, section, entry, false)) + if (!detail::read(*result, exINI, section, entry)) *result = *defaultValue; return result; } @@ -60,7 +60,7 @@ namespace INIInheritance GET_STACK(CLSID, defaultValue, 0x10); INI_EX exINI(ini); - if (!detail::read(*result, exINI, section, entry, false)) + if (!detail::read(*result, exINI, section, entry)) *result = defaultValue; return result; } diff --git a/src/New/Type/Affiliated/InterceptorTypeClass.cpp b/src/New/Type/Affiliated/InterceptorTypeClass.cpp index d655f7256a..a86a439021 100644 --- a/src/New/Type/Affiliated/InterceptorTypeClass.cpp +++ b/src/New/Type/Affiliated/InterceptorTypeClass.cpp @@ -24,7 +24,7 @@ void InterceptorTypeClass::LoadFromINI(CCINIClass* pINI, const char* pSection) this->MinimumGuardRange.Read(exINI, pSection, "Interceptor.%sMinimumGuardRange"); this->Weapon.Read(exINI, pSection, "Interceptor.Weapon"); this->DeleteOnIntercept.Read(exINI, pSection, "Interceptor.DeleteOnIntercept"); - this->WeaponOverride.Read(exINI, pSection, "Interceptor.WeaponOverride", true); + this->WeaponOverride.Read(exINI, pSection, "Interceptor.WeaponOverride"); this->WeaponReplaceProjectile.Read(exINI, pSection, "Interceptor.WeaponReplaceProjectile"); this->WeaponCumulativeDamage.Read(exINI, pSection, "Interceptor.WeaponCumulativeDamage"); this->KeepIntact.Read(exINI, pSection, "Interceptor.KeepIntact"); diff --git a/src/New/Type/RadTypeClass.cpp b/src/New/Type/RadTypeClass.cpp index 5e22d4064d..a0866e2ee2 100644 --- a/src/New/Type/RadTypeClass.cpp +++ b/src/New/Type/RadTypeClass.cpp @@ -21,7 +21,7 @@ void RadTypeClass::LoadFromINI(CCINIClass* pINI) INI_EX exINI(pINI); - this->RadWarhead.Read(exINI, section, "RadSiteWarhead", true); + this->RadWarhead.Read(exINI, section, "RadSiteWarhead"); this->RadWarhead_Detonate.Read(exINI, section, "RadSiteWarhead.Detonate"); this->RadSiteColor.Read(exINI, section, "RadColor"); this->DurationMultiple.Read(exINI, section, "RadDurationMultiple"); diff --git a/src/New/Type/ShieldTypeClass.cpp b/src/New/Type/ShieldTypeClass.cpp index 1d34613927..07aba99692 100644 --- a/src/New/Type/ShieldTypeClass.cpp +++ b/src/New/Type/ShieldTypeClass.cpp @@ -58,7 +58,7 @@ void ShieldTypeClass::LoadFromINI(CCINIClass* pINI) this->BreakAnim.Read(exINI, pSection, "BreakAnim"); this->HitAnim.Read(exINI, pSection, "HitAnim"); - this->BreakWeapon.Read(exINI, pSection, "BreakWeapon", true); + this->BreakWeapon.Read(exINI, pSection, "BreakWeapon"); this->AbsorbPercent.Read(exINI, pSection, "AbsorbPercent"); this->PassPercent.Read(exINI, pSection, "PassPercent"); diff --git a/src/Utilities/Template.h b/src/Utilities/Template.h index 02de66524b..f8c8f5e30b 100644 --- a/src/Utilities/Template.h +++ b/src/Utilities/Template.h @@ -111,7 +111,8 @@ class Valueable return &this->Value; } - inline void Read(INI_EX& parser, const char* pSection, const char* pKey, bool Allocate = false); + template + inline void Read(INI_EX& parser, const char* pSection, const char* pKey); inline bool Load(PhobosStreamReader& Stm, bool RegisterForChange); @@ -217,7 +218,8 @@ class Nullable : public Valueable this->HasValue = false; } - inline void Read(INI_EX& parser, const char* pSection, const char* pKey, bool Allocate = false); + template + inline void Read(INI_EX& parser, const char* pSection, const char* pKey); inline bool Load(PhobosStreamReader& Stm, bool RegisterForChange); diff --git a/src/Utilities/TemplateDef.h b/src/Utilities/TemplateDef.h index f173eb4095..f85dba87f4 100644 --- a/src/Utilities/TemplateDef.h +++ b/src/Utilities/TemplateDef.h @@ -61,16 +61,16 @@ namespace detail { T::FindOrAllocate(arg) }->std::same_as; }; - template - inline bool read(T& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate = false) + template + inline bool read(T &value, INI_EX &parser, const char *pSection, const char *pKey) { if (parser.ReadString(pSection, pKey)) { using base_type = std::remove_pointer_t; auto const pValue = parser.value(); - T parsed; //TODO: allocate should be a template param - if constexpr (HasFindOrAllocate) - parsed = (allocate ? base_type::FindOrAllocate : base_type::Find)(pValue); + T parsed; + if constexpr (HasFindOrAllocate && allocate) + parsed = base_type::FindOrAllocate(pValue); else parsed = base_type::Find(pValue); @@ -89,7 +89,7 @@ namespace detail } template <> - inline bool read(bool& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(bool &value, INI_EX &parser, const char *pSection, const char *pKey) { bool buffer; @@ -107,7 +107,7 @@ namespace detail } template <> - inline bool read(int& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(int &value, INI_EX &parser, const char *pSection, const char *pKey) { int buffer; @@ -125,7 +125,7 @@ namespace detail } template <> - inline bool read(ArmorType& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(ArmorType &value, INI_EX &parser, const char *pSection, const char *pKey) { int buffer = value; @@ -146,7 +146,7 @@ namespace detail } template <> - inline bool read(unsigned short& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(unsigned short &value, INI_EX &parser, const char *pSection, const char *pKey) { int buffer; @@ -160,7 +160,7 @@ namespace detail } template <> - inline bool read(BYTE& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(BYTE &value, INI_EX &parser, const char *pSection, const char *pKey) { int buffer; @@ -185,7 +185,7 @@ namespace detail } template <> - inline bool read(float& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(float &value, INI_EX &parser, const char *pSection, const char *pKey) { double buffer; @@ -203,7 +203,7 @@ namespace detail } template <> - inline bool read(double& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(double &value, INI_EX &parser, const char *pSection, const char *pKey) { double buffer; @@ -221,16 +221,16 @@ namespace detail } template <> - inline bool read(Point2D& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(Point2D &value, INI_EX &parser, const char *pSection, const char *pKey) { - if (parser.Read2Integers(pSection, pKey, (int*)&value)) + if (parser.Read2Integers(pSection, pKey, (int *)&value)) return true; return false; } template <> - inline bool read>(Vector2D& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read>(Vector2D &value, INI_EX &parser, const char *pSection, const char *pKey) { if (parser.Read2Doubles(pSection, pKey, (double*)&value)) return true; @@ -239,7 +239,7 @@ namespace detail } template <> - inline bool read(CoordStruct& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(CoordStruct &value, INI_EX &parser, const char *pSection, const char *pKey) { if (parser.Read3Integers(pSection, pKey, (int*)&value)) return true; @@ -248,7 +248,7 @@ namespace detail } template <> - inline bool read(ColorStruct& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(ColorStruct &value, INI_EX &parser, const char *pSection, const char *pKey) { ColorStruct buffer; @@ -266,7 +266,7 @@ namespace detail } template <> - inline bool read>(PartialVector2D& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read>(PartialVector2D &value, INI_EX &parser, const char *pSection, const char *pKey) { value.ValueCount = parser.ReadMultipleIntegers(pSection, pKey, (int*)&value, 2); @@ -277,7 +277,7 @@ namespace detail } template <> - inline bool read>(PartialVector2D& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read>(PartialVector2D &value, INI_EX &parser, const char *pSection, const char *pKey) { value.ValueCount = parser.ReadMultipleDoubles(pSection, pKey, (double*)&value, 2); @@ -288,9 +288,9 @@ namespace detail } template <> - inline bool read>(PartialVector3D& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read>(PartialVector3D &value, INI_EX &parser, const char *pSection, const char *pKey) { - value.ValueCount = parser.ReadMultipleIntegers(pSection, pKey, (int*)&value, 3); + value.ValueCount = parser.ReadMultipleIntegers(pSection, pKey, (int *)&value, 3); if (value.ValueCount > 0) return true; @@ -299,7 +299,7 @@ namespace detail } template <> - inline bool read>(PartialVector3D& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read>(PartialVector3D &value, INI_EX &parser, const char *pSection, const char *pKey) { value.ValueCount = parser.ReadMultipleDoubles(pSection, pKey, (double*)&value, 3); @@ -310,7 +310,7 @@ namespace detail } template <> - inline bool read(CSFText& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(CSFText &value, INI_EX &parser, const char *pSection, const char *pKey) { if (parser.ReadString(pSection, pKey)) { @@ -322,7 +322,7 @@ namespace detail } template <> - inline bool read(SHPStruct*& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(SHPStruct *&value, INI_EX &parser, const char *pSection, const char *pKey) { if (parser.ReadString(pSection, pKey)) { @@ -348,7 +348,7 @@ namespace detail } template <> - inline bool read(MouseCursor& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(MouseCursor &value, INI_EX &parser, const char *pSection, const char *pKey) { auto ret = false; @@ -411,7 +411,7 @@ namespace detail } template <> - inline bool read(RocketStruct& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(RocketStruct &value, INI_EX &parser, const char *pSection, const char *pKey) { auto ret = false; @@ -465,7 +465,7 @@ namespace detail } template <> - inline bool read(Leptons& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(Leptons &value, INI_EX &parser, const char *pSection, const char *pKey) { double buffer; @@ -483,7 +483,7 @@ namespace detail } template <> - inline bool read(OwnerHouseKind& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(OwnerHouseKind &value, INI_EX &parser, const char *pSection, const char *pKey) { if (parser.ReadString(pSection, pKey)) { @@ -532,7 +532,7 @@ namespace detail } template <> - inline bool read(Mission& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(Mission &value, INI_EX &parser, const char *pSection, const char *pKey) { if (parser.ReadString(pSection, pKey)) { @@ -553,7 +553,7 @@ namespace detail } template <> - inline bool read(DirType& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(DirType &value, INI_EX &parser, const char *pSection, const char *pKey) { int buffer; @@ -574,7 +574,7 @@ namespace detail } template <> - inline bool read(FacingType& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(FacingType &value, INI_EX &parser, const char *pSection, const char *pKey) { int buffer; @@ -595,7 +595,7 @@ namespace detail } template <> - inline bool read(SuperWeaponAITargetingMode& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(SuperWeaponAITargetingMode &value, INI_EX &parser, const char *pSection, const char *pKey) { if (parser.ReadString(pSection, pKey)) { @@ -622,7 +622,7 @@ namespace detail } template <> - inline bool read(AffectedTarget& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(AffectedTarget &value, INI_EX &parser, const char *pSection, const char *pKey) { if (parser.ReadString(pSection, pKey)) { @@ -679,7 +679,7 @@ namespace detail } template <> - inline bool read(AffectedHouse& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(AffectedHouse &value, INI_EX &parser, const char *pSection, const char *pKey) { if (parser.ReadString(pSection, pKey)) { @@ -728,7 +728,7 @@ namespace detail } template <> - inline bool read(AttachedAnimFlag& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(AttachedAnimFlag &value, INI_EX &parser, const char *pSection, const char *pKey) { if (parser.ReadString(pSection, pKey)) { @@ -760,14 +760,13 @@ namespace detail value = parsed; return true; - } return false; } template <> - inline bool read(AreaFireTarget& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(AreaFireTarget &value, INI_EX &parser, const char *pSection, const char *pKey) { if (parser.ReadString(pSection, pKey)) { @@ -796,7 +795,7 @@ namespace detail } template <> - inline bool read(SelfHealGainType& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(SelfHealGainType &value, INI_EX &parser, const char *pSection, const char *pKey) { if (parser.ReadString(pSection, pKey)) { @@ -825,7 +824,7 @@ namespace detail } template <> - inline bool read(SlaveChangeOwnerType& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(SlaveChangeOwnerType &value, INI_EX &parser, const char *pSection, const char *pKey) { if (parser.ReadString(pSection, pKey)) { @@ -855,7 +854,7 @@ namespace detail } template <> - inline bool read(AutoDeathBehavior& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(AutoDeathBehavior &value, INI_EX &parser, const char *pSection, const char *pKey) { if (parser.ReadString(pSection, pKey)) { @@ -881,7 +880,7 @@ namespace detail } template <> - inline bool read(TextAlign& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(TextAlign &value, INI_EX &parser, const char *pSection, const char *pKey) { if (parser.ReadString(pSection, pKey)) { @@ -920,14 +919,14 @@ namespace detail } template <> - inline bool read(TranslucencyLevel& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(TranslucencyLevel &value, INI_EX &parser, const char *pSection, const char *pKey) { return value.Read(parser, pSection, pKey); } template <> - inline bool read(IronCurtainEffect& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(IronCurtainEffect &value, INI_EX &parser, const char *pSection, const char *pKey) { if (parser.ReadString(pSection, pKey)) { @@ -956,7 +955,7 @@ namespace detail } template <> - inline bool read(TargetZoneScanType& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(TargetZoneScanType &value, INI_EX &parser, const char *pSection, const char *pKey) { if (parser.ReadString(pSection, pKey)) { @@ -985,7 +984,7 @@ namespace detail } template <> - inline bool read(ChronoSparkleDisplayPosition& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(ChronoSparkleDisplayPosition &value, INI_EX &parser, const char *pSection, const char *pKey) { if (parser.ReadString(pSection, pKey)) { @@ -1026,7 +1025,7 @@ namespace detail } template <> - inline bool read(CLSID& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(CLSID &value, INI_EX &parser, const char *pSection, const char *pKey) { if (!parser.ReadString(pSection, pKey)) return false; @@ -1081,7 +1080,7 @@ if(_strcmpi(parser.value(), #name) == 0){ value = __uuidof(name ## LocomotionCla } template <> - inline bool read(HorizontalPosition& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(HorizontalPosition &value, INI_EX &parser, const char *pSection, const char *pKey) { if (parser.ReadString(pSection, pKey)) { @@ -1109,7 +1108,7 @@ if(_strcmpi(parser.value(), #name) == 0){ value = __uuidof(name ## LocomotionCla } template <> - inline bool read(VerticalPosition& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(VerticalPosition &value, INI_EX &parser, const char *pSection, const char *pKey) { if (parser.ReadString(pSection, pKey)) { @@ -1137,7 +1136,7 @@ if(_strcmpi(parser.value(), #name) == 0){ value = __uuidof(name ## LocomotionCla } template <> - inline bool read(BuildingSelectBracketPosition& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(BuildingSelectBracketPosition &value, INI_EX &parser, const char *pSection, const char *pKey) { if (parser.ReadString(pSection, pKey)) { @@ -1178,7 +1177,7 @@ if(_strcmpi(parser.value(), #name) == 0){ value = __uuidof(name ## LocomotionCla } template <> - inline bool read(DisplayInfoType& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate) + inline bool read(DisplayInfoType &value, INI_EX &parser, const char *pSection, const char *pKey) { if (parser.ReadString(pSection, pKey)) { @@ -1270,9 +1269,10 @@ if(_strcmpi(parser.value(), #name) == 0){ value = __uuidof(name ## LocomotionCla // Valueable template -void __declspec(noinline) Valueable::Read(INI_EX& parser, const char* pSection, const char* pKey, bool Allocate) +template +void __declspec(noinline) Valueable::Read(INI_EX &parser, const char *pSection, const char *pKey) { - detail::read(this->Value, parser, pSection, pKey, Allocate); + detail::read(this->Value, parser, pSection, pKey); } template @@ -1309,9 +1309,10 @@ void __declspec(noinline) ValueableIdx::Read(INI_EX& parser, const cha // Nullable template -void __declspec(noinline) Nullable::Read(INI_EX& parser, const char* pSection, const char* pKey, bool Allocate) +template +void __declspec(noinline) Nullable::Read(INI_EX& parser, const char* pSection, const char* pKey) { - if (detail::read(this->Value, parser, pSection, pKey, Allocate)) + if (detail::read(this->Value, parser, pSection, pKey)) this->HasValue = true; }