diff --git a/src/Common/object_loader.h b/src/Common/object_loader.h index c48022b89d3..351f962726d 100644 --- a/src/Common/object_loader.h +++ b/src/Common/object_loader.h @@ -18,7 +18,7 @@ struct CLoader template IC static void load_data(T& data, M& stream, const P& p) { - STATIC_CHECK(!std::is_polymorphic::value, Cannot_load_polymorphic_classes_as_binary_data); + static_assert(!std::is_polymorphic::value, "Cannot load polymorphic classes as binary data."); stream.r(&data, sizeof(T)); } diff --git a/src/Common/object_saver.h b/src/Common/object_saver.h index a0c68a38fd1..7e64f744e91 100644 --- a/src/Common/object_saver.h +++ b/src/Common/object_saver.h @@ -18,7 +18,7 @@ struct CSaver template IC static void save_data(const T& data, M& stream, const P& p) { - STATIC_CHECK(!std::is_polymorphic::value, Cannot_save_polymorphic_classes_as_binary_data); + static_assert(!std::is_polymorphic::value, "Cannot save polymorphic classes as binary data."); stream.w(&data, sizeof(T)); } diff --git a/src/utils/xrAI/guid_generator.cpp b/src/utils/xrAI/guid_generator.cpp index e7592ff4853..6252c880098 100644 --- a/src/utils/xrAI/guid_generator.cpp +++ b/src/utils/xrAI/guid_generator.cpp @@ -20,7 +20,7 @@ xrGUID generate_guid() { xrGUID result; #ifdef WINVER - STATIC_CHECK(sizeof(xrGUID) == sizeof(GUID), Different_GUID_types); + static_assert(sizeof(xrGUID) == sizeof(GUID), "Different GUID types."); GUID _result; RPC_STATUS gen_result = UuidCreate(&_result); memcpy(&result, &_result, sizeof(_result)); @@ -32,7 +32,7 @@ xrGUID generate_guid() default: break; } #endif - STATIC_CHECK(sizeof(result) >= sizeof(u64), GUID_must_have_size_greater_or_equal_to_the_long_long); + static_assert(sizeof(result) >= sizeof(u64), "GUID must have size greater or equal to the long long."); ZeroMemory(&result, sizeof(result)); u64 temp = CPU::GetCLK(); memcpy(&result, &temp, sizeof(temp)); @@ -42,7 +42,7 @@ xrGUID generate_guid() LPCSTR generate_guid(const xrGUID& guid, LPSTR buffer, const u32& buffer_size) { #ifdef WINVER - STATIC_CHECK(sizeof(xrGUID) == sizeof(GUID), Different_GUID_types); + static_assert(sizeof(xrGUID) == sizeof(GUID), "Different GUID types."); GUID temp; memcpy(&temp, &guid, sizeof(guid)); RPC_CSTR temp2; diff --git a/src/xrAICore/Components/problem_solver_inline.h b/src/xrAICore/Components/problem_solver_inline.h index ad7cfa72e17..28b7499a9df 100644 --- a/src/xrAICore/Components/problem_solver_inline.h +++ b/src/xrAICore/Components/problem_solver_inline.h @@ -246,7 +246,7 @@ IC bool CProblemSolverAbstract::is_goal_reached(const _index_type& vertex_index) TEMPLATE_SPECIALIZATION IC bool CProblemSolverAbstract::is_goal_reached_impl(const _index_type& vertex_index) const { - STATIC_CHECK(!reverse_search, This_function_cannot_be_used_in_the_REVERSE_search); + static_assert(!reverse_search, "This function cannot be used in the REVERSE search."); xr_vector::const_iterator I = vertex_index.conditions().begin(); xr_vector::const_iterator E = vertex_index.conditions().end(); xr_vector::const_iterator i = target_state().conditions().begin(); @@ -309,7 +309,7 @@ IC bool CProblemSolverAbstract::is_goal_reached_impl(const _index_type& vertex_i TEMPLATE_SPECIALIZATION IC bool CProblemSolverAbstract::is_goal_reached_impl(const _index_type& vertex_index, bool) const { - STATIC_CHECK(reverse_search, This_function_cannot_be_used_in_the_STRAIGHT_search); + static_assert(reverse_search, "This function cannot be used in the STRAIGHT search."); xr_vector::const_iterator I = m_current_state.conditions().begin(); xr_vector::const_iterator E = m_current_state.conditions().end(); xr_vector::const_iterator i = vertex_index.conditions().begin(); @@ -377,7 +377,7 @@ TEMPLATE_SPECIALIZATION IC typename CProblemSolverAbstract::_edge_value_type CProblemSolverAbstract::estimate_edge_weight_impl( const _index_type& condition) const { - STATIC_CHECK(!reverse_search, This_function_cannot_be_used_in_the_REVERSE_search); + static_assert(!reverse_search, "This function cannot be used in the REVERSE search."); _edge_value_type result = 0; xr_vector::const_iterator I = target_state().conditions().begin(); xr_vector::const_iterator E = target_state().conditions().end(); @@ -405,7 +405,7 @@ TEMPLATE_SPECIALIZATION IC typename CProblemSolverAbstract::_edge_value_type CProblemSolverAbstract::estimate_edge_weight_impl( const _index_type& condition, bool) const { - STATIC_CHECK(reverse_search, This_function_cannot_be_used_in_the_STRAIGHT_search); + static_assert(reverse_search, "This function cannot be used in the STRAIGHT search."); _edge_value_type result = 0; xr_vector::const_iterator I = current_state().conditions().begin(); xr_vector::const_iterator E = current_state().conditions().end(); diff --git a/src/xrCore/Crypto/xr_dsa_signer.cpp b/src/xrCore/Crypto/xr_dsa_signer.cpp index 964b8008fbd..45e46225339 100644 --- a/src/xrCore/Crypto/xr_dsa_signer.cpp +++ b/src/xrCore/Crypto/xr_dsa_signer.cpp @@ -6,8 +6,8 @@ xr_dsa_signer::xr_dsa_signer(u8 const p_number[crypto::xr_dsa::public_key_length u8 const q_number[crypto::xr_dsa::private_key_length], u8 const g_number[crypto::xr_dsa::public_key_length]) : m_dsa(p_number, q_number, g_number) { - STATIC_CHECK(crypto::xr_dsa::private_key_length == crypto::xr_sha256::digest_length, - private_key_size_must_be_equal_to_digest_value_size); + static_assert(crypto::xr_dsa::private_key_length == crypto::xr_sha256::digest_length, + "Private key size must be equal to digest value size."); } xr_dsa_signer::~xr_dsa_signer() {} diff --git a/src/xrCore/Crypto/xr_dsa_verifyer.cpp b/src/xrCore/Crypto/xr_dsa_verifyer.cpp index 7e3143ad1e4..e475294ec33 100644 --- a/src/xrCore/Crypto/xr_dsa_verifyer.cpp +++ b/src/xrCore/Crypto/xr_dsa_verifyer.cpp @@ -6,7 +6,7 @@ xr_dsa_verifyer::xr_dsa_verifyer(u8 const p_number[crypto::xr_dsa::public_key_le u8 const public_key[crypto::xr_dsa::public_key_length]) : m_dsa(p_number, q_number, g_number) { - STATIC_CHECK(sizeof(m_public_key.m_value) == crypto::xr_dsa::public_key_length, public_key_sizes_not_equal); + static_assert(sizeof(m_public_key.m_value) == crypto::xr_dsa::public_key_length, "Public key sizes not equal."); CopyMemory(m_public_key.m_value, public_key, sizeof(m_public_key.m_value)); } diff --git a/src/xrCore/Crypto/xr_sha.cpp b/src/xrCore/Crypto/xr_sha.cpp index d115093b360..e65b6cd73f0 100644 --- a/src/xrCore/Crypto/xr_sha.cpp +++ b/src/xrCore/Crypto/xr_sha.cpp @@ -24,7 +24,7 @@ bool xr_sha256::continue_calculate() if (!m_data_size) { - STATIC_CHECK(digest_length == CryptoPP::SHA1::DIGESTSIZE, digest_length_must_be_equal_to_digest_size); + static_assert(digest_length == CryptoPP::SHA1::DIGESTSIZE, "Digest length must be equal to digest size."); m_sha_ctx.Final(m_result); return true; } diff --git a/src/xrCore/intrusive_ptr_inline.h b/src/xrCore/intrusive_ptr_inline.h index 9d32c96b035..eba461e297b 100644 --- a/src/xrCore/intrusive_ptr_inline.h +++ b/src/xrCore/intrusive_ptr_inline.h @@ -31,7 +31,7 @@ IC intrusive_ptr::intrusive_ptr(self_type const& rhs) template IC intrusive_ptr::~intrusive_ptr() { - STATIC_CHECK(result, Class_MUST_Be_Derived_From_The_Base); + static_assert(result, "Class MUST be derived from the base."); dec(); } diff --git a/src/xrCore/string_concatenations_inline.h b/src/xrCore/string_concatenations_inline.h index 41913df75d9..ab254a3eee1 100644 --- a/src/xrCore/string_concatenations_inline.h +++ b/src/xrCore/string_concatenations_inline.h @@ -115,7 +115,7 @@ class XRCORE_API string_tupples template static inline void add_string(string_tupples& self, T p) { - STATIC_CHECK(index < max_item_count, Error_invalid_string_index_specified); + static_assert(index < max_item_count, "Error invalid string index specified."); LPCSTR cstr = string(p); VERIFY(cstr); diff --git a/src/xrGame/aimers_base_inline.h b/src/xrGame/aimers_base_inline.h index 3739a56489a..07a3b9b31a1 100644 --- a/src/xrGame/aimers_base_inline.h +++ b/src/xrGame/aimers_base_inline.h @@ -13,7 +13,7 @@ template inline void aimers::base::fill_bones(u32 const (&bones)[bone_count0], u16 const (&bones_ids)[bone_count1], Fmatrix (&local_bones)[bone_count1], Fmatrix (&global_bones)[bone_count1]) { - STATIC_CHECK(bone_count0 <= bone_count1, invalid_arrays_passed); + static_assert(bone_count0 <= bone_count1, "Invalid arrays passed."); u16 const root_bone_id = m_kinematics.LL_GetBoneRoot(); CBoneInstance& root_bone = m_kinematics.LL_GetBoneInstance(root_bone_id); diff --git a/src/xrGame/alife_registry_container_inline.h b/src/xrGame/alife_registry_container_inline.h index 4a3fcfc7883..fbb4fc7cb14 100644 --- a/src/xrGame/alife_registry_container_inline.h +++ b/src/xrGame/alife_registry_container_inline.h @@ -12,7 +12,7 @@ template IC T& CALifeRegistryContainer::operator()(const T*) { const int value = Loki::TL::IndexOf::value; - STATIC_CHECK(value != -1, There_is_no_specified_registry_in_the_registry_container); + static_assert(value != -1, "There is no specified registry in the registry container."); return (*static_cast(this)); } @@ -20,6 +20,6 @@ template IC const T& CALifeRegistryContainer::operator()(const T*) const { const int value = Loki::TL::IndexOf::value; - STATIC_CHECK(value != -1, There_is_no_specified_registry_in_the_registry_container); + static_assert(value != -1, "There is no specified registry in the registry container."); return (*static_cast(this)); } diff --git a/src/xrGame/game_state_accumulator_inline.h b/src/xrGame/game_state_accumulator_inline.h index 0b3bada6c3b..a64e42fe249 100644 --- a/src/xrGame/game_state_accumulator_inline.h +++ b/src/xrGame/game_state_accumulator_inline.h @@ -1,9 +1,8 @@ template void game_state_accumulator::init_acpv_list() { - STATIC_CHECK(Loki::TL::is_Typelist::value, - Type_Must_Have_a_Loki_Type_List_type_use__ADD_ACCUMULATIVE_STATE__macro_define); - + static_assert(Loki::TL::is_Typelist::value, + "Type must have a Loki Type List type use ADD_ACCUMULATIVE_STATE macro define."); init_acpv_list(); player_state_param* tmp_obj_inst = new typename TypeListElement::Head::value_type(this); diff --git a/src/xrGame/game_state_accumulator_state_register.cpp b/src/xrGame/game_state_accumulator_state_register.cpp index db694aedcc2..54cfb910dd5 100644 --- a/src/xrGame/game_state_accumulator_state_register.cpp +++ b/src/xrGame/game_state_accumulator_state_register.cpp @@ -45,8 +45,8 @@ char* player_values_strtable[] = { void game_state_accumulator::init_accumulative_values() { - STATIC_CHECK(Loki::TL::Length::value == acpv_count, - Not_all_accumulative_values_has_been_added_to_a__ACCUMULATIVE_STATE_LIST__type_list); + static_assert(Loki::TL::Length::value == acpv_count, + "Not all accumulative values has been added to a ACCUMULATIVE_STATE_LIST type list."); init_acpv_list(); } diff --git a/src/xrGame/inventory_quickswitch.cpp b/src/xrGame/inventory_quickswitch.cpp index 1725a55ec59..2b6191d4e48 100644 --- a/src/xrGame/inventory_quickswitch.cpp +++ b/src/xrGame/inventory_quickswitch.cpp @@ -203,7 +203,7 @@ static char const* teamdata_section = "deathmatch_team0"; void CInventory::InitPriorityGroupsForQSwitch() { - STATIC_CHECK(epg_groups_count == CInventory::qs_priorities_count, groups_count_problem); + static_assert(epg_groups_count == CInventory::qs_priorities_count, "Groups count problem."); for (int i = epg_pistols; i < epg_groups_count; ++i) { m_groups[i].init_group(teamdata_section, groups_names[i]); diff --git a/src/xrGame/xrServer_updates_compressor.cpp b/src/xrGame/xrServer_updates_compressor.cpp index ed0c82c0e5d..ee28cc9238f 100644 --- a/src/xrGame/xrServer_updates_compressor.cpp +++ b/src/xrGame/xrServer_updates_compressor.cpp @@ -69,7 +69,7 @@ last_updates_cache::last_update_t* last_updates_cache::search_entity(u16 const e last_updates_cache::last_update_t* last_updates_cache::search_most_expired( u32 const current_time, u32 const update_size) { - STATIC_CHECK(cache_entities_size > 1, cache_entities_size__must_be_greater_than_one); + static_assert(cache_entities_size > 1, "Cache entities size must be greater than one."); last_update_t* min_time = &m_cache[0]; for (u32 i = 1; i < cache_entities_size; ++i) { diff --git a/src/xrServerEntities/smart_cast_impl1.h b/src/xrServerEntities/smart_cast_impl1.h index ed0ad201701..301bcb733f6 100644 --- a/src/xrServerEntities/smart_cast_impl1.h +++ b/src/xrServerEntities/smart_cast_impl1.h @@ -394,7 +394,7 @@ struct conversion_sequence template struct selector { - STATIC_CHECK(length > 1, Internal_error_please_report); + static_assert(length > 1, "Internal error, please report."); typedef typename selector<1>::result nearest; @@ -515,8 +515,8 @@ struct CHelper2 template IC static T1* smart_cast(T2* p) { - STATIC_CHECK(!object_type_traits::is_const::value || object_type_traits::is_const::value, - Cannot_use_smart_cast_to_convert_const_to_non_const); + static_assert(!object_type_traits::is_const::value || object_type_traits::is_const::value, + "Cannot use smart_cast to convert const to non-const."); typedef object_type_traits::remove_const::type _T1; typedef object_type_traits::remove_const::type _T2; #ifdef DEBUG @@ -551,11 +551,11 @@ template IC T1 smart_cast(T2* p) { #ifdef PURE_DYNAMIC_CAST_COMPATIBILITY_CHECK - STATIC_CHECK(object_type_traits::is_pointer::value, Invalid_target_type_for_Dynamic_Cast); - STATIC_CHECK(object_type_traits::is_void::type>::value || + static_assert(object_type_traits::is_pointer::value, "Invalid target type for Dynamic Cast."); + static_assert(object_type_traits::is_void::type>::value || std::is_polymorphic::type>::value, - Invalid_target_type_for_Dynamic_Cast); - STATIC_CHECK(std::is_polymorphic::value, Invalid_source_type_for_Dynamic_Cast); + "Invalid target type for Dynamic Cast"); + static_assert(std::is_polymorphic::value, "Invalid source type for Dynamic Cast."); #endif #ifdef SMART_CAST_STATS_ALL add_smart_cast_stats_all(typeid(T2*).name(), typeid(T1).name()); @@ -569,10 +569,10 @@ template IC T1 smart_cast(T2& p) { #ifdef PURE_DYNAMIC_CAST_COMPATIBILITY_CHECK - STATIC_CHECK(object_type_traits::is_reference::value, Invalid_target_type_for_Dynamic_Cast); - STATIC_CHECK(std::is_polymorphic::type>::value, - Invalid_target_type_for_Dynamic_Cast); - STATIC_CHECK(std::is_polymorphic::value, Invalid_source_type_for_Dynamic_Cast); + static_assert(object_type_traits::is_reference::value, "Invalid target type for Dynamic Cast."); + static_assert(std::is_polymorphic::type>::value, + "Invalid target type for Dynamic Cast."); + static_assert(std::is_polymorphic::value, "Invalid source type for Dynamic Cast."); #endif #ifdef SMART_CAST_STATS_ALL add_smart_cast_stats_all(typeid(T2*).name(), typeid(object_type_traits::remove_reference::type*).name());