mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-01-10 18:51:49 +00:00
chore: add ability for zcg to generate files once per template
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#include "OncePerTemplateRenderingContext.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
OncePerTemplateRenderingContext::OncePerTemplateRenderingContext(std::string game,
|
||||
const Architecture gameArchitecture,
|
||||
std::vector<const FastFileBlock*> fastFileBlocks)
|
||||
: m_game(std::move(game)),
|
||||
m_architecture_mismatch(gameArchitecture != OWN_ARCHITECTURE),
|
||||
m_pointer_size(GetPointerSizeForArchitecture(gameArchitecture)),
|
||||
m_blocks(std::move(fastFileBlocks)),
|
||||
m_default_normal_block(nullptr),
|
||||
m_default_temp_block(nullptr)
|
||||
{
|
||||
for (const auto* block : m_blocks)
|
||||
{
|
||||
if (block->m_is_default)
|
||||
{
|
||||
if (block->m_type == FastFileBlockType::NORMAL && m_default_normal_block == nullptr)
|
||||
m_default_normal_block = block;
|
||||
else if (block->m_type == FastFileBlockType::TEMP && m_default_temp_block == nullptr)
|
||||
m_default_temp_block = block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<OncePerTemplateRenderingContext> OncePerTemplateRenderingContext::BuildContext(const IDataRepository* repository)
|
||||
{
|
||||
return std::make_unique<OncePerTemplateRenderingContext>(
|
||||
OncePerTemplateRenderingContext(repository->GetGameName(), repository->GetArchitecture(), repository->GetAllFastFileBlocks()));
|
||||
}
|
||||
Reference in New Issue
Block a user