|
|
|
@ -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));
|
|
|
|
|
}
|
|
|
|
|