diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeapon.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeapon.cpp index b9491f58..4e60716c 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeapon.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeapon.cpp @@ -24,13 +24,13 @@ namespace T6 std::vector valueArray; if (!ParseAsArray(value, valueArray)) { - std::cout << "Failed to parse hide tags as array\n"; + std::cerr << "Failed to parse hide tags as array\n"; return false; } if (valueArray.size() > std::extent_v) { - std::cout << "Cannot have more than " << std::extent_v << " hide tags!\n"; + std::cerr << "Cannot have more than " << std::extent_v << " hide tags!\n"; return false; } @@ -83,13 +83,13 @@ namespace T6 std::vector> pairs; if (!ParseAsPairs(value, pairs)) { - std::cout << "Failed to parse notetracksoundmap as pairs\n"; + std::cerr << "Failed to parse notetracksoundmap as pairs\n"; return false; } if (pairs.size() > std::extent_v) { - std::cout << "Cannot have more than " << std::extent_v << " notetracksoundmap entries!\n"; + std::cerr << "Cannot have more than " << std::extent_v << " notetracksoundmap entries!\n"; return false; } @@ -139,7 +139,7 @@ namespace T6 if (camo == nullptr) { - std::cout << "Failed to load camo asset \"" << value << "\"" << std::endl; + std::cerr << "Failed to load camo asset \"" << value << "\"\n"; return false; } @@ -154,7 +154,7 @@ namespace T6 std::vector valueArray; if (!ParseAsArray(value, valueArray)) { - std::cout << "Failed to parse attachments as array" << std::endl; + std::cerr << "Failed to parse attachments as array\n"; return false; } @@ -165,7 +165,7 @@ namespace T6 auto* attachmentAssetInfo = m_loading_manager->LoadDependency(ASSET_TYPE_ATTACHMENT, attachmentName); if (attachmentAssetInfo == nullptr) { - std::cout << "Failed to load attachment asset \"" << attachmentName << "\"" << std::endl; + std::cerr << "Failed to load attachment asset \"" << attachmentName << "\"\n"; return false; } @@ -173,15 +173,14 @@ namespace T6 if (static_cast(attachmentAsset->attachmentType) >= ATTACHMENT_TYPE_COUNT) { - std::cout << "Invalid attachment type " << attachmentAsset->attachmentType << " for attachment asset \"" << attachmentName << "\"" - << std::endl; + std::cerr << "Invalid attachment type " << attachmentAsset->attachmentType << " for attachment asset \"" << attachmentName << "\"\n"; return false; } if (attachments[attachmentAsset->attachmentType] != nullptr) { - std::cout << "Already loaded attachment with same type " << attachmentAsset->attachmentType << ": \"" - << attachments[attachmentAsset->attachmentType]->szInternalName << "\", \"" << attachmentName << "\"" << std::endl; + std::cerr << "Already loaded attachment with same type " << attachmentAsset->attachmentType << ": \"" + << attachments[attachmentAsset->attachmentType]->szInternalName << "\", \"" << attachmentName << "\"\n"; return false; } @@ -203,7 +202,7 @@ namespace T6 std::vector valueArray; if (!ParseAsArray(value, valueArray)) { - std::cout << "Failed to parse attachment uniques as array" << std::endl; + std::cerr << "Failed to parse attachment uniques as array\n"; return false; } @@ -215,7 +214,7 @@ namespace T6 auto* attachmentUniqueAssetInfo = m_loading_manager->LoadDependency(ASSET_TYPE_ATTACHMENT_UNIQUE, attachmentUniqueName); if (attachmentUniqueAssetInfo == nullptr) { - std::cout << "Failed to load attachment unique asset \"" << attachmentUniqueName << "\"" << std::endl; + std::cerr << "Failed to load attachment unique asset \"" << attachmentUniqueName << "\"\n"; return false; } @@ -225,7 +224,7 @@ namespace T6 { if (attachmentCombinationIndex >= std::extent_v) { - std::cout << "Cannot have more than " + std::cerr << "Cannot have more than " << (std::extent_v - std::extent_v) << " combined attachment attachment unique entries!\n"; return false; @@ -238,14 +237,14 @@ namespace T6 { if (static_cast(attachmentUniqueAsset->attachmentType) >= ATTACHMENT_TYPE_COUNT) { - std::cout << "Invalid attachment type " << attachmentUniqueAsset->attachmentType << " for attachment unique asset \"" + std::cerr << "Invalid attachment type " << attachmentUniqueAsset->attachmentType << " for attachment unique asset \"" << attachmentUniqueName << "\"\n"; return false; } if (attachmentUniques[attachmentUniqueAsset->attachmentType] != nullptr) { - std::cout << "Already loaded attachment unique with same type " << attachmentUniqueAsset->attachmentType << ": \"" + std::cerr << "Already loaded attachment unique with same type " << attachmentUniqueAsset->attachmentType << ": \"" << attachmentUniques[attachmentUniqueAsset->attachmentType]->szInternalName << "\", \"" << attachmentUniqueName << "\"\n"; return false; } @@ -534,7 +533,7 @@ void AssetLoaderWeapon::CalculateAttachmentFields(const WeaponFullDef* weapon, u } } -void AssetLoaderWeapon::CalculateAttachmentFields(WeaponFullDef* weapon) +void AssetLoaderWeapon::CalculateAttachmentFields(const WeaponFullDef* weapon) { for (auto attachmentUniqueIndex = 0u; attachmentUniqueIndex < std::extent_v; attachmentUniqueIndex++) { @@ -556,7 +555,7 @@ bool AssetLoaderWeapon::LoadFromInfoString( infoString, weaponFullDef, zone->m_script_strings, memory, manager, weapon_fields, std::extent_v); if (!converter.Convert()) { - std::cout << "Failed to parse weapon: \"" << assetName << "\"" << std::endl; + std::cerr << "Failed to parse weapon: \"" << assetName << "\"\n"; return true; } @@ -594,14 +593,14 @@ bool AssetLoaderWeapon::CanLoadFromGdt() const bool AssetLoaderWeapon::LoadFromGdt( const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { - auto* gdtEntry = gdtQueryable->GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_WEAPON, assetName); + const auto* gdtEntry = gdtQueryable->GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_WEAPON, assetName); if (gdtEntry == nullptr) return false; InfoString infoString; if (!infoString.FromGdtProperties(*gdtEntry)) { - std::cout << "Failed to read weapon gdt entry: \"" << assetName << "\"" << std::endl; + std::cerr << "Failed to read weapon gdt entry: \"" << assetName << "\"\n"; return true; } @@ -624,7 +623,7 @@ bool AssetLoaderWeapon::LoadFromRaw( InfoString infoString; if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_WEAPON, *file.m_stream)) { - std::cout << "Failed to read weapon raw file: \"" << fileName << "\"" << std::endl; + std::cerr << "Failed to read weapon raw file: \"" << fileName << "\"\n"; return true; } diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeapon.h b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeapon.h index 301258b5..1490092e 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeapon.h +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeapon.h @@ -22,7 +22,7 @@ namespace T6 static void CalculateWeaponFields(WeaponFullDef* weapon); static void CalculateAttachmentFields(const WeaponFullDef* weapon, unsigned attachmentIndex, WeaponAttachmentUnique* attachmentUnique); - static void CalculateAttachmentFields(WeaponFullDef* weapon); + static void CalculateAttachmentFields(const WeaponFullDef* weapon); static bool LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone); diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeaponAttachment.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeaponAttachment.cpp index b1542711..6796cd3d 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeaponAttachment.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeaponAttachment.cpp @@ -48,7 +48,7 @@ namespace T6 ATTACHMENT_POINT_TOP, // vzoom }; - static_assert(std::extent::value == ATTACHMENT_TYPE_COUNT); + static_assert(std::extent_v == ATTACHMENT_TYPE_COUNT); class InfoStringToWeaponAttachmentConverter final : public InfoStringToStructConverter { @@ -58,13 +58,13 @@ namespace T6 switch (static_cast(field.iFieldType)) { case AFT_ATTACHMENTTYPE: - return ConvertEnumInt(value, field.iOffset, szAttachmentTypeNames, std::extent::value); + return ConvertEnumInt(value, field.iOffset, szAttachmentTypeNames, std::extent_v); case AFT_PENETRATE_TYPE: - return ConvertEnumInt(value, field.iOffset, penetrateTypeNames, std::extent::value); + return ConvertEnumInt(value, field.iOffset, penetrateTypeNames, std::extent_v); case AFT_FIRETYPE: - return ConvertEnumInt(value, field.iOffset, szWeapFireTypeNames, std::extent::value); + return ConvertEnumInt(value, field.iOffset, szWeapFireTypeNames, std::extent_v); default: assert(false); @@ -102,10 +102,10 @@ bool AssetLoaderWeaponAttachment::LoadFromInfoString( memset(attachment, 0, sizeof(WeaponAttachment)); InfoStringToWeaponAttachmentConverter converter( - infoString, attachment, zone->m_script_strings, memory, manager, attachment_fields, std::extent::value); + infoString, attachment, zone->m_script_strings, memory, manager, attachment_fields, std::extent_v); if (!converter.Convert()) { - std::cout << "Failed to parse attachment: \"" << assetName << "\"" << std::endl; + std::cerr << "Failed to parse attachment: \"" << assetName << "\"\n"; return true; } @@ -134,14 +134,14 @@ bool AssetLoaderWeaponAttachment::CanLoadFromGdt() const bool AssetLoaderWeaponAttachment::LoadFromGdt( const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { - auto* gdtEntry = gdtQueryable->GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_WEAPON_ATTACHMENT, assetName); + const auto* gdtEntry = gdtQueryable->GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_WEAPON_ATTACHMENT, assetName); if (gdtEntry == nullptr) return false; InfoString infoString; if (!infoString.FromGdtProperties(*gdtEntry)) { - std::cout << "Failed to read attachment gdt entry: \"" << assetName << "\"" << std::endl; + std::cerr << "Failed to read attachment gdt entry: \"" << assetName << "\"\n"; return true; } @@ -164,7 +164,7 @@ bool AssetLoaderWeaponAttachment::LoadFromRaw( InfoString infoString; if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_WEAPON_ATTACHMENT, *file.m_stream)) { - std::cout << "Failed to read attachment raw file: \"" << fileName << "\"" << std::endl; + std::cerr << "Failed to read attachment raw file: \"" << fileName << "\"\n"; return true; } diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeaponAttachmentUnique.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeaponAttachmentUnique.cpp index 20a1e181..9f9e3a24 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeaponAttachmentUnique.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeaponAttachmentUnique.cpp @@ -23,13 +23,13 @@ namespace T6 std::vector valueArray; if (!ParseAsArray(value, valueArray)) { - std::cerr << "Failed to parse hide tags as array" << std::endl; + std::cerr << "Failed to parse hide tags as array\n"; return false; } if (valueArray.size() > std::extent_v) { - std::cerr << "Cannot have more than " << std::extent_v << " hide tags!" << std::endl; + std::cerr << "Cannot have more than " << std::extent_v << " hide tags!\n"; return false; }