Skip to content

Commit

Permalink
xrGame/ActorInput.cpp: toggle torch
Browse files Browse the repository at this point in the history
  • Loading branch information
ChugunovRoman committed Dec 14, 2024
1 parent 0456374 commit f58d48e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
27 changes: 15 additions & 12 deletions src/xrGame/ActorInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -878,18 +878,21 @@ void CActor::SwitchNightVision()

void CActor::SwitchTorch()
{
xr_vector<CAttachableItem*> const& all = CAttachmentOwner::attached_objects();
xr_vector<CAttachableItem*>::const_iterator it = all.begin();
xr_vector<CAttachableItem*>::const_iterator it_e = all.end();
for (; it != it_e; ++it)
{
CTorch* torch = smart_cast<CTorch*>(*it);
if (torch)
{
torch->Switch();
return;
}
}
// xr_vector<CAttachableItem*> const& all = CAttachmentOwner::attached_objects();
// xr_vector<CAttachableItem*>::const_iterator it = all.begin();
// xr_vector<CAttachableItem*>::const_iterator it_e = all.end();
// for (; it != it_e; ++it)
// {
// CTorch* torch = smart_cast<CTorch*>(*it);
// if (torch)
// {
// torch->Switch();
// return;
// }
// }

if (CTorch* torch = smart_cast<CTorch*>(Actor()->inventory().ItemFromSlot(TORCH_SLOT)))
torch->Switch();
}

#ifndef MASTER_GOLD
Expand Down
3 changes: 2 additions & 1 deletion src/xrGame/ui/UIActorMenuInitialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,14 @@ void CUIActorMenu::InitializeUniversal(CUIXml& uiXml)
{
// { id, "xml_section_name", "condition_indicator, "highlighter", "blocker", required }
{ eInventoryKnifeList, "dragdrop_knife", "progess_bar_knife", "inv_slot1_highlight", nullptr, false },
{ eInventoryTorchList, "dragdrop_torch", "progess_bar_torch", "torch_slot_highlight", nullptr, false},
{ eInventoryPistolList, "dragdrop_pistol", "progess_bar_weapon1", "inv_slot2_highlight", nullptr, true },
{ eInventoryAutomaticList, "dragdrop_automatic", "progess_bar_weapon2", "inv_slot3_highlight", nullptr, true },

{ eInventoryOutfitList, "dragdrop_outfit", "progess_bar_outfit", "outfit_slot_highlight", nullptr, true },
{ eInventoryHelmetList, "dragdrop_helmet", "progess_bar_helmet", "helmet_slot_highlight", "helmet_over", false },

{ eInventoryTorchList, "dragdrop_torch", "progess_bar_torch", "torch_slot_highlight", nullptr, false},

{ eInventoryBeltList, "dragdrop_belt", nullptr, "artefact_slot_highlight", "belt_list_over", true },
{ eInventoryDetectorList, "dragdrop_detector", "progess_bar_detector", "detector_slot_highlight", nullptr, true },

Expand Down

0 comments on commit f58d48e

Please sign in to comment.