Skip to content

Commit

Permalink
Merge pull request #98 from Laupetin/fix/crash-on-linker
Browse files Browse the repository at this point in the history
fix: crash on trying to use linker
  • Loading branch information
Laupetin authored Jan 23, 2024
2 parents 50d4282 + 3fd17fc commit 398edc5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@

#include <unordered_set>

bool MarkingRequiredPostProcessor::RequiresMarking(std::unordered_set<const void*>& visitedStructures, const StructureInformation* info)
bool MarkingRequiredPostProcessor::CalculateRequiresMarking(std::unordered_set<const void*>& visitedStructures, StructureInformation* info)
{
if (visitedStructures.find(info) != visitedStructures.end())
return info->m_requires_marking;

visitedStructures.emplace(info);

if (info->m_asset_enum_entry)
{
info->m_requires_marking = true;
return true;
}

for (const auto& member : info->m_ordered_members)
{
Expand Down Expand Up @@ -43,12 +46,19 @@ bool MarkingRequiredPostProcessor::RequiresMarking(std::unordered_set<const void

// Any ScriptStrings or Strings need to be processed.
if (member->m_is_script_string || member->m_type && member->m_type->m_asset_enum_entry)
{
info->m_requires_marking = true;
return true;
}

if (member->m_type != nullptr && member->m_type != info && RequiresMarking(visitedStructures, member->m_type))
if (member->m_type != nullptr && member->m_type != info && CalculateRequiresMarking(visitedStructures, member->m_type))
{
info->m_requires_marking = true;
return true;
}
}

info->m_requires_marking = false;
return false;
}

Expand All @@ -59,7 +69,7 @@ bool MarkingRequiredPostProcessor::PostProcess(IDataRepository* repository)
std::unordered_set<const void*> visitedStructures;
for (const auto& info : allInfos)
{
info->m_requires_marking = RequiresMarking(visitedStructures, info);
CalculateRequiresMarking(visitedStructures, info);
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class MarkingRequiredPostProcessor final : public IPostProcessor
{
static bool RequiresMarking(std::unordered_set<const void*>& visitedStructures, const StructureInformation* info);
static bool CalculateRequiresMarking(std::unordered_set<const void*>& visitedStructures, StructureInformation* info);

public:
bool PostProcess(IDataRepository* repository) override;
Expand Down
2 changes: 1 addition & 1 deletion src/ZoneLoading/Loading/AssetMarker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ XAssetInfoGeneric* AssetMarker::GetAssetInfoByName(std::string name) const
std::vector<XAssetInfoGeneric*> AssetMarker::GetDependencies() const
{
std::vector<XAssetInfoGeneric*> dependencies;
if (!m_used_script_strings.empty())
if (!m_dependencies.empty())
{
dependencies.reserve(m_dependencies.size());
for (auto dependency : m_dependencies)
Expand Down

0 comments on commit 398edc5

Please sign in to comment.