1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-30 16:20:21 +00:00

Merged pull request #1933

This commit is contained in:
Marc Zinnschlag 2018-09-24 11:53:07 +02:00
commit 84a2752db9
2 changed files with 6 additions and 2 deletions

View File

@ -126,6 +126,7 @@
Bug #4633: Sneaking stance affects speed even if the actor is not able to crouch
Bug #4641: GetPCJumping is handled incorrectly
Bug #4644: %Name should be available for all actors, not just for NPCs
Bug #4648: Hud thinks that throwing weapons have condition
Bug #4649: Levelup fully restores health
Feature #912: Editor: Add missing icons to UniversalId tables
Feature #1617: Editor: Enchantment effect record verifier

View File

@ -1383,8 +1383,11 @@ namespace MWGui
void WindowManager::setSelectedWeapon(const MWWorld::Ptr& item)
{
mSelectedWeapon = item;
int durabilityPercent =
static_cast<int>(item.getClass().getItemHealth(item) / static_cast<float>(item.getClass().getItemMaxHealth(item)) * 100);
int durabilityPercent = 100;
if (item.getClass().hasItemHealth(item))
{
durabilityPercent = static_cast<int>(item.getClass().getItemHealth(item) / static_cast<float>(item.getClass().getItemMaxHealth(item)) * 100);
}
mHud->setSelectedWeapon(item, durabilityPercent);
mInventoryWindow->setTitle(item.getClass().getName(item));
}