mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-19 19:53:53 +00:00
Use C++ limits instead of C ones
This commit is contained in:
parent
276b7830a9
commit
bdd9eba2b8
5 changed files with 9 additions and 18 deletions
|
@ -1,8 +1,6 @@
|
|||
#include "util.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <climits>
|
||||
#include <cfloat>
|
||||
|
||||
#include <QUndoStack>
|
||||
#include <QMetaProperty>
|
||||
|
@ -209,7 +207,7 @@ QWidget *CSVWorld::CommandDelegate::createEditor (QWidget *parent, const QStyleO
|
|||
case CSMWorld::ColumnBase::Display_Integer:
|
||||
{
|
||||
DialogueSpinBox *sb = new DialogueSpinBox(parent);
|
||||
sb->setRange(INT_MIN, INT_MAX);
|
||||
sb->setRange(std::numeric_limits<int>::min(), std::numeric_limits<int>::max());
|
||||
return sb;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#include "alchemywindow.hpp"
|
||||
|
||||
#include <climits>
|
||||
|
||||
#include <MyGUI_Gui.h>
|
||||
#include <MyGUI_Button.h>
|
||||
#include <MyGUI_EditBox.h>
|
||||
|
@ -323,8 +321,8 @@ namespace MWGui
|
|||
{
|
||||
int currentCount = mBrewCountEdit->getValue();
|
||||
|
||||
// prevent overflows, and prevent entering INT_MIN since abs(INT_MIN) is undefined
|
||||
if (currentCount == INT_MAX || currentCount == INT_MIN+1)
|
||||
// prevent overflows
|
||||
if (currentCount == std::numeric_limits<int>::max())
|
||||
return;
|
||||
|
||||
mBrewCountEdit->setValue(currentCount+1);
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#include "tradewindow.hpp"
|
||||
|
||||
#include <climits>
|
||||
|
||||
#include <MyGUI_Button.h>
|
||||
#include <MyGUI_InputManager.h>
|
||||
#include <MyGUI_ControllerManager.h>
|
||||
|
@ -96,7 +94,7 @@ namespace MWGui
|
|||
|
||||
mTotalBalance->eventValueChanged += MyGUI::newDelegate(this, &TradeWindow::onBalanceValueChanged);
|
||||
mTotalBalance->eventEditSelectAccept += MyGUI::newDelegate(this, &TradeWindow::onAccept);
|
||||
mTotalBalance->setMinValue(INT_MIN+1); // disallow INT_MIN since abs(INT_MIN) is undefined
|
||||
mTotalBalance->setMinValue(std::numeric_limits<int>::min()+1); // disallow INT_MIN since abs(INT_MIN) is undefined
|
||||
|
||||
setCoord(400, 0, 400, 300);
|
||||
}
|
||||
|
@ -431,7 +429,7 @@ namespace MWGui
|
|||
void TradeWindow::onIncreaseButtonTriggered()
|
||||
{
|
||||
// prevent overflows, and prevent entering INT_MIN since abs(INT_MIN) is undefined
|
||||
if (mCurrentBalance == INT_MAX || mCurrentBalance == INT_MIN+1)
|
||||
if (mCurrentBalance == std::numeric_limits<int>::max() || mCurrentBalance == std::numeric_limits<int>::min()+1)
|
||||
return;
|
||||
if (mCurrentBalance < 0) mCurrentBalance -= 1;
|
||||
else mCurrentBalance += 1;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "autocalcspell.hpp"
|
||||
#include "spellcasting.hpp"
|
||||
|
||||
#include <climits>
|
||||
#include <limits>
|
||||
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
@ -50,7 +49,7 @@ namespace MWMechanics
|
|||
caps.mCount = 0;
|
||||
caps.mLimit = iAutoSpellSchoolMax[i];
|
||||
caps.mReachedLimit = iAutoSpellSchoolMax[i] <= 0;
|
||||
caps.mMinCost = INT_MAX;
|
||||
caps.mMinCost = std::numeric_limits<int>::max();
|
||||
caps.mWeakestSpell.clear();
|
||||
schoolCaps[i] = caps;
|
||||
}
|
||||
|
@ -101,7 +100,7 @@ namespace MWMechanics
|
|||
if (found != selectedSpells.end())
|
||||
selectedSpells.erase(found);
|
||||
|
||||
cap.mMinCost = INT_MAX;
|
||||
cap.mMinCost = std::numeric_limits<int>::max();
|
||||
for (std::vector<std::string>::iterator weakIt = selectedSpells.begin(); weakIt != selectedSpells.end(); ++weakIt)
|
||||
{
|
||||
const ESM::Spell* testSpell = spells.find(*weakIt);
|
||||
|
@ -151,7 +150,7 @@ namespace MWMechanics
|
|||
float baseMagicka = fPCbaseMagickaMult * actorAttributes[ESM::Attribute::Intelligence];
|
||||
bool reachedLimit = false;
|
||||
const ESM::Spell* weakestSpell = NULL;
|
||||
int minCost = INT_MAX;
|
||||
int minCost = std::numeric_limits<int>::max();
|
||||
|
||||
std::vector<std::string> selectedSpells;
|
||||
|
||||
|
@ -188,7 +187,7 @@ namespace MWMechanics
|
|||
if (it != selectedSpells.end())
|
||||
selectedSpells.erase(it);
|
||||
|
||||
minCost = INT_MAX;
|
||||
minCost = std::numeric_limits<int>::max();
|
||||
for (std::vector<std::string>::iterator weakIt = selectedSpells.begin(); weakIt != selectedSpells.end(); ++weakIt)
|
||||
{
|
||||
const ESM::Spell* testSpell = esmStore.get<ESM::Spell>().find(*weakIt);
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#include "globalmap.hpp"
|
||||
|
||||
#include <climits>
|
||||
|
||||
#include <osg/Image>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/Group>
|
||||
|
|
Loading…
Reference in a new issue