From 4f0ee357407e832a86b40bb23349189f0e7f1778 Mon Sep 17 00:00:00 2001 From: Jan Date: Sun, 24 Mar 2024 19:45:55 +0100 Subject: [PATCH] refactor: use std::extent_v instead of std::extent --- .../AssetLoaders/AssetLoaderPhysPreset.cpp | 2 +- .../AssetLoaderPhysConstraints.cpp | 8 +- .../T6/AssetLoaders/AssetLoaderPhysPreset.cpp | 2 +- .../T6/AssetLoaders/AssetLoaderTracer.cpp | 5 +- .../T6/AssetLoaders/AssetLoaderVehicle.cpp | 8 +- .../T6/AssetLoaders/AssetLoaderWeapon.cpp | 2 +- .../T6/AssetLoaders/AssetLoaderZBarrier.cpp | 6 +- src/ObjLoading/Image/IwiLoader.cpp | 8 +- .../AssetDumpers/AssetDumperPhysPreset.cpp | 2 +- .../IW4/AssetDumpers/AssetDumperTracer.cpp | 2 +- .../IW4/AssetDumpers/AssetDumperVehicle.cpp | 8 +- .../IW4/AssetDumpers/AssetDumperWeapon.cpp | 88 +++++++++---------- .../AssetDumperPhysConstraints.cpp | 4 +- .../T6/AssetDumpers/AssetDumperPhysPreset.cpp | 2 +- .../T6/AssetDumpers/AssetDumperTracer.cpp | 4 +- .../T6/AssetDumpers/AssetDumperVehicle.cpp | 8 +- .../T6/AssetDumpers/AssetDumperWeapon.cpp | 22 ++--- .../AssetDumperWeaponAttachment.cpp | 8 +- .../AssetDumperWeaponAttachmentUnique.cpp | 12 +-- .../T6/AssetDumpers/AssetDumperZBarrier.cpp | 2 +- src/ObjWriting/Image/IwiWriter27.cpp | 2 +- src/ObjWriting/Image/IwiWriter6.cpp | 2 +- src/ObjWriting/Image/IwiWriter8.cpp | 2 +- .../Domain/Definition/BaseTypeDefinition.cpp | 2 +- .../Matcher/CommandsCommonMatchers.cpp | 2 +- .../Header/Matcher/HeaderCommonMatchers.cpp | 2 +- .../Game/IW4/ZoneLoaderFactoryIW4.cpp | 4 +- .../Game/IW5/ZoneLoaderFactoryIW5.cpp | 4 +- .../ObjCommonTests/Image/ImageFormatTests.cpp | 4 +- 29 files changed, 112 insertions(+), 115 deletions(-) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPhysPreset.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPhysPreset.cpp index c934afcb..39ebee10 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPhysPreset.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPhysPreset.cpp @@ -63,7 +63,7 @@ bool AssetLoaderPhysPreset::LoadFromInfoString( const auto presetInfo = std::make_unique(); memset(presetInfo.get(), 0, sizeof(PhysPresetInfo)); InfoStringToPhysPresetConverter converter( - infoString, presetInfo.get(), zone->m_script_strings, memory, manager, phys_preset_fields, std::extent::value); + infoString, presetInfo.get(), zone->m_script_strings, memory, manager, phys_preset_fields, std::extent_v); if (!converter.Convert()) { std::cout << "Failed to parse phys preset: \"" << assetName << "\"" << std::endl; diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderPhysConstraints.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderPhysConstraints.cpp index 603d914f..e82e0e4f 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderPhysConstraints.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderPhysConstraints.cpp @@ -23,7 +23,7 @@ namespace T6 switch (static_cast(field.iFieldType)) { case CFT_TYPE: - return ConvertEnumInt(value, field.iOffset, s_constraintTypeNames, std::extent::value); + return ConvertEnumInt(value, field.iOffset, s_constraintTypeNames, std::extent_v); default: assert(false); @@ -61,7 +61,7 @@ void AssetLoaderPhysConstraints::CalculatePhysConstraintsFields(PhysConstraints* // count { auto foundEnd = false; - for (auto i = 0u; i < std::extent::value; i++) + for (auto i = 0u; i < std::extent_v; i++) { if (physConstraints->data[i].type == CONSTRAINT_NONE) { @@ -72,7 +72,7 @@ void AssetLoaderPhysConstraints::CalculatePhysConstraintsFields(PhysConstraints* } if (!foundEnd) - physConstraints->count = std::extent::value; + physConstraints->count = std::extent_v; } } @@ -83,7 +83,7 @@ bool AssetLoaderPhysConstraints::LoadFromInfoString( memset(physConstraints, 0, sizeof(PhysConstraints)); InfoStringToPhysConstraintsConverter converter( - infoString, physConstraints, zone->m_script_strings, memory, manager, phys_constraints_fields, std::extent::value); + infoString, physConstraints, zone->m_script_strings, memory, manager, phys_constraints_fields, std::extent_v); if (!converter.Convert()) { std::cout << "Failed to parse phys constraints: \"" << assetName << "\"" << std::endl; diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderPhysPreset.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderPhysPreset.cpp index 1b0100fb..2cc60c53 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderPhysPreset.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderPhysPreset.cpp @@ -66,7 +66,7 @@ bool AssetLoaderPhysPreset::LoadFromInfoString( const auto presetInfo = std::make_unique(); memset(presetInfo.get(), 0, sizeof(PhysPresetInfo)); InfoStringToPhysPresetConverter converter( - infoString, presetInfo.get(), zone->m_script_strings, memory, manager, phys_preset_fields, std::extent::value); + infoString, presetInfo.get(), zone->m_script_strings, memory, manager, phys_preset_fields, std::extent_v); if (!converter.Convert()) { std::cout << "Failed to parse phys preset: \"" << assetName << "\"" << std::endl; diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderTracer.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderTracer.cpp index 99d7e820..770f29d7 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderTracer.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderTracer.cpp @@ -23,7 +23,7 @@ namespace T6 switch (static_cast(field.iFieldType)) { case TFT_TRACERTYPE: - return ConvertEnumInt(value, field.iOffset, tracerTypeNames, std::extent::value); + return ConvertEnumInt(value, field.iOffset, tracerTypeNames, std::extent_v); case TFT_NUM_FIELD_TYPES: default: @@ -52,8 +52,7 @@ bool AssetLoaderTracer::LoadFromInfoString( auto* tracer = memory->Create(); memset(tracer, 0, sizeof(TracerDef)); - InfoStringToTracerConverter converter( - infoString, tracer, zone->m_script_strings, memory, manager, tracer_fields, std::extent::value); + InfoStringToTracerConverter converter(infoString, tracer, zone->m_script_strings, memory, manager, tracer_fields, std::extent_v); if (!converter.Convert()) { std::cout << "Failed to parse tracer: \"" << assetName << "\"" << std::endl; diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderVehicle.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderVehicle.cpp index bd51f0a7..97d843f9 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderVehicle.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderVehicle.cpp @@ -23,13 +23,13 @@ namespace T6 switch (static_cast(field.iFieldType)) { case VFT_TYPE: - return ConvertEnumInt(value, field.iOffset, s_vehicleClassNames, std::extent::value); + return ConvertEnumInt(value, field.iOffset, s_vehicleClassNames, std::extent_v); case VFT_CAMERAMODE: - return ConvertEnumInt(value, field.iOffset, s_vehicleCameraModes, std::extent::value); + return ConvertEnumInt(value, field.iOffset, s_vehicleCameraModes, std::extent_v); case VFT_TRACTION_TYPE: - return ConvertEnumInt(value, field.iOffset, s_tractionTypeNames, std::extent::value); + return ConvertEnumInt(value, field.iOffset, s_tractionTypeNames, std::extent_v); case VFT_MPH_TO_INCHES_PER_SECOND: { @@ -115,7 +115,7 @@ bool AssetLoaderVehicle::LoadFromInfoString( memset(vehicleDef, 0, sizeof(VehicleDef)); InfoStringToVehicleConverter converter( - infoString, vehicleDef, zone->m_script_strings, memory, manager, vehicle_fields, std::extent::value); + infoString, vehicleDef, zone->m_script_strings, memory, manager, vehicle_fields, std::extent_v); if (!converter.Convert()) { std::cout << "Failed to parse vehicle: \"" << assetName << "\"" << std::endl; diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeapon.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeapon.cpp index c00c7d16..b52e375f 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeapon.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeapon.cpp @@ -68,7 +68,7 @@ namespace T6 return true; } - assert(std::extent::value == SURF_TYPE_NUM); + assert(std::extent_v == SURF_TYPE_NUM); *bounceSound = static_cast(m_memory->Alloc(sizeof(const char*) * SURF_TYPE_NUM)); for (auto i = 0u; i < SURF_TYPE_NUM; i++) { diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderZBarrier.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderZBarrier.cpp index b445e186..f74b877a 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderZBarrier.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderZBarrier.cpp @@ -42,7 +42,7 @@ void AssetLoaderZBarrier::CalculateZBarrierFields(ZBarrierDef* zbarrier) // numBoardsInBarrier { auto foundEnd = false; - for (auto i = 0u; i < std::extent::value; i++) + for (auto i = 0u; i < std::extent_v; i++) { if (zbarrier->boards[i].pBoardModel == nullptr) { @@ -53,7 +53,7 @@ void AssetLoaderZBarrier::CalculateZBarrierFields(ZBarrierDef* zbarrier) } if (!foundEnd) - zbarrier->numBoardsInBarrier = std::extent::value; + zbarrier->numBoardsInBarrier = std::extent_v; } } @@ -64,7 +64,7 @@ bool AssetLoaderZBarrier::LoadFromInfoString( memset(zbarrier, 0, sizeof(ZBarrierDef)); InfoStringToZBarrierConverter converter( - infoString, zbarrier, zone->m_script_strings, memory, manager, zbarrier_fields, std::extent::value); + infoString, zbarrier, zone->m_script_strings, memory, manager, zbarrier_fields, std::extent_v); if (!converter.Convert()) { std::cout << "Failed to parse zbarrier: \"" << assetName << "\"" << std::endl; diff --git a/src/ObjLoading/Image/IwiLoader.cpp b/src/ObjLoading/Image/IwiLoader.cpp index dd707cd8..18598fce 100644 --- a/src/ObjLoading/Image/IwiLoader.cpp +++ b/src/ObjLoading/Image/IwiLoader.cpp @@ -88,7 +88,7 @@ Texture* IwiLoader::LoadIwi6(std::istream& stream) const const auto sizeOfMipLevel = texture->GetSizeOfMipLevel(currentMipLevel) * texture->GetFaceCount(); currentFileSize += sizeOfMipLevel; - if (currentMipLevel < static_cast(std::extent::value) + if (currentMipLevel < static_cast(std::extent_v) && currentFileSize != header.fileSizeForPicmip[currentMipLevel]) { printf("Iwi has invalid file size for picmip %i\n", currentMipLevel); @@ -206,7 +206,7 @@ Texture* IwiLoader::LoadIwi8(std::istream& stream) const const auto sizeOfMipLevel = texture->GetSizeOfMipLevel(currentMipLevel) * texture->GetFaceCount(); currentFileSize += sizeOfMipLevel; - if (currentMipLevel < static_cast(std::extent::value) + if (currentMipLevel < static_cast(std::extent_v) && currentFileSize != header.fileSizeForPicmip[currentMipLevel]) { printf("Iwi has invalid file size for picmip %i\n", currentMipLevel); @@ -311,7 +311,7 @@ Texture* IwiLoader::LoadIwi13(std::istream& stream) const const auto sizeOfMipLevel = texture->GetSizeOfMipLevel(currentMipLevel) * texture->GetFaceCount(); currentFileSize += sizeOfMipLevel; - if (currentMipLevel < static_cast(std::extent::value) + if (currentMipLevel < static_cast(std::extent_v) && currentFileSize != header.fileSizeForPicmip[currentMipLevel]) { printf("Iwi has invalid file size for picmip %i\n", currentMipLevel); @@ -418,7 +418,7 @@ Texture* IwiLoader::LoadIwi27(std::istream& stream) const const auto sizeOfMipLevel = texture->GetSizeOfMipLevel(currentMipLevel) * texture->GetFaceCount(); currentFileSize += sizeOfMipLevel; - if (currentMipLevel < static_cast(std::extent::value) + if (currentMipLevel < static_cast(std::extent_v) && currentFileSize != header.fileSizeForPicmip[currentMipLevel]) { printf("Iwi has invalid file size for picmip %i\n", currentMipLevel); diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPhysPreset.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPhysPreset.cpp index 19b2adbb..05fe779d 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPhysPreset.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPhysPreset.cpp @@ -64,7 +64,7 @@ InfoString AssetDumperPhysPreset::CreateInfoString(XAssetInfo* asset InfoStringFromPhysPresetConverter converter(physPresetInfo, phys_preset_fields, - std::extent::value, + std::extent_v, [asset](const scr_string_t scrStr) -> std::string { assert(scrStr < asset->m_zone->m_script_strings.Count()); diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperTracer.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperTracer.cpp index 2475d98a..57592ec2 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperTracer.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperTracer.cpp @@ -36,7 +36,7 @@ InfoString AssetDumperTracer::CreateInfoString(XAssetInfo* asset) { InfoStringFromTracerConverter converter(asset->Asset(), tracer_fields, - std::extent::value, + std::extent_v, [asset](const scr_string_t scrStr) -> std::string { assert(scrStr < asset->m_zone->m_script_strings.Count()); diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperVehicle.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperVehicle.cpp index d5614628..d70224c4 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperVehicle.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperVehicle.cpp @@ -22,13 +22,13 @@ namespace IW4 switch (static_cast(field.iFieldType)) { case VFT_TYPE: - FillFromEnumInt(std::string(field.szName), field.iOffset, s_vehicleClassNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, s_vehicleClassNames, std::extent_v); break; case VFT_AXLE_STEERING: case VFT_AXLE_POWER: case VFT_AXLE_BRAKING: - FillFromEnumInt(std::string(field.szName), field.iOffset, s_vehicleAxleTypeNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, s_vehicleAxleTypeNames, std::extent_v); break; case VFT_TROPHY_TAGS: @@ -37,7 +37,7 @@ namespace IW4 std::stringstream ss; bool first = true; - for (auto i = 0u; i < std::extent::value; i++) + for (auto i = 0u; i < std::extent_v; i++) { const auto& str = m_get_scr_string(trophyTags[i]); if (!str.empty()) @@ -77,7 +77,7 @@ InfoString AssetDumperVehicle::CreateInfoString(XAssetInfo* asset) { InfoStringFromVehicleConverter converter(asset->Asset(), vehicle_fields, - std::extent::value, + std::extent_v, [asset](const scr_string_t scrStr) -> std::string { assert(scrStr < asset->m_zone->m_script_strings.Count()); diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperWeapon.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperWeapon.cpp index 39b320f5..ae593144 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperWeapon.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperWeapon.cpp @@ -23,47 +23,47 @@ namespace IW4 switch (static_cast(field.iFieldType)) { case WFT_WEAPONTYPE: - FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapTypeNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapTypeNames, std::extent_v); break; case WFT_WEAPONCLASS: - FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapClassNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapClassNames, std::extent_v); break; case WFT_OVERLAYRETICLE: - FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapOverlayReticleNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapOverlayReticleNames, std::extent_v); break; case WFT_PENETRATE_TYPE: - FillFromEnumInt(std::string(field.szName), field.iOffset, penetrateTypeNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, penetrateTypeNames, std::extent_v); break; case WFT_IMPACT_TYPE: - FillFromEnumInt(std::string(field.szName), field.iOffset, impactTypeNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, impactTypeNames, std::extent_v); break; case WFT_STANCE: - FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapStanceNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapStanceNames, std::extent_v); break; case WFT_PROJ_EXPLOSION: - FillFromEnumInt(std::string(field.szName), field.iOffset, szProjectileExplosionNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, szProjectileExplosionNames, std::extent_v); break; case WFT_OFFHAND_CLASS: - FillFromEnumInt(std::string(field.szName), field.iOffset, offhandClassNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, offhandClassNames, std::extent_v); break; case WFT_ANIMTYPE: - FillFromEnumInt(std::string(field.szName), field.iOffset, playerAnimTypeNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, playerAnimTypeNames, std::extent_v); break; case WFT_ACTIVE_RETICLE_TYPE: - FillFromEnumInt(std::string(field.szName), field.iOffset, activeReticleNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, activeReticleNames, std::extent_v); break; case WFT_GUIDED_MISSILE_TYPE: - FillFromEnumInt(std::string(field.szName), field.iOffset, guidedMissileNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, guidedMissileNames, std::extent_v); break; case WFT_BOUNCE_SOUND: @@ -90,23 +90,23 @@ namespace IW4 } case WFT_STICKINESS: - FillFromEnumInt(std::string(field.szName), field.iOffset, stickinessNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, stickinessNames, std::extent_v); break; case WFT_OVERLAYINTERFACE: - FillFromEnumInt(std::string(field.szName), field.iOffset, overlayInterfaceNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, overlayInterfaceNames, std::extent_v); break; case WFT_INVENTORYTYPE: - FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapInventoryTypeNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapInventoryTypeNames, std::extent_v); break; case WFT_FIRETYPE: - FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapFireTypeNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapFireTypeNames, std::extent_v); break; case WFT_AMMOCOUNTER_CLIPTYPE: - FillFromEnumInt(std::string(field.szName), field.iOffset, ammoCounterClipNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, ammoCounterClipNames, std::extent_v); break; case WFT_ICONRATIO_HUD: @@ -114,7 +114,7 @@ namespace IW4 case WFT_ICONRATIO_AMMOCOUNTER: case WFT_ICONRATIO_KILL: case WFT_ICONRATIO_DPAD: - FillFromEnumInt(std::string(field.szName), field.iOffset, weapIconRatioNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, weapIconRatioNames, std::extent_v); break; case WFT_HIDETAGS: @@ -123,7 +123,7 @@ namespace IW4 std::stringstream ss; bool first = true; - for (auto i = 0u; i < std::extent::value; i++) + for (auto i = 0u; i < std::extent_v; i++) { const auto& str = m_get_scr_string(hideTags[i]); if (!str.empty()) @@ -144,11 +144,11 @@ namespace IW4 case WFT_NOTETRACKSOUNDMAP: { const auto* keys = reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset); - const auto* values = &keys[std::extent::value]; + const auto* values = &keys[std::extent_v]; std::stringstream ss; bool first = true; - for (auto i = 0u; i < std::extent::value; i++) + for (auto i = 0u; i < std::extent_v; i++) { const auto& key = m_get_scr_string(keys[i]); const auto& value = m_get_scr_string(values[i]); @@ -173,11 +173,11 @@ namespace IW4 case WFT_NOTETRACKRUMBLEMAP: { const auto* keys = reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset); - const auto* values = &keys[std::extent::value]; + const auto* values = &keys[std::extent_v]; std::stringstream ss; bool first = true; - for (auto i = 0u; i < std::extent::value; i++) + for (auto i = 0u; i < std::extent_v; i++) { const auto& key = m_get_scr_string(keys[i]); const auto& value = m_get_scr_string(values[i]); @@ -229,8 +229,8 @@ void AssetDumperWeapon::CopyToFullDef(const WeaponCompleteDef* weapon, WeaponFul if (weapon->hideTags) { - assert(sizeof(WeaponFullDef::hideTags) >= sizeof(scr_string_t) * std::extent::value); - memcpy(fullDef->hideTags, weapon->hideTags, sizeof(scr_string_t) * std::extent::value); + assert(sizeof(WeaponFullDef::hideTags) >= sizeof(scr_string_t) * std::extent_v); + memcpy(fullDef->hideTags, weapon->hideTags, sizeof(scr_string_t) * std::extent_v); fullDef->weapCompleteDef.hideTags = fullDef->hideTags; } @@ -243,8 +243,8 @@ void AssetDumperWeapon::CopyToFullDef(const WeaponCompleteDef* weapon, WeaponFul if (fullDef->weapDef.gunXModel) { - assert(sizeof(WeaponFullDef::gunXModel) >= sizeof(void*) * std::extent::value); - memcpy(fullDef->gunXModel, fullDef->weapDef.gunXModel, sizeof(void*) * std::extent::value); + assert(sizeof(WeaponFullDef::gunXModel) >= sizeof(void*) * std::extent_v); + memcpy(fullDef->gunXModel, fullDef->weapDef.gunXModel, sizeof(void*) * std::extent_v); fullDef->weapDef.gunXModel = fullDef->gunXModel; } @@ -264,69 +264,67 @@ void AssetDumperWeapon::CopyToFullDef(const WeaponCompleteDef* weapon, WeaponFul if (fullDef->weapDef.notetrackSoundMapKeys) { - assert(sizeof(WeaponFullDef::notetrackSoundMapKeys) >= sizeof(scr_string_t) * std::extent::value); + assert(sizeof(WeaponFullDef::notetrackSoundMapKeys) >= sizeof(scr_string_t) * std::extent_v); memcpy(fullDef->notetrackSoundMapKeys, fullDef->weapDef.notetrackSoundMapKeys, - sizeof(scr_string_t) * std::extent::value); + sizeof(scr_string_t) * std::extent_v); fullDef->weapDef.notetrackSoundMapKeys = fullDef->notetrackSoundMapKeys; } if (fullDef->weapDef.notetrackSoundMapValues) { - assert(sizeof(WeaponFullDef::notetrackSoundMapValues) >= sizeof(scr_string_t) * std::extent::value); + assert(sizeof(WeaponFullDef::notetrackSoundMapValues) >= sizeof(scr_string_t) * std::extent_v); memcpy(fullDef->notetrackSoundMapValues, fullDef->weapDef.notetrackSoundMapValues, - sizeof(scr_string_t) * std::extent::value); + sizeof(scr_string_t) * std::extent_v); fullDef->weapDef.notetrackSoundMapValues = fullDef->notetrackSoundMapValues; } if (fullDef->weapDef.notetrackRumbleMapKeys) { - assert(sizeof(WeaponFullDef::notetrackRumbleMapKeys) >= sizeof(scr_string_t) * std::extent::value); + assert(sizeof(WeaponFullDef::notetrackRumbleMapKeys) >= sizeof(scr_string_t) * std::extent_v); memcpy(fullDef->notetrackRumbleMapKeys, fullDef->weapDef.notetrackRumbleMapKeys, - sizeof(scr_string_t) * std::extent::value); + sizeof(scr_string_t) * std::extent_v); fullDef->weapDef.notetrackRumbleMapKeys = fullDef->notetrackRumbleMapKeys; } if (fullDef->weapDef.notetrackRumbleMapValues) { - assert(sizeof(WeaponFullDef::notetrackRumbleMapValues) >= sizeof(scr_string_t) * std::extent::value); + assert(sizeof(WeaponFullDef::notetrackRumbleMapValues) >= sizeof(scr_string_t) * std::extent_v); memcpy(fullDef->notetrackRumbleMapValues, fullDef->weapDef.notetrackRumbleMapValues, - sizeof(scr_string_t) * std::extent::value); + sizeof(scr_string_t) * std::extent_v); fullDef->weapDef.notetrackRumbleMapValues = fullDef->notetrackRumbleMapValues; } if (fullDef->weapDef.worldModel) { - assert(sizeof(WeaponFullDef::worldModel) >= sizeof(void*) * std::extent::value); - memcpy(fullDef->worldModel, fullDef->weapDef.worldModel, sizeof(void*) * std::extent::value); + assert(sizeof(WeaponFullDef::worldModel) >= sizeof(void*) * std::extent_v); + memcpy(fullDef->worldModel, fullDef->weapDef.worldModel, sizeof(void*) * std::extent_v); fullDef->weapDef.worldModel = fullDef->worldModel; } if (fullDef->weapDef.parallelBounce) { - assert(sizeof(WeaponFullDef::parallelBounce) >= sizeof(float) * std::extent::value); - memcpy(fullDef->parallelBounce, fullDef->weapDef.parallelBounce, sizeof(float) * std::extent::value); + assert(sizeof(WeaponFullDef::parallelBounce) >= sizeof(float) * std::extent_v); + memcpy(fullDef->parallelBounce, fullDef->weapDef.parallelBounce, sizeof(float) * std::extent_v); fullDef->weapDef.parallelBounce = fullDef->parallelBounce; } if (fullDef->weapDef.perpendicularBounce) { - assert(sizeof(WeaponFullDef::perpendicularBounce) >= sizeof(float) * std::extent::value); - memcpy(fullDef->perpendicularBounce, - fullDef->weapDef.perpendicularBounce, - sizeof(float) * std::extent::value); + assert(sizeof(WeaponFullDef::perpendicularBounce) >= sizeof(float) * std::extent_v); + memcpy(fullDef->perpendicularBounce, fullDef->weapDef.perpendicularBounce, sizeof(float) * std::extent_v); fullDef->weapDef.perpendicularBounce = fullDef->perpendicularBounce; } if (fullDef->weapDef.locationDamageMultipliers) { - assert(sizeof(WeaponFullDef::locationDamageMultipliers) >= sizeof(float) * std::extent::value); + assert(sizeof(WeaponFullDef::locationDamageMultipliers) >= sizeof(float) * std::extent_v); memcpy(fullDef->locationDamageMultipliers, fullDef->weapDef.locationDamageMultipliers, - sizeof(float) * std::extent::value); + sizeof(float) * std::extent_v); fullDef->weapDef.locationDamageMultipliers = fullDef->locationDamageMultipliers; } } @@ -339,7 +337,7 @@ InfoString AssetDumperWeapon::CreateInfoString(XAssetInfo* as InfoStringFromWeaponConverter converter(fullDef.get(), weapon_fields, - std::extent::value, + std::extent_v, [asset](const scr_string_t scrStr) -> std::string { assert(scrStr < asset->m_zone->m_script_strings.Count()); diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperPhysConstraints.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperPhysConstraints.cpp index 95b17144..f4294adf 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperPhysConstraints.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperPhysConstraints.cpp @@ -20,7 +20,7 @@ namespace T6 switch (static_cast(field.iFieldType)) { case CFT_TYPE: - FillFromEnumInt(std::string(field.szName), field.iOffset, s_constraintTypeNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, s_constraintTypeNames, std::extent_v); break; default: @@ -46,7 +46,7 @@ InfoString AssetDumperPhysConstraints::CreateInfoString(XAssetInfoAsset(), phys_constraints_fields, - std::extent::value, + std::extent_v, [asset](const scr_string_t scrStr) -> std::string { assert(scrStr < asset->m_zone->m_script_strings.Count()); diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperPhysPreset.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperPhysPreset.cpp index 89558d33..e801928d 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperPhysPreset.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperPhysPreset.cpp @@ -66,7 +66,7 @@ InfoString AssetDumperPhysPreset::CreateInfoString(XAssetInfo* asset InfoStringFromPhysPresetConverter converter(physPresetInfo, phys_preset_fields, - std::extent::value, + std::extent_v, [asset](const scr_string_t scrStr) -> std::string { assert(scrStr < asset->m_zone->m_script_strings.Count()); diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperTracer.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperTracer.cpp index b9e7224c..1ecefb98 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperTracer.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperTracer.cpp @@ -20,7 +20,7 @@ namespace T6 switch (static_cast(field.iFieldType)) { case TFT_TRACERTYPE: - FillFromEnumInt(std::string(field.szName), field.iOffset, tracerTypeNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, tracerTypeNames, std::extent_v); break; case TFT_NUM_FIELD_TYPES: @@ -45,7 +45,7 @@ InfoString AssetDumperTracer::CreateInfoString(XAssetInfo* asset) { InfoStringFromTracerConverter converter(asset->Asset(), tracer_fields, - std::extent::value, + std::extent_v, [asset](const scr_string_t scrStr) -> std::string { assert(scrStr < asset->m_zone->m_script_strings.Count()); diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperVehicle.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperVehicle.cpp index ac7873fc..2da65383 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperVehicle.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperVehicle.cpp @@ -20,15 +20,15 @@ namespace T6 switch (static_cast(field.iFieldType)) { case VFT_TYPE: - FillFromEnumInt(std::string(field.szName), field.iOffset, s_vehicleClassNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, s_vehicleClassNames, std::extent_v); break; case VFT_CAMERAMODE: - FillFromEnumInt(std::string(field.szName), field.iOffset, s_vehicleCameraModes, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, s_vehicleCameraModes, std::extent_v); break; case VFT_TRACTION_TYPE: - FillFromEnumInt(std::string(field.szName), field.iOffset, s_tractionTypeNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, s_tractionTypeNames, std::extent_v); break; case VFT_MPH_TO_INCHES_PER_SECOND: @@ -95,7 +95,7 @@ InfoString AssetDumperVehicle::CreateInfoString(XAssetInfo* asset) { InfoStringFromVehicleConverter converter(asset->Asset(), vehicle_fields, - std::extent::value, + std::extent_v, [asset](const scr_string_t scrStr) -> std::string { assert(scrStr < asset->m_zone->m_script_strings.Count()); diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeapon.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeapon.cpp index 40803c60..d067b584 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeapon.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeapon.cpp @@ -277,21 +277,21 @@ void AssetDumperWeapon::CopyToFullDef(const WeaponVariantDef* weapon, WeaponFull if (weapon->attachments) { - assert(sizeof(WeaponFullDef::attachments) >= sizeof(void*) * std::extent::value); + assert(sizeof(WeaponFullDef::attachments) >= sizeof(void*) * std::extent_v); memcpy(fullDef->attachments, weapon->attachments, sizeof(void*) * std::extent_v); fullDef->weapVariantDef.attachments = fullDef->attachments; } if (weapon->attachmentUniques) { - assert(sizeof(WeaponFullDef::attachmentUniques) >= sizeof(void*) * std::extent::value); + assert(sizeof(WeaponFullDef::attachmentUniques) >= sizeof(void*) * std::extent_v); memcpy(fullDef->attachmentUniques, weapon->attachmentUniques, sizeof(void*) * std::extent_v); fullDef->weapVariantDef.attachmentUniques = fullDef->attachmentUniques; } if (fullDef->weapDef.gunXModel) { - assert(sizeof(WeaponFullDef::gunXModel) >= sizeof(void*) * std::extent::value); + assert(sizeof(WeaponFullDef::gunXModel) >= sizeof(void*) * std::extent_v); memcpy(fullDef->gunXModel, fullDef->weapDef.gunXModel, sizeof(void*) * std::extent_v); fullDef->weapDef.gunXModel = fullDef->gunXModel; } @@ -305,14 +305,14 @@ void AssetDumperWeapon::CopyToFullDef(const WeaponVariantDef* weapon, WeaponFull if (weapon->hideTags) { - assert(sizeof(WeaponFullDef::hideTags) >= sizeof(scr_string_t) * std::extent::value); + assert(sizeof(WeaponFullDef::hideTags) >= sizeof(scr_string_t) * std::extent_v); memcpy(fullDef->hideTags, weapon->hideTags, sizeof(scr_string_t) * std::extent_v); fullDef->weapVariantDef.hideTags = fullDef->hideTags; } if (fullDef->weapDef.notetrackSoundMapKeys) { - assert(sizeof(WeaponFullDef::notetrackSoundMapKeys) >= sizeof(scr_string_t) * std::extent::value); + assert(sizeof(WeaponFullDef::notetrackSoundMapKeys) >= sizeof(scr_string_t) * std::extent_v); memcpy(fullDef->notetrackSoundMapKeys, fullDef->weapDef.notetrackSoundMapKeys, sizeof(scr_string_t) * std::extent_v); @@ -321,7 +321,7 @@ void AssetDumperWeapon::CopyToFullDef(const WeaponVariantDef* weapon, WeaponFull if (fullDef->weapDef.notetrackSoundMapValues) { - assert(sizeof(WeaponFullDef::notetrackSoundMapValues) >= sizeof(scr_string_t) * std::extent::value); + assert(sizeof(WeaponFullDef::notetrackSoundMapValues) >= sizeof(scr_string_t) * std::extent_v); memcpy(fullDef->notetrackSoundMapValues, fullDef->weapDef.notetrackSoundMapValues, sizeof(scr_string_t) * std::extent_v); @@ -330,35 +330,35 @@ void AssetDumperWeapon::CopyToFullDef(const WeaponVariantDef* weapon, WeaponFull if (fullDef->weapDef.worldModel) { - assert(sizeof(WeaponFullDef::worldModel) >= sizeof(void*) * std::extent::value); + assert(sizeof(WeaponFullDef::worldModel) >= sizeof(void*) * std::extent_v); memcpy(fullDef->worldModel, fullDef->weapDef.worldModel, sizeof(void*) * std::extent_v); fullDef->weapDef.worldModel = fullDef->worldModel; } if (weapon->attachViewModel) { - assert(sizeof(WeaponFullDef::attachViewModel) >= sizeof(void*) * std::extent::value); + assert(sizeof(WeaponFullDef::attachViewModel) >= sizeof(void*) * std::extent_v); memcpy(fullDef->attachViewModel, weapon->attachViewModel, sizeof(void*) * std::extent_v); fullDef->weapVariantDef.attachViewModel = fullDef->attachViewModel; } if (weapon->attachWorldModel) { - assert(sizeof(WeaponFullDef::attachWorldModel) >= sizeof(void*) * std::extent::value); + assert(sizeof(WeaponFullDef::attachWorldModel) >= sizeof(void*) * std::extent_v); memcpy(fullDef->attachWorldModel, weapon->attachWorldModel, sizeof(void*) * std::extent_v); fullDef->weapVariantDef.attachWorldModel = fullDef->attachWorldModel; } if (weapon->attachViewModelTag) { - assert(sizeof(WeaponFullDef::attachViewModelTag) >= sizeof(void*) * std::extent::value); + assert(sizeof(WeaponFullDef::attachViewModelTag) >= sizeof(void*) * std::extent_v); memcpy(fullDef->attachViewModelTag, weapon->attachViewModelTag, sizeof(void*) * std::extent_v); fullDef->weapVariantDef.attachViewModelTag = fullDef->attachViewModelTag; } if (weapon->attachWorldModelTag) { - assert(sizeof(WeaponFullDef::attachWorldModelTag) >= sizeof(void*) * std::extent::value); + assert(sizeof(WeaponFullDef::attachWorldModelTag) >= sizeof(void*) * std::extent_v); memcpy(fullDef->attachWorldModelTag, weapon->attachWorldModelTag, sizeof(void*) * std::extent_v); fullDef->weapVariantDef.attachWorldModelTag = fullDef->attachWorldModelTag; } diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeaponAttachment.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeaponAttachment.cpp index 572c5c91..eafec094 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeaponAttachment.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeaponAttachment.cpp @@ -20,15 +20,15 @@ namespace T6 switch (static_cast(field.iFieldType)) { case AFT_ATTACHMENTTYPE: - FillFromEnumInt(std::string(field.szName), field.iOffset, szAttachmentTypeNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, szAttachmentTypeNames, std::extent_v); break; case AFT_PENETRATE_TYPE: - FillFromEnumInt(std::string(field.szName), field.iOffset, penetrateTypeNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, penetrateTypeNames, std::extent_v); break; case AFT_FIRETYPE: - FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapFireTypeNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapFireTypeNames, std::extent_v); break; default: @@ -51,7 +51,7 @@ InfoString AssetDumperWeaponAttachment::CreateInfoString(XAssetInfoAsset(), attachment_fields, - std::extent::value, + std::extent_v, [asset](const scr_string_t scrStr) -> std::string { assert(scrStr < asset->m_zone->m_script_strings.Count()); diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeaponAttachmentUnique.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeaponAttachmentUnique.cpp index ba413957..33e34f50 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeaponAttachmentUnique.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeaponAttachmentUnique.cpp @@ -22,7 +22,7 @@ namespace T6 switch (static_cast(field.iFieldType)) { case AUFT_ATTACHMENTTYPE: - FillFromEnumInt(std::string(field.szName), field.iOffset, szAttachmentTypeNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, szAttachmentTypeNames, std::extent_v); break; case AUFT_HIDETAGS: @@ -31,7 +31,7 @@ namespace T6 std::stringstream ss; auto first = true; - for (auto i = 0u; i < std::extent::value; i++) + for (auto i = 0u; i < std::extent_v; i++) { const auto& str = m_get_scr_string(hideTags[i]); if (!str.empty()) @@ -50,7 +50,7 @@ namespace T6 } case AUFT_OVERLAYRETICLE: - FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapOverlayReticleNames, std::extent::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapOverlayReticleNames, std::extent_v); break; case AUFT_CAMO: @@ -94,8 +94,8 @@ void AssetDumperWeaponAttachmentUnique::CopyToFullDef(const WeaponAttachmentUniq if (attachment->hideTags) { - assert(sizeof(WeaponAttachmentUniqueFull::hideTags) >= sizeof(scr_string_t) * std::extent::value); - memcpy(fullDef->hideTags, attachment->hideTags, sizeof(scr_string_t) * std::extent::value); + assert(sizeof(WeaponAttachmentUniqueFull::hideTags) >= sizeof(scr_string_t) * std::extent_v); + memcpy(fullDef->hideTags, attachment->hideTags, sizeof(scr_string_t) * std::extent_v); fullDef->attachment.hideTags = fullDef->hideTags; } @@ -115,7 +115,7 @@ InfoString AssetDumperWeaponAttachmentUnique::CreateInfoString(XAssetInfo::value, + std::extent_v, [asset](const scr_string_t scrStr) -> std::string { assert(scrStr < asset->m_zone->m_script_strings.Count()); diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperZBarrier.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperZBarrier.cpp index 1efe9d60..1272de95 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperZBarrier.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperZBarrier.cpp @@ -34,7 +34,7 @@ InfoString AssetDumperZBarrier::CreateInfoString(XAssetInfo* asset) { InfoStringFromZBarrierConverter converter(asset->Asset(), zbarrier_fields, - std::extent::value, + std::extent_v, [asset](const scr_string_t scrStr) -> std::string { assert(scrStr < asset->m_zone->m_script_strings.Count()); diff --git a/src/ObjWriting/Image/IwiWriter27.cpp b/src/ObjWriting/Image/IwiWriter27.cpp index 929209bc..4641b4f6 100644 --- a/src/ObjWriting/Image/IwiWriter27.cpp +++ b/src/ObjWriting/Image/IwiWriter27.cpp @@ -112,7 +112,7 @@ void IwiWriter::DumpImage(std::ostream& stream, Texture* texture) const auto mipLevelSize = texture->GetSizeOfMipLevel(currentMipLevel) * texture->GetFaceCount(); currentFileSize += mipLevelSize; - if (currentMipLevel < static_cast(std::extent::value)) + if (currentMipLevel < static_cast(std::extent_v)) header.fileSizeForPicmip[currentMipLevel] = currentFileSize; } diff --git a/src/ObjWriting/Image/IwiWriter6.cpp b/src/ObjWriting/Image/IwiWriter6.cpp index 0e55243f..9709e45b 100644 --- a/src/ObjWriting/Image/IwiWriter6.cpp +++ b/src/ObjWriting/Image/IwiWriter6.cpp @@ -104,7 +104,7 @@ void IwiWriter::DumpImage(std::ostream& stream, Texture* texture) const auto mipLevelSize = texture->GetSizeOfMipLevel(currentMipLevel) * texture->GetFaceCount(); currentFileSize += mipLevelSize; - if (currentMipLevel < static_cast(std::extent::value)) + if (currentMipLevel < static_cast(std::extent_v)) header.fileSizeForPicmip[currentMipLevel] = currentFileSize; } diff --git a/src/ObjWriting/Image/IwiWriter8.cpp b/src/ObjWriting/Image/IwiWriter8.cpp index f3b89520..3806320e 100644 --- a/src/ObjWriting/Image/IwiWriter8.cpp +++ b/src/ObjWriting/Image/IwiWriter8.cpp @@ -104,7 +104,7 @@ void IwiWriter::DumpImage(std::ostream& stream, Texture* texture) const auto mipLevelSize = texture->GetSizeOfMipLevel(currentMipLevel) * texture->GetFaceCount(); currentFileSize += mipLevelSize; - if (currentMipLevel < static_cast(std::extent::value)) + if (currentMipLevel < static_cast(std::extent_v)) header.fileSizeForPicmip[currentMipLevel] = currentFileSize; } diff --git a/src/ZoneCodeGeneratorLib/Domain/Definition/BaseTypeDefinition.cpp b/src/ZoneCodeGeneratorLib/Domain/Definition/BaseTypeDefinition.cpp index 4293b803..8835fade 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Definition/BaseTypeDefinition.cpp +++ b/src/ZoneCodeGeneratorLib/Domain/Definition/BaseTypeDefinition.cpp @@ -44,4 +44,4 @@ const BaseTypeDefinition* const BaseTypeDefinition::UNSIGNED_LONG_LONG = new Bas const BaseTypeDefinition* const BaseTypeDefinition::VOID = new BaseTypeDefinition("void", 0); const BaseTypeDefinition* const BaseTypeDefinition::ALL_BASE_TYPES[]{ FLOAT, DOUBLE, BOOL, CHAR, UNSIGNED_CHAR, SHORT, UNSIGNED_SHORT, INT, UNSIGNED_INT, LONG, UNSIGNED_LONG, LONG_LONG, UNSIGNED_LONG_LONG, VOID}; -const size_t BaseTypeDefinition::ALL_BASE_TYPES_COUNT = std::extent::value; +const size_t BaseTypeDefinition::ALL_BASE_TYPES_COUNT = std::extent_v; diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsCommonMatchers.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsCommonMatchers.cpp index 032ff879..3bc815df 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsCommonMatchers.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsCommonMatchers.cpp @@ -19,7 +19,7 @@ std::unique_ptr CommandsCommonMatchers::Typen "int", "long", }; - static_assert(std::extent::value + static_assert(std::extent_v == static_cast(CommandsParserValueType::BUILT_IN_LAST) - static_cast(CommandsParserValueType::BUILT_IN_FIRST) + 1); const CommandsMatcherFactory create(labelSupplier); diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderCommonMatchers.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderCommonMatchers.cpp index 90969e85..be973830 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderCommonMatchers.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderCommonMatchers.cpp @@ -66,7 +66,7 @@ std::unique_ptr HeaderCommonMatchers::ArrayDef( std::unique_ptr HeaderCommonMatchers::Typename(const supplier_t* labelSupplier) { static constexpr const char* BUILT_IN_TYPE_NAMES[]{"unsigned", "char", "short", "int", "long"}; - static_assert(std::extent::value + static_assert(std::extent_v == static_cast(HeaderParserValueType::BUILT_IN_LAST) - static_cast(HeaderParserValueType::BUILT_IN_FIRST) + 1); const HeaderMatcherFactory create(labelSupplier); diff --git a/src/ZoneLoading/Game/IW4/ZoneLoaderFactoryIW4.cpp b/src/ZoneLoading/Game/IW4/ZoneLoaderFactoryIW4.cpp index 6e5e8856..b8421aef 100644 --- a/src/ZoneLoading/Game/IW4/ZoneLoaderFactoryIW4.cpp +++ b/src/ZoneLoading/Game/IW4/ZoneLoaderFactoryIW4.cpp @@ -147,7 +147,7 @@ class ZoneLoaderFactory::Impl zoneLoader->AddLoadingStep(std::make_unique(fileName, sizeof(DB_AuthSubHeader::fastfileName))); zoneLoader->AddLoadingStep(std::make_unique(4)); // Skip reserved - auto masterBlockHashes = std::make_unique(sizeof DB_AuthHash::bytes, std::extent::value); + auto masterBlockHashes = std::make_unique(sizeof DB_AuthHash::bytes, std::extent_v); auto* masterBlockHashesPtr = masterBlockHashes.get(); zoneLoader->AddLoadingStep(std::move(masterBlockHashes)); @@ -161,7 +161,7 @@ class ZoneLoaderFactory::Impl zoneLoader->AddLoadingStep( std::make_unique(std::make_unique(ZoneConstants::AUTHED_CHUNK_COUNT_PER_GROUP, ZoneConstants::AUTHED_CHUNK_SIZE, - std::extent::value, + std::extent_v, std::unique_ptr(Crypto::CreateSHA256()), masterBlockHashesPtr))); } diff --git a/src/ZoneLoading/Game/IW5/ZoneLoaderFactoryIW5.cpp b/src/ZoneLoading/Game/IW5/ZoneLoaderFactoryIW5.cpp index 462967fc..505ca3a0 100644 --- a/src/ZoneLoading/Game/IW5/ZoneLoaderFactoryIW5.cpp +++ b/src/ZoneLoading/Game/IW5/ZoneLoaderFactoryIW5.cpp @@ -131,7 +131,7 @@ class ZoneLoaderFactory::Impl zoneLoader->AddLoadingStep(std::make_unique(fileName, sizeof(DB_AuthSubHeader::fastfileName))); zoneLoader->AddLoadingStep(std::make_unique(4)); // Skip reserved - auto masterBlockHashes = std::make_unique(sizeof DB_AuthHash::bytes, std::extent::value); + auto masterBlockHashes = std::make_unique(sizeof DB_AuthHash::bytes, std::extent_v); auto* masterBlockHashesPtr = masterBlockHashes.get(); zoneLoader->AddLoadingStep(std::move(masterBlockHashes)); @@ -145,7 +145,7 @@ class ZoneLoaderFactory::Impl zoneLoader->AddLoadingStep( std::make_unique(std::make_unique(ZoneConstants::AUTHED_CHUNK_COUNT_PER_GROUP, ZoneConstants::AUTHED_CHUNK_SIZE, - std::extent::value, + std::extent_v, std::unique_ptr(Crypto::CreateSHA256()), masterBlockHashesPtr))); } diff --git a/test/ObjCommonTests/Image/ImageFormatTests.cpp b/test/ObjCommonTests/Image/ImageFormatTests.cpp index 3a7f58f5..bf7b34a6 100644 --- a/test/ObjCommonTests/Image/ImageFormatTests.cpp +++ b/test/ObjCommonTests/Image/ImageFormatTests.cpp @@ -8,9 +8,9 @@ namespace image::image_format { TEST_CASE("ImageFormat: EnsureAllFormatsArrayIndicesAreIds", "[image]") { - REQUIRE(static_cast(ImageFormatId::MAX) == std::extent::value); + REQUIRE(static_cast(ImageFormatId::MAX) == std::extent_v); - for (unsigned i = 0; i < std::extent::value; i++) + for (unsigned i = 0; i < std::extent_v; i++) { REQUIRE(ImageFormat::ALL_FORMATS[i] != nullptr); REQUIRE(i == static_cast(ImageFormat::ALL_FORMATS[i]->GetId()));