mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-11-29 15:57:48 +00:00
refactor: do not nest asset namespaces in game namespaces
* Duplicated namespace names are kind of annoying
This commit is contained in:
@@ -122,10 +122,10 @@ namespace
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace IW3::image
|
||||
namespace image
|
||||
{
|
||||
std::unique_ptr<AssetCreator<AssetImage>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath)
|
||||
std::unique_ptr<AssetCreator<AssetImage>> CreateLoaderIW3(MemoryManager& memory, ISearchPath& searchPath)
|
||||
{
|
||||
return std::make_unique<ImageLoader>(memory, searchPath);
|
||||
}
|
||||
} // namespace IW3::image
|
||||
} // namespace image
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace IW3::image
|
||||
namespace image
|
||||
{
|
||||
std::unique_ptr<AssetCreator<AssetImage>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath);
|
||||
} // namespace IW3::image
|
||||
std::unique_ptr<AssetCreator<IW3::AssetImage>> CreateLoaderIW3(MemoryManager& memory, ISearchPath& searchPath);
|
||||
} // namespace image
|
||||
|
||||
@@ -36,10 +36,10 @@ namespace
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace IW3::localize
|
||||
namespace localize
|
||||
{
|
||||
std::unique_ptr<AssetCreator<AssetLocalize>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
|
||||
std::unique_ptr<AssetCreator<AssetLocalize>> CreateLoaderIW3(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
|
||||
{
|
||||
return std::make_unique<LocalizeLoader>(memory, searchPath, zone);
|
||||
}
|
||||
} // namespace IW3::localize
|
||||
} // namespace localize
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace IW3::localize
|
||||
namespace localize
|
||||
{
|
||||
std::unique_ptr<AssetCreator<AssetLocalize>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
|
||||
} // namespace IW3::localize
|
||||
std::unique_ptr<AssetCreator<IW3::AssetLocalize>> CreateLoaderIW3(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
|
||||
} // namespace localize
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace IW3;
|
||||
using namespace ::material;
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -23,7 +22,7 @@ namespace
|
||||
|
||||
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override
|
||||
{
|
||||
const auto file = m_search_path.Open(GetFileNameForAssetName(assetName));
|
||||
const auto file = m_search_path.Open(material::GetFileNameForAssetName(assetName));
|
||||
if (!file.IsOpen())
|
||||
return AssetCreationResult::NoAction();
|
||||
|
||||
@@ -46,10 +45,10 @@ namespace
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace IW3::material
|
||||
namespace material
|
||||
{
|
||||
std::unique_ptr<AssetCreator<AssetMaterial>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath)
|
||||
std::unique_ptr<AssetCreator<AssetMaterial>> CreateLoaderIW3(MemoryManager& memory, ISearchPath& searchPath)
|
||||
{
|
||||
return std::make_unique<MaterialLoader>(memory, searchPath);
|
||||
}
|
||||
} // namespace IW3::material
|
||||
} // namespace material
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "SearchPath/ISearchPath.h"
|
||||
#include "Utils/MemoryManager.h"
|
||||
|
||||
namespace IW3::material
|
||||
namespace material
|
||||
{
|
||||
std::unique_ptr<AssetCreator<AssetMaterial>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath);
|
||||
} // namespace IW3::material
|
||||
std::unique_ptr<AssetCreator<IW3::AssetMaterial>> CreateLoaderIW3(MemoryManager& memory, ISearchPath& searchPath);
|
||||
} // namespace material
|
||||
|
||||
@@ -91,10 +91,10 @@ namespace
|
||||
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderPhysPreset>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderXAnim>(memory));
|
||||
collection.AddAssetCreator(xmodel::CreateXModelLoader(memory, searchPath, zone));
|
||||
collection.AddAssetCreator(material::CreateLoader(memory, searchPath));
|
||||
collection.AddAssetCreator(xmodel::CreateLoaderIW3(memory, searchPath, zone));
|
||||
collection.AddAssetCreator(material::CreateLoaderIW3(memory, searchPath));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderTechniqueSet>(memory));
|
||||
collection.AddAssetCreator(image::CreateLoader(memory, searchPath));
|
||||
collection.AddAssetCreator(image::CreateLoaderIW3(memory, searchPath));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderSound>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderSoundCurve>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderLoadedSound>(memory));
|
||||
@@ -108,13 +108,13 @@ namespace
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderFont>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderMenuList>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderMenu>(memory));
|
||||
collection.AddAssetCreator(localize::CreateLoader(memory, searchPath, zone));
|
||||
collection.AddAssetCreator(localize::CreateLoaderIW3(memory, searchPath, zone));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderWeapon>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderSoundDriverGlobals>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderFx>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderImpactFx>(memory));
|
||||
collection.AddAssetCreator(raw_file::CreateLoader(memory, searchPath));
|
||||
collection.AddAssetCreator(string_table::CreateLoader(memory, searchPath));
|
||||
collection.AddAssetCreator(raw_file::CreateLoaderIW3(memory, searchPath));
|
||||
collection.AddAssetCreator(string_table::CreateLoaderIW3(memory, searchPath));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -44,10 +44,10 @@ namespace
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace IW3::raw_file
|
||||
namespace raw_file
|
||||
{
|
||||
std::unique_ptr<AssetCreator<AssetRawFile>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath)
|
||||
std::unique_ptr<AssetCreator<AssetRawFile>> CreateLoaderIW3(MemoryManager& memory, ISearchPath& searchPath)
|
||||
{
|
||||
return std::make_unique<RawFileLoader>(memory, searchPath);
|
||||
}
|
||||
} // namespace IW3::raw_file
|
||||
} // namespace raw_file
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace IW3::raw_file
|
||||
namespace raw_file
|
||||
{
|
||||
std::unique_ptr<AssetCreator<AssetRawFile>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath);
|
||||
} // namespace IW3::raw_file
|
||||
std::unique_ptr<AssetCreator<IW3::AssetRawFile>> CreateLoaderIW3(MemoryManager& memory, ISearchPath& searchPath);
|
||||
} // namespace raw_file
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <cstring>
|
||||
|
||||
using namespace IW3;
|
||||
using namespace ::string_table;
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -25,7 +24,7 @@ namespace
|
||||
if (!file.IsOpen())
|
||||
return AssetCreationResult::NoAction();
|
||||
|
||||
StringTableLoaderV1<StringTable> loader;
|
||||
string_table::StringTableLoaderV1<StringTable> loader;
|
||||
auto* stringTable = loader.LoadFromStream(assetName, m_memory, *file.m_stream);
|
||||
if (!stringTable)
|
||||
return AssetCreationResult::Failure();
|
||||
@@ -39,10 +38,10 @@ namespace
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace IW3::string_table
|
||||
namespace string_table
|
||||
{
|
||||
std::unique_ptr<AssetCreator<AssetStringTable>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath)
|
||||
std::unique_ptr<AssetCreator<AssetStringTable>> CreateLoaderIW3(MemoryManager& memory, ISearchPath& searchPath)
|
||||
{
|
||||
return std::make_unique<StringTableLoader>(memory, searchPath);
|
||||
}
|
||||
} // namespace IW3::string_table
|
||||
} // namespace string_table
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace IW3::string_table
|
||||
namespace string_table
|
||||
{
|
||||
std::unique_ptr<AssetCreator<AssetStringTable>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath);
|
||||
} // namespace IW3::string_table
|
||||
std::unique_ptr<AssetCreator<IW3::AssetStringTable>> CreateLoaderIW3(MemoryManager& memory, ISearchPath& searchPath);
|
||||
} // namespace string_table
|
||||
|
||||
Reference in New Issue
Block a user