mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-07-21 07:20:32 +00:00
feat: accept aliases for asset type names
This commit is contained in:
@@ -29,6 +29,13 @@ namespace
|
||||
|
||||
namespace IW4
|
||||
{
|
||||
Game::Game()
|
||||
: AbstractGame(ASSET_TYPE_NAMES, std::extent_v<decltype(ASSET_TYPE_NAMES)>, SUB_ASSET_TYPE_NAMES, std::extent_v<decltype(SUB_ASSET_TYPE_NAMES)>)
|
||||
{
|
||||
AddAssetTypeNameAlias<AssetTechniqueSet>("techset");
|
||||
AddAssetTypeNameAlias<AssetLightDef>("gfxlightdef");
|
||||
}
|
||||
|
||||
GameId Game::GetId() const
|
||||
{
|
||||
return GameId::IW4;
|
||||
@@ -45,36 +52,4 @@ namespace IW4
|
||||
static std::string shortName = "IW4";
|
||||
return shortName;
|
||||
}
|
||||
|
||||
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
|
||||
{
|
||||
static std::vector<GameLanguagePrefix> prefixes;
|
||||
return prefixes;
|
||||
}
|
||||
|
||||
asset_type_t Game::GetAssetTypeCount() const
|
||||
{
|
||||
return ASSET_TYPE_COUNT;
|
||||
}
|
||||
|
||||
std::optional<const char*> Game::GetAssetTypeName(const asset_type_t assetType) const
|
||||
{
|
||||
if (assetType < std::extent_v<decltype(ASSET_TYPE_NAMES)>)
|
||||
return ASSET_TYPE_NAMES[assetType];
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
asset_type_t Game::GetSubAssetTypeCount() const
|
||||
{
|
||||
return SUB_ASSET_TYPE_COUNT;
|
||||
}
|
||||
|
||||
std::optional<const char*> Game::GetSubAssetTypeName(const asset_type_t subAssetType) const
|
||||
{
|
||||
if (subAssetType < std::extent_v<decltype(SUB_ASSET_TYPE_NAMES)>)
|
||||
return SUB_ASSET_TYPE_NAMES[subAssetType];
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
} // namespace IW4
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "Game/IGame.h"
|
||||
|
||||
namespace IW4
|
||||
{
|
||||
class Game final : public IGame
|
||||
class Game final : public AbstractGame
|
||||
{
|
||||
public:
|
||||
Game();
|
||||
|
||||
[[nodiscard]] GameId GetId() const override;
|
||||
[[nodiscard]] const std::string& GetFullName() const override;
|
||||
[[nodiscard]] const std::string& GetShortName() const override;
|
||||
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
|
||||
|
||||
[[nodiscard]] asset_type_t GetAssetTypeCount() const override;
|
||||
[[nodiscard]] std::optional<const char*> GetAssetTypeName(asset_type_t assetType) const override;
|
||||
[[nodiscard]] asset_type_t GetSubAssetTypeCount() const override;
|
||||
[[nodiscard]] std::optional<const char*> GetSubAssetTypeName(asset_type_t subAssetType) const override;
|
||||
};
|
||||
} // namespace IW4
|
||||
|
||||
Reference in New Issue
Block a user