1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-29 09:15:33 +00:00

Round up displayed encumbrance

This commit is contained in:
Capostrophic 2018-02-24 15:13:14 +03:00 committed by GitHub
parent 9b8c56761b
commit 089666dd68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -1,5 +1,7 @@
#include "companionwindow.hpp" #include "companionwindow.hpp"
#include <cmath>
#include <MyGUI_InputManager.h> #include <MyGUI_InputManager.h>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
@ -129,7 +131,7 @@ void CompanionWindow::updateEncumbranceBar()
return; return;
float capacity = mPtr.getClass().getCapacity(mPtr); float capacity = mPtr.getClass().getCapacity(mPtr);
float encumbrance = mPtr.getClass().getEncumbrance(mPtr); float encumbrance = mPtr.getClass().getEncumbrance(mPtr);
mEncumbranceBar->setValue(static_cast<int>(encumbrance), static_cast<int>(capacity)); mEncumbranceBar->setValue(std::ceil(encumbrance), static_cast<int>(capacity));
if (mModel && mModel->hasProfit(mPtr)) if (mModel && mModel->hasProfit(mPtr))
{ {

View file

@ -1,5 +1,6 @@
#include "inventorywindow.hpp" #include "inventorywindow.hpp"
#include <cmath>
#include <stdexcept> #include <stdexcept>
#include <MyGUI_Window.h> #include <MyGUI_Window.h>
@ -598,7 +599,7 @@ namespace MWGui
float capacity = player.getClass().getCapacity(player); float capacity = player.getClass().getCapacity(player);
float encumbrance = player.getClass().getEncumbrance(player); float encumbrance = player.getClass().getEncumbrance(player);
mTradeModel->adjustEncumbrance(encumbrance); mTradeModel->adjustEncumbrance(encumbrance);
mEncumbranceBar->setValue(static_cast<int>(encumbrance), static_cast<int>(capacity)); mEncumbranceBar->setValue(std::ceil(encumbrance), static_cast<int>(capacity));
} }
void InventoryWindow::onFrame(float dt) void InventoryWindow::onFrame(float dt)