Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,7 @@ Phobos fixes:
- Fixed the bug where the `.SubjectToGround` of the Trajectory type did not consider bridges (by Noble_Fish)
- AttachEffect `DisableWeapons=true` now makes `Gattling=yes` rate tick down and stops the sounds from playing (by Starkku)
- Fixed cells with `CanBeBuiltOn=true` TerrainTypes on them not being considered valid build locations by AI (by Starkku)
- Fixed the bug where `WeaponRange.AllowWeapons` and `WeaponRange.DisallowWeapons` only support weapons listed in the `[WeaponTypes]` list (by Noble_Fish)
Fixes / interactions with other extensions:
- Taking over Ares' AlphaImage respawn logic to reduce lags from it (by NetsuNegi)
Expand Down
34 changes: 34 additions & 0 deletions src/Utilities/TemplateDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -1679,6 +1679,40 @@ void __declspec(noinline) ValueableVector<T>::Read(INI_EX& parser, const char* p
}
}

// Specialization: use FindOrAllocate for weapon vectors, avoiding dependency on [WeaponTypes] registration
Comment thread
Coronia marked this conversation as resolved.
template <>
inline void ValueableVector<WeaponTypeClass*>::Read(INI_EX& parser, const char* pSection, const char* pKey)
{
if (parser.ReadString(pSection, pKey))
{
this->clear();
char* str = parser.value();
char* context = nullptr;
for (char* cur = strtok_s(str, Phobos::readDelims, &context); cur; cur = strtok_s(nullptr, Phobos::readDelims, &context))
{
if (auto pWeapon = WeaponTypeClass::FindOrAllocate(cur))
this->push_back(pWeapon);
}
}
}

// Specialization: use FindOrAllocate for warhead vectors, avoiding dependency on [Warheads] table
template <>
inline void ValueableVector<WarheadTypeClass*>::Read(INI_EX& parser, const char* pSection, const char* pKey)
{
if (parser.ReadString(pSection, pKey))
{
this->clear();
char* str = parser.value();
char* context = nullptr;
for (char* cur = strtok_s(str, Phobos::readDelims, &context); cur; cur = strtok_s(nullptr, Phobos::readDelims, &context))
{
if (auto pWarhead = WarheadTypeClass::FindOrAllocate(cur))
this->push_back(pWarhead);
}
}
}

template <typename T>
bool ValueableVector<T>::Load(PhobosStreamReader& Stm, bool RegisterForChange)
{
Expand Down
Loading