Skip to content

Commit

Permalink
Set default value for attach_place_idx
Browse files Browse the repository at this point in the history
  • Loading branch information
Drombeys committed Oct 30, 2024
1 parent ec359db commit 744f024
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/xrGame/HudItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/player_hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<IKinematics*>(::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);
}

Expand Down

0 comments on commit 744f024

Please sign in to comment.