From 2546ce2b162e7194db2926430a5e71bdf6737a02 Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Sun, 22 Sep 2024 18:24:21 +0200 Subject: [PATCH] Don't allow items that are better than new to be repaired --- CHANGELOG.md | 1 + apps/openmw/mwgui/merchantrepair.cpp | 2 +- apps/openmw/mwgui/sortfilteritemmodel.cpp | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aef21779d0..bcae64b27a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -191,6 +191,7 @@ Bug #8097: GetEffect doesn't detect 0 magnitude spells Bug #8124: Normal weapon resistance is applied twice for NPCs Bug #8132: Actors without hello responses turn to face the player + Bug #8171: Items with more than 100% health can be repaired Feature #1415: Infinite fall failsafe Feature #2566: Handle NAM9 records for manual cell references Feature #3501: OpenMW-CS: Instance Editing - Shortcuts for axial locking diff --git a/apps/openmw/mwgui/merchantrepair.cpp b/apps/openmw/mwgui/merchantrepair.cpp index 3be0bb1c06..a59f225e9e 100644 --- a/apps/openmw/mwgui/merchantrepair.cpp +++ b/apps/openmw/mwgui/merchantrepair.cpp @@ -55,7 +55,7 @@ namespace MWGui { int maxDurability = iter->getClass().getItemMaxHealth(*iter); int durability = iter->getClass().getItemHealth(*iter); - if (maxDurability == durability || maxDurability == 0) + if (maxDurability <= durability || maxDurability == 0) continue; int basePrice = iter->getClass().getValue(*iter); diff --git a/apps/openmw/mwgui/sortfilteritemmodel.cpp b/apps/openmw/mwgui/sortfilteritemmodel.cpp index e5b87abff7..fe85ea4bd0 100644 --- a/apps/openmw/mwgui/sortfilteritemmodel.cpp +++ b/apps/openmw/mwgui/sortfilteritemmodel.cpp @@ -288,7 +288,7 @@ namespace MWGui if ((mFilter & Filter_OnlyRepairable) && (!base.getClass().hasItemHealth(base) - || (base.getClass().getItemHealth(base) == base.getClass().getItemMaxHealth(base)) + || (base.getClass().getItemHealth(base) >= base.getClass().getItemMaxHealth(base)) || (base.getType() != ESM::Weapon::sRecordId && base.getType() != ESM::Armor::sRecordId))) return false;