mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-07-01 08:41:52 +00:00
refactor: use asset_type_t for ZoneDefinition
This commit is contained in:
@ -1,13 +1,13 @@
|
||||
#include "ZoneCreationContext.h"
|
||||
|
||||
ZoneCreationContext::ZoneCreationContext()
|
||||
: m_asset_search_path(nullptr),
|
||||
m_definition(nullptr)
|
||||
: m_definition(nullptr),
|
||||
m_asset_search_path(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
ZoneCreationContext::ZoneCreationContext(ISearchPath* assetSearchPath, ZoneDefinition* definition)
|
||||
: m_asset_search_path(assetSearchPath),
|
||||
m_definition(definition)
|
||||
ZoneCreationContext::ZoneCreationContext(ZoneDefinition* definition, ISearchPath* assetSearchPath)
|
||||
: m_definition(definition),
|
||||
m_asset_search_path(assetSearchPath)
|
||||
{
|
||||
}
|
||||
|
@ -5,18 +5,16 @@
|
||||
#include "Zone/Definition/ZoneDefinition.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class ZoneCreationContext
|
||||
{
|
||||
public:
|
||||
std::string m_game_name;
|
||||
ISearchPath* m_asset_search_path;
|
||||
ZoneDefinition* m_definition;
|
||||
ISearchPath* m_asset_search_path;
|
||||
std::vector<std::unique_ptr<Gdt>> m_gdt_files;
|
||||
AssetList m_ignored_assets;
|
||||
|
||||
ZoneCreationContext();
|
||||
ZoneCreationContext(ISearchPath* assetSearchPath, ZoneDefinition* definition);
|
||||
ZoneCreationContext(ZoneDefinition* definition, ISearchPath* assetSearchPath);
|
||||
};
|
||||
|
26
src/Linker/ZoneCreation/ZoneCreator.cpp
Normal file
26
src/Linker/ZoneCreation/ZoneCreator.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include "ZoneCreator.h"
|
||||
|
||||
#include "Game/IW3/ZoneCreatorIW3.h"
|
||||
#include "Game/IW4/ZoneCreatorIW4.h"
|
||||
#include "Game/IW5/ZoneCreatorIW5.h"
|
||||
#include "Game/T5/ZoneCreatorT5.h"
|
||||
#include "Game/T6/ZoneCreatorT6.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
const IZoneCreator* IZoneCreator::GetCreatorForGame(GameId game)
|
||||
{
|
||||
static const IZoneCreator* zoneCreators[static_cast<unsigned>(GameId::COUNT)]{
|
||||
new IW3::ZoneCreator(),
|
||||
new IW4::ZoneCreator(),
|
||||
new IW5::ZoneCreator(),
|
||||
new T5::ZoneCreator(),
|
||||
new T6::ZoneCreator(),
|
||||
};
|
||||
|
||||
assert(static_cast<unsigned>(game) < static_cast<unsigned>(GameId::COUNT));
|
||||
const auto* result = zoneCreators[static_cast<unsigned>(game)];
|
||||
assert(result);
|
||||
|
||||
return result;
|
||||
}
|
@ -1,10 +1,8 @@
|
||||
#pragma once
|
||||
#include "Utils/ClassUtils.h"
|
||||
|
||||
#include "Zone/Zone.h"
|
||||
#include "ZoneCreationContext.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
class IZoneCreator
|
||||
{
|
||||
public:
|
||||
@ -15,6 +13,9 @@ public:
|
||||
IZoneCreator& operator=(const IZoneCreator& other) = default;
|
||||
IZoneCreator& operator=(IZoneCreator&& other) noexcept = default;
|
||||
|
||||
_NODISCARD virtual bool SupportsGame(const std::string& gameName) const = 0;
|
||||
_NODISCARD virtual std::unique_ptr<Zone> CreateZoneForDefinition(ZoneCreationContext& context) const = 0;
|
||||
[[nodiscard]] virtual GameId GetGameId() const = 0;
|
||||
[[nodiscard]] virtual std::unique_ptr<Zone> CreateZoneForDefinition(ZoneCreationContext& context) const = 0;
|
||||
[[nodiscard]] virtual asset_type_t GetImageAssetType() const = 0;
|
||||
|
||||
static const IZoneCreator* GetCreatorForGame(GameId game);
|
||||
};
|
Reference in New Issue
Block a user