2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-05-17 07:21:43 +00:00

refactor: do not nest asset namespaces in game namespaces

* Duplicated namespace names are kind of annoying
This commit is contained in:
Jan Laupetin
2025-08-06 00:50:35 +02:00
parent 33c09dfe61
commit 46fb919a52
336 changed files with 1430 additions and 1480 deletions
@@ -40,14 +40,14 @@ namespace
private:
IGdtQueryable& m_gdt;
T6::attachment::InfoStringLoader m_info_string_loader;
attachment::InfoStringLoaderT6 m_info_string_loader;
};
} // namespace
namespace T6::attachment
namespace attachment
{
std::unique_ptr<AssetCreator<AssetAttachment>> CreateGdtLoader(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt, Zone& zone)
std::unique_ptr<AssetCreator<AssetAttachment>> CreateGdtLoaderT6(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt, Zone& zone)
{
return std::make_unique<GdtLoaderAttachment>(memory, searchPath, gdt, zone);
}
} // namespace T6::attachment
} // namespace attachment
@@ -8,7 +8,7 @@
#include <memory>
namespace T6::attachment
namespace attachment
{
std::unique_ptr<AssetCreator<AssetAttachment>> CreateGdtLoader(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt, Zone& zone);
} // namespace T6::attachment
std::unique_ptr<AssetCreator<T6::AssetAttachment>> CreateGdtLoaderT6(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt, Zone& zone);
} // namespace attachment
@@ -93,16 +93,16 @@ namespace
}
} // namespace
namespace T6::attachment
namespace attachment
{
InfoStringLoader::InfoStringLoader(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
InfoStringLoaderT6::InfoStringLoaderT6(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
: m_memory(memory),
m_search_path(searchPath),
m_zone(zone)
{
}
AssetCreationResult InfoStringLoader::CreateAsset(const std::string& assetName, const InfoString& infoString, AssetCreationContext& context)
AssetCreationResult InfoStringLoaderT6::CreateAsset(const std::string& assetName, const InfoString& infoString, AssetCreationContext& context)
{
auto* attachment = m_memory.Alloc<WeaponAttachment>();
attachment->szInternalName = m_memory.Dup(assetName.c_str());
@@ -121,4 +121,4 @@ namespace T6::attachment
return AssetCreationResult::Success(context.AddAsset(std::move(registration)));
}
} // namespace T6::attachment
} // namespace attachment
@@ -4,12 +4,12 @@
#include "Asset/AssetCreationResult.h"
#include "InfoString/InfoString.h"
namespace T6::attachment
namespace attachment
{
class InfoStringLoader
class InfoStringLoaderT6
{
public:
InfoStringLoader(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
InfoStringLoaderT6(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
AssetCreationResult CreateAsset(const std::string& assetName, const InfoString& infoString, AssetCreationContext& context);
@@ -18,4 +18,4 @@ namespace T6::attachment
ISearchPath& m_search_path;
Zone& m_zone;
};
} // namespace T6::attachment
} // namespace attachment
@@ -43,14 +43,14 @@ namespace
private:
ISearchPath& m_search_path;
T6::attachment::InfoStringLoader m_info_string_loader;
attachment::InfoStringLoaderT6 m_info_string_loader;
};
} // namespace
namespace T6::attachment
namespace attachment
{
std::unique_ptr<AssetCreator<AssetAttachment>> CreateRawLoader(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
std::unique_ptr<AssetCreator<AssetAttachment>> CreateRawLoaderT6(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
{
return std::make_unique<RawLoaderAttachment>(memory, searchPath, zone);
}
} // namespace T6::attachment
} // namespace attachment
@@ -7,7 +7,7 @@
#include <memory>
namespace T6::attachment
namespace attachment
{
std::unique_ptr<AssetCreator<AssetAttachment>> CreateRawLoader(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
} // namespace T6::attachment
std::unique_ptr<AssetCreator<T6::AssetAttachment>> CreateRawLoaderT6(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
} // namespace attachment
@@ -40,14 +40,14 @@ namespace
private:
IGdtQueryable& m_gdt;
T6::attachment_unique::InfoStringLoader m_info_string_loader;
attachment_unique::InfoStringLoaderT6 m_info_string_loader;
};
} // namespace
namespace T6::attachment_unique
namespace attachment_unique
{
std::unique_ptr<AssetCreator<AssetAttachmentUnique>> CreateGdtLoader(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt, Zone& zone)
std::unique_ptr<AssetCreator<AssetAttachmentUnique>> CreateGdtLoaderT6(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt, Zone& zone)
{
return std::make_unique<GdtLoaderAttachmentUnique>(memory, searchPath, gdt, zone);
}
} // namespace T6::attachment_unique
} // namespace attachment_unique
@@ -8,7 +8,7 @@
#include <memory>
namespace T6::attachment_unique
namespace attachment_unique
{
std::unique_ptr<AssetCreator<AssetAttachmentUnique>> CreateGdtLoader(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt, Zone& zone);
} // namespace T6::attachment_unique
std::unique_ptr<AssetCreator<T6::AssetAttachmentUnique>> CreateGdtLoaderT6(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt, Zone& zone);
} // namespace attachment_unique
@@ -141,7 +141,7 @@ namespace
{
// combinedAttachmentTypeMask
std::vector<eAttachment> attachmentsFromName;
if (!T6::attachment_unique::ExtractAttachmentsFromAssetName(assetName, attachmentsFromName))
if (!attachment_unique::ExtractAttachmentsFromAssetNameT6(assetName, attachmentsFromName))
{
std::cerr << std::format("Failed to determine attachments from attachment unique name \"{}\"\n", assetName);
return false;
@@ -159,9 +159,9 @@ namespace
}
} // namespace
namespace T6::attachment_unique
namespace attachment_unique
{
bool ExtractAttachmentsFromAssetName(const std::string& assetName, std::vector<eAttachment>& attachmentList)
bool ExtractAttachmentsFromAssetNameT6(const std::string& assetName, std::vector<eAttachment>& attachmentList)
{
std::vector<std::string> parts;
@@ -210,14 +210,14 @@ namespace T6::attachment_unique
return true;
}
InfoStringLoader::InfoStringLoader(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
InfoStringLoaderT6::InfoStringLoaderT6(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
: m_memory(memory),
m_search_path(searchPath),
m_zone(zone)
{
}
AssetCreationResult InfoStringLoader::CreateAsset(const std::string& assetName, const InfoString& infoString, AssetCreationContext& context)
AssetCreationResult InfoStringLoaderT6::CreateAsset(const std::string& assetName, const InfoString& infoString, AssetCreationContext& context)
{
auto* attachmentUniqueFull = m_memory.Alloc<WeaponAttachmentUniqueFull>();
attachmentUniqueFull->attachment.szInternalName = m_memory.Dup(assetName.c_str());
@@ -244,4 +244,4 @@ namespace T6::attachment_unique
return AssetCreationResult::Success(context.AddAsset(std::move(registration)));
}
} // namespace T6::attachment_unique
} // namespace attachment_unique
@@ -7,14 +7,14 @@
#include <vector>
namespace T6::attachment_unique
namespace attachment_unique
{
bool ExtractAttachmentsFromAssetName(const std::string& assetName, std::vector<eAttachment>& attachmentList);
bool ExtractAttachmentsFromAssetNameT6(const std::string& assetName, std::vector<T6::eAttachment>& attachmentList);
class InfoStringLoader
class InfoStringLoaderT6
{
public:
InfoStringLoader(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
InfoStringLoaderT6(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
AssetCreationResult CreateAsset(const std::string& assetName, const InfoString& infoString, AssetCreationContext& context);
@@ -23,4 +23,4 @@ namespace T6::attachment_unique
ISearchPath& m_search_path;
Zone& m_zone;
};
} // namespace T6::attachment_unique
} // namespace attachment_unique
@@ -11,7 +11,6 @@
#include <iostream>
using namespace T6;
using namespace ::attachment_unique;
namespace
{
@@ -26,7 +25,7 @@ namespace
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override
{
const auto fileName = GetFileNameForAssetName(assetName);
const auto fileName = attachment_unique::GetFileNameForAssetName(assetName);
const auto file = m_search_path.Open(fileName);
if (!file.IsOpen())
return AssetCreationResult::NoAction();
@@ -43,14 +42,14 @@ namespace
private:
ISearchPath& m_search_path;
T6::attachment_unique::InfoStringLoader m_info_string_loader;
attachment_unique::InfoStringLoaderT6 m_info_string_loader;
};
} // namespace
namespace T6::attachment_unique
namespace attachment_unique
{
std::unique_ptr<AssetCreator<AssetAttachmentUnique>> CreateRawLoader(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
std::unique_ptr<AssetCreator<AssetAttachmentUnique>> CreateRawLoaderT6(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
{
return std::make_unique<RawLoader>(memory, searchPath, zone);
}
} // namespace T6::attachment_unique
} // namespace attachment_unique
@@ -7,7 +7,7 @@
#include <memory>
namespace T6::attachment_unique
namespace attachment_unique
{
std::unique_ptr<AssetCreator<AssetAttachmentUnique>> CreateRawLoader(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
} // namespace T6::attachment_unique
std::unique_ptr<AssetCreator<T6::AssetAttachmentUnique>> CreateRawLoaderT6(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
} // namespace attachment_unique
@@ -12,7 +12,6 @@
using namespace nlohmann;
using namespace T6;
using namespace ::camo;
namespace
{
@@ -253,7 +252,7 @@ namespace
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override
{
const auto file = m_search_path.Open(GetJsonFileNameForAssetName(assetName));
const auto file = m_search_path.Open(camo::GetJsonFileNameForAssetName(assetName));
if (!file.IsOpen())
return AssetCreationResult::NoAction();
@@ -277,10 +276,10 @@ namespace
};
} // namespace
namespace T6::camo
namespace camo
{
std::unique_ptr<AssetCreator<AssetWeaponCamo>> CreateJsonLoader(MemoryManager& memory, ISearchPath& searchPath)
std::unique_ptr<AssetCreator<AssetWeaponCamo>> CreateJsonLoaderT6(MemoryManager& memory, ISearchPath& searchPath)
{
return std::make_unique<WeaponCamoLoader>(memory, searchPath);
}
} // namespace T6::camo
} // namespace camo
@@ -7,7 +7,7 @@
#include <memory>
namespace T6::camo
namespace camo
{
std::unique_ptr<AssetCreator<AssetWeaponCamo>> CreateJsonLoader(MemoryManager& memory, ISearchPath& searchPath);
} // namespace T6::camo
std::unique_ptr<AssetCreator<T6::AssetWeaponCamo>> CreateJsonLoaderT6(MemoryManager& memory, ISearchPath& searchPath);
} // namespace camo
@@ -40,14 +40,14 @@ namespace
private:
IGdtQueryable& m_gdt;
T6::weapon::InfoStringLoader m_info_string_loader;
weapon::InfoStringLoaderT6 m_info_string_loader;
};
} // namespace
namespace T6::weapon
namespace weapon
{
std::unique_ptr<AssetCreator<AssetWeapon>> CreateGdtLoader(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt, Zone& zone)
std::unique_ptr<AssetCreator<AssetWeapon>> CreateGdtLoaderT6(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt, Zone& zone)
{
return std::make_unique<GdtLoaderWeapon>(memory, searchPath, gdt, zone);
}
} // namespace T6::weapon
} // namespace weapon
@@ -8,7 +8,7 @@
#include <memory>
namespace T6::weapon
namespace weapon
{
std::unique_ptr<AssetCreator<AssetWeapon>> CreateGdtLoader(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt, Zone& zone);
} // namespace T6::weapon
std::unique_ptr<AssetCreator<T6::AssetWeapon>> CreateGdtLoaderT6(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt, Zone& zone);
} // namespace weapon
@@ -568,7 +568,7 @@ namespace
&& weapon.attachmentUniques[attachmentUniqueIndex]->attachmentType != attachmentUnique.attachmentType)
{
std::vector<eAttachment> attachments;
if (T6::attachment_unique::ExtractAttachmentsFromAssetName(weapon.attachmentUniques[attachmentUniqueIndex]->szInternalName, attachments)
if (attachment_unique::ExtractAttachmentsFromAssetNameT6(weapon.attachmentUniques[attachmentUniqueIndex]->szInternalName, attachments)
&& attachments.front() == attachmentUnique.attachmentType)
{
if (lastSibling == nullptr)
@@ -599,16 +599,16 @@ namespace
}
} // namespace
namespace T6::weapon
namespace weapon
{
InfoStringLoader::InfoStringLoader(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
InfoStringLoaderT6::InfoStringLoaderT6(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
: m_memory(memory),
m_search_path(searchPath),
m_zone(zone)
{
}
AssetCreationResult InfoStringLoader::CreateAsset(const std::string& assetName, const InfoString& infoString, AssetCreationContext& context)
AssetCreationResult InfoStringLoaderT6::CreateAsset(const std::string& assetName, const InfoString& infoString, AssetCreationContext& context)
{
auto* weaponFullDef = m_memory.Alloc<WeaponFullDef>();
weaponFullDef->weapVariantDef.szInternalName = m_memory.Dup(assetName.c_str());
@@ -632,4 +632,4 @@ namespace T6::weapon
return AssetCreationResult::Success(context.AddAsset(std::move(registration)));
}
} // namespace T6::weapon
} // namespace weapon
@@ -4,12 +4,12 @@
#include "Asset/AssetCreationResult.h"
#include "InfoString/InfoString.h"
namespace T6::weapon
namespace weapon
{
class InfoStringLoader
class InfoStringLoaderT6
{
public:
InfoStringLoader(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
InfoStringLoaderT6(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
AssetCreationResult CreateAsset(const std::string& assetName, const InfoString& infoString, AssetCreationContext& context);
@@ -18,4 +18,4 @@ namespace T6::weapon
ISearchPath& m_search_path;
Zone& m_zone;
};
} // namespace T6::weapon
} // namespace weapon
@@ -11,7 +11,6 @@
#include <iostream>
using namespace T6;
using namespace ::weapon;
namespace
{
@@ -26,7 +25,7 @@ namespace
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override
{
const auto fileName = GetFileNameForAssetName(assetName);
const auto fileName = weapon::GetFileNameForAssetName(assetName);
const auto file = m_search_path.Open(fileName);
if (!file.IsOpen())
return AssetCreationResult::NoAction();
@@ -43,14 +42,14 @@ namespace
private:
ISearchPath& m_search_path;
T6::weapon::InfoStringLoader m_info_string_loader;
weapon::InfoStringLoaderT6 m_info_string_loader;
};
} // namespace
namespace T6::weapon
namespace weapon
{
std::unique_ptr<AssetCreator<AssetWeapon>> CreateRawLoader(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
std::unique_ptr<AssetCreator<AssetWeapon>> CreateRawLoaderT6(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
{
return std::make_unique<RawLoader>(memory, searchPath, zone);
}
} // namespace T6::weapon
} // namespace weapon
@@ -7,7 +7,7 @@
#include <memory>
namespace T6::weapon
namespace weapon
{
std::unique_ptr<AssetCreator<AssetWeapon>> CreateRawLoader(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
} // namespace T6::weapon
std::unique_ptr<AssetCreator<T6::AssetWeapon>> CreateRawLoaderT6(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
} // namespace weapon