From 7c9a9d7de0c207b67665101fd71b9ad3478e0cd2 Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Sat, 21 Sep 2019 14:29:38 +0300 Subject: [PATCH] Fix chance none logic for nested levelled lists (bug #5169) --- CHANGELOG.md | 1 + apps/openmw/mwmechanics/levelledlist.hpp | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dec315506..811a276f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -149,6 +149,7 @@ Bug #5166: Scripts still should be executed after player's death Bug #5167: Player can select and cast spells before magic menu is enabled Bug #5168: Force1stPerson and Force3rdPerson commands are not really force view change + Bug #5169: Nested levelled items/creatures have significantly higher chance not to spawn Feature #1774: Handle AvoidNode Feature #2229: Improve pathfinding AI Feature #3025: Analogue gamepad movement controls diff --git a/apps/openmw/mwmechanics/levelledlist.hpp b/apps/openmw/mwmechanics/levelledlist.hpp index 45f7e86fe..697e2eda8 100644 --- a/apps/openmw/mwmechanics/levelledlist.hpp +++ b/apps/openmw/mwmechanics/levelledlist.hpp @@ -19,16 +19,14 @@ namespace MWMechanics { /// @return ID of resulting item, or empty if none - inline std::string getLevelledItem (const ESM::LevelledListBase* levItem, bool creature, unsigned char failChance=0) + inline std::string getLevelledItem (const ESM::LevelledListBase* levItem, bool creature) { const std::vector& items = levItem->mList; const MWWorld::Ptr& player = getPlayer(); int playerLevel = player.getClass().getCreatureStats(player).getLevel(); - failChance += levItem->mChanceNone; - - if (Misc::Rng::roll0to99() < failChance) + if (Misc::Rng::roll0to99() < levItem->mChanceNone) return std::string(); std::vector candidates; @@ -76,9 +74,9 @@ namespace MWMechanics else { if (ref.getPtr().getTypeName() == typeid(ESM::ItemLevList).name()) - return getLevelledItem(ref.getPtr().get()->mBase, false, failChance); + return getLevelledItem(ref.getPtr().get()->mBase, false); else - return getLevelledItem(ref.getPtr().get()->mBase, true, failChance); + return getLevelledItem(ref.getPtr().get()->mBase, true); } }