mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-28 15:21:57 +00:00
fix: not reallocating IW5 clipMap pInfo from temp block
This commit is contained in:
@ -3,6 +3,8 @@
|
||||
#include "Domain/Computations/MemberComputations.h"
|
||||
#include "Domain/Computations/StructureComputations.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
RenderingUsedType::RenderingUsedType(const DataDefinition* type, StructureInformation* info)
|
||||
: m_members_loaded(false),
|
||||
m_type(type),
|
||||
@ -140,26 +142,52 @@ void RenderingContext::CreateUsedTypeCollections()
|
||||
{
|
||||
if (usedType->m_info != nullptr)
|
||||
{
|
||||
StructureComputations computations(usedType->m_info);
|
||||
const StructureComputations computations(usedType->m_info);
|
||||
|
||||
if (usedType->m_info->m_definition == usedType->m_type)
|
||||
m_used_structures.push_back(usedType);
|
||||
|
||||
if (computations.IsAsset() && usedType->m_info != m_asset)
|
||||
m_referenced_assets.push_back(usedType);
|
||||
|
||||
if (!m_has_actions)
|
||||
if (computations.IsAsset())
|
||||
{
|
||||
if ((!computations.IsAsset() || usedType->m_is_context_asset) && usedType->m_non_runtime_reference_exists
|
||||
&& usedType->m_info->m_post_load_action)
|
||||
{
|
||||
m_has_actions = true;
|
||||
}
|
||||
if (usedType->m_info != m_asset)
|
||||
m_referenced_assets.push_back(usedType);
|
||||
else
|
||||
usedType->m_is_context_asset = true;
|
||||
}
|
||||
|
||||
if (!m_has_actions && UsedTypeHasActions(usedType))
|
||||
{
|
||||
m_has_actions = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool RenderingContext::UsedTypeHasActions(const RenderingUsedType* usedType) const
|
||||
{
|
||||
const StructureComputations computations(usedType->m_info);
|
||||
|
||||
if (computations.IsAsset() && !usedType->m_is_context_asset)
|
||||
return false;
|
||||
|
||||
if (!usedType->m_non_runtime_reference_exists && !usedType->m_is_context_asset)
|
||||
return false;
|
||||
|
||||
if (usedType->m_info->m_post_load_action)
|
||||
return true;
|
||||
|
||||
if (std::ranges::any_of(usedType->m_info->m_ordered_members,
|
||||
[](const auto& member) -> bool
|
||||
{
|
||||
return member->m_post_load_action && !MemberComputations(member.get()).ShouldIgnore();
|
||||
}))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::unique_ptr<RenderingContext> RenderingContext::BuildContext(const IDataRepository* repository, StructureInformation* asset)
|
||||
{
|
||||
auto context = std::make_unique<RenderingContext>(RenderingContext(repository->GetGameName(), repository->GetAllFastFileBlocks()));
|
||||
|
@ -36,6 +36,7 @@ class RenderingContext
|
||||
void ScanUsedTypeIfNeeded(const IDataRepository* repository, MemberComputations* computations, RenderingUsedType* usedType);
|
||||
void MakeAsset(const IDataRepository* repository, StructureInformation* asset);
|
||||
void CreateUsedTypeCollections();
|
||||
bool UsedTypeHasActions(const RenderingUsedType* usedType) const;
|
||||
|
||||
public:
|
||||
std::string m_game;
|
||||
|
@ -327,6 +327,12 @@ class ZoneLoadTemplate::Internal final : BaseTemplate
|
||||
LINE("")
|
||||
LINE(MakeCustomActionCall(member->m_type->m_post_load_action.get()))
|
||||
}
|
||||
|
||||
if (member->m_post_load_action)
|
||||
{
|
||||
LINE("")
|
||||
LINE(MakeCustomActionCall(member->m_post_load_action.get()))
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -378,6 +384,12 @@ class ZoneLoadTemplate::Internal final : BaseTemplate
|
||||
LINE("")
|
||||
LINE(MakeCustomActionCall(member->m_type->m_post_load_action.get()))
|
||||
}
|
||||
|
||||
if (member->m_post_load_action)
|
||||
{
|
||||
LINE("")
|
||||
LINE(MakeCustomActionCall(member->m_post_load_action.get()))
|
||||
}
|
||||
}
|
||||
else if (computations.IsAfterPartialLoad())
|
||||
{
|
||||
@ -424,6 +436,12 @@ class ZoneLoadTemplate::Internal final : BaseTemplate
|
||||
LINE("")
|
||||
LINE(MakeCustomActionCall(member->m_type->m_post_load_action.get()))
|
||||
}
|
||||
|
||||
if (member->m_post_load_action)
|
||||
{
|
||||
LINE("")
|
||||
LINE(MakeCustomActionCall(member->m_post_load_action.get()))
|
||||
}
|
||||
}
|
||||
else if (computations.IsAfterPartialLoad())
|
||||
{
|
||||
@ -446,6 +464,12 @@ class ZoneLoadTemplate::Internal final : BaseTemplate
|
||||
LINE("")
|
||||
LINE(MakeCustomActionCall(member->m_type->m_post_load_action.get()))
|
||||
}
|
||||
|
||||
if (member->m_post_load_action)
|
||||
{
|
||||
LINE("")
|
||||
LINE(MakeCustomActionCall(member->m_post_load_action.get()))
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user