From 744f0247f042626321d782c15507bc4b5f6dae47 Mon Sep 17 00:00:00 2001 From: Drombeys Date: Wed, 30 Oct 2024 14:04:53 +0300 Subject: [PATCH] Set default value for `attach_place_idx` --- src/xrGame/HudItem.cpp | 2 +- src/xrGame/player_hud.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/xrGame/HudItem.cpp b/src/xrGame/HudItem.cpp index 36fe68848..35763e467 100644 --- a/src/xrGame/HudItem.cpp +++ b/src/xrGame/HudItem.cpp @@ -716,7 +716,7 @@ bool CHudItem::HudAnimationExist(LPCSTR anim_name) { string256 anim_name_r; bool is_16x9 = UI().is_widescreen(); - u16 attach_place_idx = pSettings->r_u16(HudItemData()->m_sect_name, "attach_place_idx"); + u16 attach_place_idx = READ_IF_EXISTS(pSettings, r_u16, HudItemData()->m_sect_name, "attach_place_idx", 0); xr_sprintf(anim_name_r, "%s%s", anim_name, ((attach_place_idx == 1) && is_16x9) ? "_16x9" : ""); player_hud_motion* anm = HudItemData()->m_hand_motions.find_motion(anim_name_r); if (anm) diff --git a/src/xrGame/player_hud.cpp b/src/xrGame/player_hud.cpp index cb21c0317..a37ac9839 100644 --- a/src/xrGame/player_hud.cpp +++ b/src/xrGame/player_hud.cpp @@ -449,7 +449,7 @@ void attachable_hud_item::load(const shared_str& sect_name) const shared_str& visual_name = pSettings->r_string(sect_name, "item_visual"); m_model = smart_cast(::Render->model_Create(visual_name.c_str())); - m_attach_place_idx = pSettings->r_u16(sect_name, "attach_place_idx"); + m_attach_place_idx = READ_IF_EXISTS(pSettings, r_u16, sect_name, "attach_place_idx", 0); m_measures.load (sect_name, m_model); }