Skip to content

Commit 4cc6acc

Browse files
committed
Iterate ZHM5ActionManager actions directly instead of using temporary vector
1 parent 3d80fdd commit 4cc6acc

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

Mods/Editor/Src/Components/Items.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ void Editor::DrawItems(bool p_HasFocus) {
1616

1717
if (s_Showing) {
1818
const ZHM5ActionManager* s_Hm5ActionManager = Globals::HM5ActionManager;
19-
std::vector<ZHM5Action*> s_Actions;
2019

2120
if (s_Hm5ActionManager->m_Actions.size() == 0) {
2221
ImGui::PopFont();
@@ -26,20 +25,17 @@ void Editor::DrawItems(bool p_HasFocus) {
2625
return;
2726
}
2827

29-
for (unsigned int i = 0; i < s_Hm5ActionManager->m_Actions.size(); ++i) {
30-
ZHM5Action* s_Action = s_Hm5ActionManager->m_Actions[i];
31-
32-
if (s_Action && s_Action->m_eActionType == EActionType::AT_PICKUP) {
33-
s_Actions.push_back(s_Action);
34-
}
35-
}
36-
3728
static size_t s_Selected = 0;
3829

3930
ImGui::BeginChild("left pane", ImVec2(300, 0), true, ImGuiWindowFlags_HorizontalScrollbar);
4031

41-
for (size_t i = 0; i < s_Actions.size(); i++) {
42-
const ZHM5Action* s_Action = s_Actions[i];
32+
for (size_t i = 0; i < s_Hm5ActionManager->m_Actions.size(); i++) {
33+
const ZHM5Action* s_Action = s_Hm5ActionManager->m_Actions[i];
34+
35+
if (!s_Action || s_Action->m_eActionType != EActionType::AT_PICKUP) {
36+
continue;
37+
}
38+
4339
const ZHM5Item* s_Item = s_Action->m_Object.QueryInterface<ZHM5Item>();
4440
std::string s_Title = fmt::format(
4541
"{} ({:016x})###{}", s_Item->m_pItemConfigDescriptor->m_sTitle.c_str(),

0 commit comments

Comments
 (0)