diff --git a/src/Common/Game/IW3/GameIW3.cpp b/src/Common/Game/IW3/GameIW3.cpp index 31007508..17771f20 100644 --- a/src/Common/Game/IW3/GameIW3.cpp +++ b/src/Common/Game/IW3/GameIW3.cpp @@ -8,18 +8,20 @@ using namespace IW3; 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", "clipmap_unused", "clipmap", "comworld", "gameworldsp", "gameworldmp", "mapents", "gfxworld", "lightdef", "uimap", "font", "menulist", "menu", "localize", "weapon", "snddriverglobals", "fx", "impactfx", "aitype", "mptype", "character", "xmodelalias", "rawfile", "stringtable", }; + static_assert(std::extent_v == ASSET_TYPE_COUNT); - constexpr const char* SUB_ASSET_TYPE_NAMES[SUB_ASSET_TYPE_COUNT]{ + constexpr const char* SUB_ASSET_TYPE_NAMES[]{ "technique", "vertexshader", "pixelshader", }; + static_assert(std::extent_v == SUB_ASSET_TYPE_COUNT); } // namespace namespace IW3 diff --git a/src/Common/Game/IW4/GameIW4.cpp b/src/Common/Game/IW4/GameIW4.cpp index a3ca8860..88a05a2e 100644 --- a/src/Common/Game/IW4/GameIW4.cpp +++ b/src/Common/Game/IW4/GameIW4.cpp @@ -8,7 +8,7 @@ using namespace IW4; namespace { - constexpr const char* ASSET_TYPE_NAMES[ASSET_TYPE_COUNT]{ + constexpr const char* ASSET_TYPE_NAMES[]{ "physpreset", "physcollmap", "xanim", "xmodelsurfs", "xmodel", "material", "pixelshader", "vertexshader", "vertexdecl", "techniqueset", "image", "sound", "soundcurve", "loadedsound", "clipmap_unused", @@ -19,10 +19,12 @@ namespace "xmodelalias", "rawfile", "stringtable", "leaderboard", "structureddatadef", "tracer", "vehicle", "addonmapents", }; + static_assert(std::extent_v == ASSET_TYPE_COUNT); - constexpr const char* SUB_ASSET_TYPE_NAMES[SUB_ASSET_TYPE_COUNT]{ + constexpr const char* SUB_ASSET_TYPE_NAMES[]{ "technique", }; + static_assert(std::extent_v == SUB_ASSET_TYPE_COUNT); } // namespace namespace IW4 diff --git a/src/Common/Game/IW5/GameIW5.cpp b/src/Common/Game/IW5/GameIW5.cpp index f7dafcea..2a02dbb1 100644 --- a/src/Common/Game/IW5/GameIW5.cpp +++ b/src/Common/Game/IW5/GameIW5.cpp @@ -8,7 +8,7 @@ using namespace IW5; namespace { - constexpr const char* ASSET_TYPE_NAMES[ASSET_TYPE_COUNT]{ + constexpr const char* ASSET_TYPE_NAMES[]{ "physpreset", "physcollmap", "xanim", @@ -56,10 +56,12 @@ namespace "vehicle", "addonmapents", }; + static_assert(std::extent_v == ASSET_TYPE_COUNT); - constexpr const char* SUB_ASSET_TYPE_NAMES[SUB_ASSET_TYPE_COUNT]{ + constexpr const char* SUB_ASSET_TYPE_NAMES[]{ "technique", }; + static_assert(std::extent_v == SUB_ASSET_TYPE_COUNT); } // namespace namespace IW5 diff --git a/src/Common/Game/T5/GameT5.cpp b/src/Common/Game/T5/GameT5.cpp index d72c81bf..a385bac4 100644 --- a/src/Common/Game/T5/GameT5.cpp +++ b/src/Common/Game/T5/GameT5.cpp @@ -8,7 +8,7 @@ using namespace T5; namespace { - constexpr const char* ASSET_TYPE_NAMES[ASSET_TYPE_COUNT]{ + constexpr const char* ASSET_TYPE_NAMES[]{ "xmodelpieces", "physpreset", "physconstraints", "destructibledef", "xanim", "xmodel", "material", "techniqueset", "image", "soundbank", "soundpatch", "clipmap_unused", "clipmap", "comworld", "gameworldsp", "gameworldmp", "mapents", "gfxworld", "gfxlightdef", "uimap", "font", @@ -17,12 +17,14 @@ namespace "xmodelalias", "rawfile", "stringtable", "packindex", "xglobals", "ddl", "glasses", "emblemset", }; + static_assert(std::extent_v == ASSET_TYPE_COUNT); - constexpr const char* SUB_ASSET_TYPE_NAMES[SUB_ASSET_TYPE_COUNT]{ + constexpr const char* SUB_ASSET_TYPE_NAMES[]{ "technique", "vertexshader", "pixelshader", }; + static_assert(std::extent_v == SUB_ASSET_TYPE_COUNT); } // namespace namespace T5 diff --git a/src/Common/Game/T5/T5.h b/src/Common/Game/T5/T5.h index 89ebd8e7..1989889b 100644 --- a/src/Common/Game/T5/T5.h +++ b/src/Common/Game/T5/T5.h @@ -62,7 +62,7 @@ namespace T5 enum SubAssetType { - SUB_ASSET_TYPE_TECHNIQUE = ASSET_TYPE_COUNT, + SUB_ASSET_TYPE_TECHNIQUE, SUB_ASSET_TYPE_VERTEX_SHADER, SUB_ASSET_TYPE_PIXEL_SHADER, diff --git a/src/Common/Game/T6/GameT6.cpp b/src/Common/Game/T6/GameT6.cpp index 8ef710f9..cbb96687 100644 --- a/src/Common/Game/T6/GameT6.cpp +++ b/src/Common/Game/T6/GameT6.cpp @@ -8,7 +8,7 @@ using namespace T6; namespace { - constexpr const char* ASSET_TYPE_NAMES[ASSET_TYPE_COUNT]{ + constexpr const char* ASSET_TYPE_NAMES[]{ "xmodelpieces", "physpreset", "physconstraints", @@ -70,12 +70,14 @@ namespace "footstepfxtable", "zbarrier", }; + static_assert(std::extent_v == ASSET_TYPE_COUNT); - constexpr const char* SUB_ASSET_TYPE_NAMES[SUB_ASSET_TYPE_COUNT]{ + constexpr const char* SUB_ASSET_TYPE_NAMES[]{ "technique", "vertexshader", "pixelshader", }; + static_assert(std::extent_v == SUB_ASSET_TYPE_COUNT); } // namespace namespace T6