From ce310f34a81e6e5f29df69d477086514a79cbee0 Mon Sep 17 00:00:00 2001 From: "R.K" Date: Fri, 10 May 2024 02:42:21 -0700 Subject: [PATCH] IPL Fix & Formatting (#3082) --- src/core/data/ipls.hpp | 11 ++++++----- src/views/self/view_teleport.cpp | 22 +++++++++++++--------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/core/data/ipls.hpp b/src/core/data/ipls.hpp index cfd355c0..344a2e74 100644 --- a/src/core/data/ipls.hpp +++ b/src/core/data/ipls.hpp @@ -74,10 +74,11 @@ const ipl_libary ipls[] = { {{"jewel2fake"}}, {{"jewel2fake"}, {"bh1_16_refurb"}}, }, // Jewelry Interior - {"Coroner Morgue Interior", - {244.9, -1374.7, 39.5}, - {{"coroner_int_on"}, {"coronertrash"}}, - {{"coroner_int_off"}}, - {{"coroner_int_off"}}, + { + "Coroner Morgue Interior", + {244.9, -1374.7, 39.5}, + {{"coroner_int_on"}, {"coronertrash"}}, + {{"coroner_int_off"}}, + {{"coroner_int_off"}}, }, // Coroner Morgue Interior }; diff --git a/src/views/self/view_teleport.cpp b/src/views/self/view_teleport.cpp index f9756864..53e4f442 100644 --- a/src/views/self/view_teleport.cpp +++ b/src/views/self/view_teleport.cpp @@ -94,7 +94,7 @@ namespace big ImGui::SeparatorText("GUI_TAB_IPL"_T.data()); static int current_select = 0; - static int last_select = current_select; + static int last_select = -1; ImGui::SetNextItemWidth(400); if (ImGui::BeginCombo("##Ipllocation", ipls[current_select].friendly_name)) @@ -120,18 +120,22 @@ namespace big if (current_select != last_select) { // Unload previously loaded IPL of the last selection - for (auto& ipl_name_unload : ipls[last_select].ipl_names) + // If this is our first time loading an IPL (especially the first one in the list, then don't unload anything) + if (last_select != -1) { - if (STREAMING::IS_IPL_ACTIVE(ipl_name_unload)) + for (auto& ipl_name_unload : ipls[last_select].ipl_names) { - STREAMING::REMOVE_IPL(ipl_name_unload); + if (STREAMING::IS_IPL_ACTIVE(ipl_name_unload)) + { + STREAMING::REMOVE_IPL(ipl_name_unload); + } } - } - // Load previously deleted IPLs of the last selection - for (auto& ipl_name_load : ipls[last_select].ipl_names_remove) - { - STREAMING::REQUEST_IPL(ipl_name_load); + // Load previously deleted IPLs of the last selection + for (auto& ipl_name_load : ipls[last_select].ipl_names_remove) + { + STREAMING::REQUEST_IPL(ipl_name_load); + } } // Load new IPLs of the current selection