From 409d466e42cfa87eb47a2d3526438112e3fe2f5a Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Sat, 12 May 2018 20:50:18 +0300 Subject: [PATCH] Make 0/0 encumbrance 0% encumbrance --- apps/openmw/mwworld/class.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwworld/class.cpp b/apps/openmw/mwworld/class.cpp index e59dde7b1..5425c2bd3 100644 --- a/apps/openmw/mwworld/class.cpp +++ b/apps/openmw/mwworld/class.cpp @@ -462,10 +462,15 @@ namespace MWWorld float Class::getNormalizedEncumbrance(const Ptr &ptr) const { float capacity = getCapacity(ptr); + float encumbrance = getEncumbrance(ptr); + + if (encumbrance == 0) + return 0.f; + if (capacity == 0) return 1.f; - return getEncumbrance(ptr) / capacity; + return encumbrance / capacity; } std::string Class::getSound(const MWWorld::ConstPtr&) const