From 9629047fbc8cbe506730cac2e4e4212abe5c1b43 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sat, 7 Dec 2024 15:13:14 +0100 Subject: [PATCH] Application: improve how invalid IDs are handled. --- src/Application/Application_MassViewer_Weapons.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Application/Application_MassViewer_Weapons.cpp b/src/Application/Application_MassViewer_Weapons.cpp index a9e3281..d23a1cd 100644 --- a/src/Application/Application_MassViewer_Weapons.cpp +++ b/src/Application/Application_MassViewer_Weapons.cpp @@ -467,8 +467,8 @@ Application::drawWeaponEditor(GameObjects::Weapon& weapon) { if(map->find(part.id) != map->cend()) { ImGui::TextUnformatted(map->at(part.id).cbegin(), map->at(part.id).cend()); } - else if(part.id == -1) { - ImGui::TextUnformatted(""); + else if(part.id < 0) { + ImGui::TextUnformatted(""); } else{ ImGui::Text("ID: %i", part.id); @@ -498,7 +498,7 @@ Application::drawWeaponEditor(GameObjects::Weapon& weapon) { ImGui::SameLine(); if(ImGui::SmallButton("Hide part " ICON_FA_QUESTION_CIRCLE)) { - part.id = 96 + (part.id / 100) * 100; + part.id = 96 + part.id >= 0 ? (part.id / 100) * 100 : 0; } drawTooltip(_selectedWeaponPart == 0 ? "This will hide the selected part, but not its accessories. "