2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-03-05 12:33:02 +00:00

fix: constraint on asset name arrays

This commit is contained in:
Jan Laupetin
2026-02-27 21:09:06 +01:00
parent e749514972
commit a6d63e9b31
6 changed files with 21 additions and 11 deletions

View File

@@ -8,18 +8,20 @@ using namespace IW3;
namespace namespace
{ {
constexpr const char* ASSET_TYPE_NAMES[ASSET_TYPE_COUNT]{ constexpr const char* ASSET_TYPE_NAMES[]{
"xmodelpieces", "physpreset", "xanim", "xmodel", "material", "techniqueset", "image", "sound", "soundcurve", "loadedsound", "xmodelpieces", "physpreset", "xanim", "xmodel", "material", "techniqueset", "image", "sound", "soundcurve", "loadedsound",
"clipmap_unused", "clipmap", "comworld", "gameworldsp", "gameworldmp", "mapents", "gfxworld", "lightdef", "uimap", "font", "clipmap_unused", "clipmap", "comworld", "gameworldsp", "gameworldmp", "mapents", "gfxworld", "lightdef", "uimap", "font",
"menulist", "menu", "localize", "weapon", "snddriverglobals", "fx", "impactfx", "aitype", "mptype", "character", "menulist", "menu", "localize", "weapon", "snddriverglobals", "fx", "impactfx", "aitype", "mptype", "character",
"xmodelalias", "rawfile", "stringtable", "xmodelalias", "rawfile", "stringtable",
}; };
static_assert(std::extent_v<decltype(ASSET_TYPE_NAMES)> == ASSET_TYPE_COUNT);
constexpr const char* SUB_ASSET_TYPE_NAMES[SUB_ASSET_TYPE_COUNT]{ constexpr const char* SUB_ASSET_TYPE_NAMES[]{
"technique", "technique",
"vertexshader", "vertexshader",
"pixelshader", "pixelshader",
}; };
static_assert(std::extent_v<decltype(SUB_ASSET_TYPE_NAMES)> == SUB_ASSET_TYPE_COUNT);
} // namespace } // namespace
namespace IW3 namespace IW3

View File

@@ -8,7 +8,7 @@ using namespace IW4;
namespace namespace
{ {
constexpr const char* ASSET_TYPE_NAMES[ASSET_TYPE_COUNT]{ constexpr const char* ASSET_TYPE_NAMES[]{
"physpreset", "physcollmap", "xanim", "xmodelsurfs", "xmodel", "physpreset", "physcollmap", "xanim", "xmodelsurfs", "xmodel",
"material", "pixelshader", "vertexshader", "vertexdecl", "techniqueset", "material", "pixelshader", "vertexshader", "vertexdecl", "techniqueset",
"image", "sound", "soundcurve", "loadedsound", "clipmap_unused", "image", "sound", "soundcurve", "loadedsound", "clipmap_unused",
@@ -19,10 +19,12 @@ namespace
"xmodelalias", "rawfile", "stringtable", "leaderboard", "structureddatadef", "xmodelalias", "rawfile", "stringtable", "leaderboard", "structureddatadef",
"tracer", "vehicle", "addonmapents", "tracer", "vehicle", "addonmapents",
}; };
static_assert(std::extent_v<decltype(ASSET_TYPE_NAMES)> == ASSET_TYPE_COUNT);
constexpr const char* SUB_ASSET_TYPE_NAMES[SUB_ASSET_TYPE_COUNT]{ constexpr const char* SUB_ASSET_TYPE_NAMES[]{
"technique", "technique",
}; };
static_assert(std::extent_v<decltype(SUB_ASSET_TYPE_NAMES)> == SUB_ASSET_TYPE_COUNT);
} // namespace } // namespace
namespace IW4 namespace IW4

View File

@@ -8,7 +8,7 @@ using namespace IW5;
namespace namespace
{ {
constexpr const char* ASSET_TYPE_NAMES[ASSET_TYPE_COUNT]{ constexpr const char* ASSET_TYPE_NAMES[]{
"physpreset", "physpreset",
"physcollmap", "physcollmap",
"xanim", "xanim",
@@ -56,10 +56,12 @@ namespace
"vehicle", "vehicle",
"addonmapents", "addonmapents",
}; };
static_assert(std::extent_v<decltype(ASSET_TYPE_NAMES)> == ASSET_TYPE_COUNT);
constexpr const char* SUB_ASSET_TYPE_NAMES[SUB_ASSET_TYPE_COUNT]{ constexpr const char* SUB_ASSET_TYPE_NAMES[]{
"technique", "technique",
}; };
static_assert(std::extent_v<decltype(SUB_ASSET_TYPE_NAMES)> == SUB_ASSET_TYPE_COUNT);
} // namespace } // namespace
namespace IW5 namespace IW5

View File

@@ -8,7 +8,7 @@ using namespace T5;
namespace namespace
{ {
constexpr const char* ASSET_TYPE_NAMES[ASSET_TYPE_COUNT]{ constexpr const char* ASSET_TYPE_NAMES[]{
"xmodelpieces", "physpreset", "physconstraints", "destructibledef", "xanim", "xmodel", "material", "xmodelpieces", "physpreset", "physconstraints", "destructibledef", "xanim", "xmodel", "material",
"techniqueset", "image", "soundbank", "soundpatch", "clipmap_unused", "clipmap", "comworld", "techniqueset", "image", "soundbank", "soundpatch", "clipmap_unused", "clipmap", "comworld",
"gameworldsp", "gameworldmp", "mapents", "gfxworld", "gfxlightdef", "uimap", "font", "gameworldsp", "gameworldmp", "mapents", "gfxworld", "gfxlightdef", "uimap", "font",
@@ -17,12 +17,14 @@ namespace
"xmodelalias", "rawfile", "stringtable", "packindex", "xglobals", "ddl", "glasses", "xmodelalias", "rawfile", "stringtable", "packindex", "xglobals", "ddl", "glasses",
"emblemset", "emblemset",
}; };
static_assert(std::extent_v<decltype(ASSET_TYPE_NAMES)> == ASSET_TYPE_COUNT);
constexpr const char* SUB_ASSET_TYPE_NAMES[SUB_ASSET_TYPE_COUNT]{ constexpr const char* SUB_ASSET_TYPE_NAMES[]{
"technique", "technique",
"vertexshader", "vertexshader",
"pixelshader", "pixelshader",
}; };
static_assert(std::extent_v<decltype(SUB_ASSET_TYPE_NAMES)> == SUB_ASSET_TYPE_COUNT);
} // namespace } // namespace
namespace T5 namespace T5

View File

@@ -62,7 +62,7 @@ namespace T5
enum SubAssetType enum SubAssetType
{ {
SUB_ASSET_TYPE_TECHNIQUE = ASSET_TYPE_COUNT, SUB_ASSET_TYPE_TECHNIQUE,
SUB_ASSET_TYPE_VERTEX_SHADER, SUB_ASSET_TYPE_VERTEX_SHADER,
SUB_ASSET_TYPE_PIXEL_SHADER, SUB_ASSET_TYPE_PIXEL_SHADER,

View File

@@ -8,7 +8,7 @@ using namespace T6;
namespace namespace
{ {
constexpr const char* ASSET_TYPE_NAMES[ASSET_TYPE_COUNT]{ constexpr const char* ASSET_TYPE_NAMES[]{
"xmodelpieces", "xmodelpieces",
"physpreset", "physpreset",
"physconstraints", "physconstraints",
@@ -70,12 +70,14 @@ namespace
"footstepfxtable", "footstepfxtable",
"zbarrier", "zbarrier",
}; };
static_assert(std::extent_v<decltype(ASSET_TYPE_NAMES)> == ASSET_TYPE_COUNT);
constexpr const char* SUB_ASSET_TYPE_NAMES[SUB_ASSET_TYPE_COUNT]{ constexpr const char* SUB_ASSET_TYPE_NAMES[]{
"technique", "technique",
"vertexshader", "vertexshader",
"pixelshader", "pixelshader",
}; };
static_assert(std::extent_v<decltype(SUB_ASSET_TYPE_NAMES)> == SUB_ASSET_TYPE_COUNT);
} // namespace } // namespace
namespace T6 namespace T6