[ZB]: Use mem allocator for branding (#781)

Co-authored-by: Roxanne <roxanne@thegamebakers.com>
This commit is contained in:
Louve 2023-02-17 13:43:52 +01:00 committed by GitHub
parent 512b7cb2ae
commit a588dea4b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 21 deletions

View File

@ -25,11 +25,8 @@ namespace Assets
header->techniqueSet = builder->getIW4OfApi()->read<Game::MaterialTechniqueSet>(Game::ASSET_TYPE_TECHNIQUE_SET, name);
auto ptr = header->techniqueSet;
if (!ptr)
if (ptr)
{
return;
}
while (ptr->remappedTechniqueSet && ptr->remappedTechniqueSet != ptr)
{
ptr = ptr->remappedTechniqueSet;
@ -51,6 +48,7 @@ namespace Assets
}
}
}
}
void IMaterialTechniqueSet::mark(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder)
{

View File

@ -535,13 +535,12 @@ namespace Components
// Add branding asset
void ZoneBuilder::Zone::addBranding()
{
static std::string zoneBranding;
const auto now = std::chrono::system_clock::now();
zoneBranding = std::format("Built using the IW4x ZoneBuilder! {:%d-%m-%Y %H:%M:%OS}", now);
auto zoneBranding = std::format("Built using the IW4x ZoneBuilder! {:%d-%m-%Y %H:%M:%OS}", now);
auto brandingLen = zoneBranding.size(); // + 1 is added by the save code
this->branding = {this->zoneName.data(), 0, static_cast<int>(brandingLen), zoneBranding.data()};
this->branding = {this->zoneName.data(), 0, static_cast<int>(brandingLen), getAllocator()->duplicateString(zoneBranding)};
if (this->findAsset(Game::ASSET_TYPE_RAWFILE, this->branding.name) != -1)
{