Commit e197f531 authored by dteviot's avatar dteviot

fixing MSVC 2013 warning C4244: & C4305

conversion from 'const float' to 'int', possible loss of data
conversion from 'double' to 'int', possible loss of data
conversion from 'float' to 'int', possible loss of data
parent f2ac939e
......@@ -460,7 +460,7 @@ int clone(Arguments& info)
for (Stats::iterator it = stats.begin(); it != stats.end(); ++it)
{
name.val = it->first;
float amount = it->second;
int amount = it->second;
std::cout << std::setw(digitCount) << amount << " " << name.toString() << " ";
if (++i % 3 == 0)
......
......@@ -23,9 +23,9 @@ namespace ESSImport
}
for (int i=0; i<8; ++i)
{
cStats.mAttributes[i].mBase = acdt.mAttributes[i][1];
cStats.mAttributes[i].mMod = acdt.mAttributes[i][0];
cStats.mAttributes[i].mCurrent = acdt.mAttributes[i][0];
cStats.mAttributes[i].mBase = static_cast<int>(acdt.mAttributes[i][1]);
cStats.mAttributes[i].mMod = static_cast<int>(acdt.mAttributes[i][0]);
cStats.mAttributes[i].mCurrent = static_cast<int>(acdt.mAttributes[i][0]);
}
cStats.mGoldPool = acdt.mGoldPool;
cStats.mTalkedTo = (acdt.mFlags & TalkedToPlayer) != 0;
......
......@@ -553,7 +553,7 @@ public:
ESM::WeatherState weather;
weather.mCurrentWeather = toString(mGame.mGMDT.mCurrentWeather);
weather.mNextWeather = toString(mGame.mGMDT.mNextWeather);
weather.mRemainingTransitionTime = mGame.mGMDT.mWeatherTransition/100.f*(0.015*24*3600);
weather.mRemainingTransitionTime = mGame.mGMDT.mWeatherTransition/100.f*(0.015f*24*3600);
weather.mHour = mContext->mHour;
weather.mWindSpeed = 0.f;
weather.mTimePassed = 0.0;
......
......@@ -191,7 +191,7 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
, mExportFonts(false)
, mNewGame (false)
{
std::srand ( std::time(NULL) );
std::srand ( static_cast<unsigned int>(std::time(NULL)) );
MWClass::registerClasses();
Uint32 flags = SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE|SDL_INIT_GAMECONTROLLER|SDL_INIT_JOYSTICK;
......
......@@ -154,9 +154,9 @@ namespace MWClass
const MWWorld::Store<ESM::GameSetting> &gmst =
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
float iWeight = gmst.find (typeGmst)->getInt();
float iWeight = floor(gmst.find(typeGmst)->getFloat());
float epsilon = 5e-4;
float epsilon = 0.0005f;
if (ref->mBase->mData.mWeight == 0)
return ESM::Skill::Unarmored;
......@@ -262,7 +262,7 @@ namespace MWClass
info.enchant = ref->mBase->mEnchant;
if (!info.enchant.empty())
info.remainingEnchantCharge = ptr.getCellRef().getEnchantmentCharge();
info.remainingEnchantCharge = static_cast<int>(ptr.getCellRef().getEnchantmentCharge());
info.text = text;
......
......@@ -203,7 +203,7 @@ namespace MWClass
info.enchant = ref->mBase->mEnchant;
if (!info.enchant.empty())
info.remainingEnchantCharge = ptr.getCellRef().getEnchantmentCharge();
info.remainingEnchantCharge = static_cast<int>(ptr.getCellRef().getEnchantmentCharge());
info.text = text;
......
......@@ -103,9 +103,9 @@ namespace MWClass
data->mCreatureStats.setAttribute(ESM::Attribute::Endurance, ref->mBase->mData.mEndurance);
data->mCreatureStats.setAttribute(ESM::Attribute::Personality, ref->mBase->mData.mPersonality);
data->mCreatureStats.setAttribute(ESM::Attribute::Luck, ref->mBase->mData.mLuck);
data->mCreatureStats.setHealth (ref->mBase->mData.mHealth);
data->mCreatureStats.setMagicka (ref->mBase->mData.mMana);
data->mCreatureStats.setFatigue (ref->mBase->mData.mFatigue);
data->mCreatureStats.setHealth(static_cast<float>(ref->mBase->mData.mHealth));
data->mCreatureStats.setMagicka(static_cast<float>(ref->mBase->mData.mMana));
data->mCreatureStats.setFatigue(static_cast<float>(ref->mBase->mData.mFatigue));
data->mCreatureStats.setLevel(ref->mBase->mData.mLevel);
......@@ -289,7 +289,7 @@ namespace MWClass
{
damage = attack[0] + ((attack[1]-attack[0])*stats.getAttackStrength());
damage *= gmst.find("fDamageStrengthBase")->getFloat() +
(stats.getAttribute(ESM::Attribute::Strength).getModified() * gmst.find("fDamageStrengthMult")->getFloat() * 0.1);
(stats.getAttribute(ESM::Attribute::Strength).getModified() * gmst.find("fDamageStrengthMult")->getFloat() * 0.1f);
MWMechanics::adjustWeaponDamage(damage, weapon);
MWMechanics::reduceWeaponCondition(damage, true, weapon, ptr);
}
......@@ -376,8 +376,8 @@ namespace MWClass
// Check for knockdown
float agilityTerm = getCreatureStats(ptr).getAttribute(ESM::Attribute::Agility).getModified() * getGmst().fKnockDownMult->getFloat();
float knockdownTerm = getCreatureStats(ptr).getAttribute(ESM::Attribute::Agility).getModified()
* getGmst().iKnockDownOddsMult->getInt() * 0.01 + getGmst().iKnockDownOddsBase->getInt();
int roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 100; // [0, 99]
* getGmst().iKnockDownOddsMult->getInt() * 0.01f + getGmst().iKnockDownOddsBase->getInt();
int roll = static_cast<int>(std::rand() / (static_cast<double> (RAND_MAX)+1) * 100); // [0, 99]
if (ishealth && agilityTerm <= damage && knockdownTerm <= roll)
{
getCreatureStats(ptr).setKnockedDown(true);
......@@ -528,7 +528,7 @@ namespace MWClass
MWMechanics::CreatureStats& stats = getCreatureStats(ptr);
const GMST& gmst = getGmst();
float walkSpeed = gmst.fMinWalkSpeedCreature->getFloat() + 0.01 * stats.getAttribute(ESM::Attribute::Speed).getModified()
float walkSpeed = gmst.fMinWalkSpeedCreature->getFloat() + 0.01f * stats.getAttribute(ESM::Attribute::Speed).getModified()
* (gmst.fMaxWalkSpeedCreature->getFloat() - gmst.fMinWalkSpeedCreature->getFloat());
const MWBase::World *world = MWBase::Environment::get().getWorld();
......@@ -626,7 +626,7 @@ namespace MWClass
float Creature::getCapacity (const MWWorld::Ptr& ptr) const
{
const MWMechanics::CreatureStats& stats = getCreatureStats (ptr);
return stats.getAttribute(0).getModified()*5;
return static_cast<float>(stats.getAttribute(0).getModified() * 5);
}
float Creature::getEncumbrance (const MWWorld::Ptr& ptr) const
......
......@@ -167,19 +167,19 @@ namespace MWClass
if (opening)
{
MWBase::Environment::get().getSoundManager()->fadeOutSound3D(ptr,
closeSound, 0.5);
float offset = ptr.getRefData().getLocalRotation().rot[2]/ 3.14159265 * 2.0;
closeSound, 0.5f);
float offset = ptr.getRefData().getLocalRotation().rot[2]/ 3.14159265f * 2.0f;
action->setSoundOffset(offset);
action->setSound(openSound);
}
else
{
MWBase::Environment::get().getSoundManager()->fadeOutSound3D(ptr,
openSound, 0.5);
float offset = 1.0 - ptr.getRefData().getLocalRotation().rot[2]/ 3.14159265 * 2.0;
openSound, 0.5f);
float offset = 1.0 - ptr.getRefData().getLocalRotation().rot[2]/ 3.14159265f * 2.0f;
//most if not all door have closing bang somewhere in the middle of the sound,
//so we divide offset by two
action->setSoundOffset(offset * 0.5);
action->setSoundOffset(offset * 0.5f);
action->setSound(closeSound);
}
......
......@@ -205,7 +205,7 @@ namespace MWClass
{
MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>();
if (ptr.getCellRef().getCharge() == -1)
return ref->mBase->mData.mTime;
return static_cast<float>(ref->mBase->mData.mTime);
else
return ptr.getCellRef().getChargeFloat();
}
......
......@@ -66,12 +66,12 @@ namespace
double i = floor(d);
d -= i;
if(d < 0.5)
return i;
return static_cast<int>(i);
if(d > 0.5)
return i + 1.0;
return static_cast<int>(i) + 1;
if(is_even(i))
return i;
return i + 1.0;
return static_cast<int>(i);
return static_cast<int>(i) + 1;
}
void autoCalculateAttributes (const ESM::NPC* npc, MWMechanics::CreatureStats& creatureStats)
......@@ -116,7 +116,7 @@ namespace
continue;
// is this a minor or major skill?
float add=0.2;
float add=0.2f;
for (int k=0; k<5; ++k)
{
if (class_->mData.mSkills[k][0] == j)
......@@ -149,7 +149,7 @@ namespace
|| class_->mData.mAttribute[1] == ESM::Attribute::Endurance)
multiplier += 1;
creatureStats.setHealth(static_cast<int> (0.5 * (strength + endurance)) + multiplier * (creatureStats.getLevel() - 1));
creatureStats.setHealth(floor(0.5f * (strength + endurance)) + multiplier * (creatureStats.getLevel() - 1));
}
/**
......@@ -539,7 +539,7 @@ namespace MWClass
{
damage = attack[0] + ((attack[1]-attack[0])*stats.getAttackStrength());
damage *= gmst.fDamageStrengthBase->getFloat() +
(stats.getAttribute(ESM::Attribute::Strength).getModified() * gmst.fDamageStrengthMult->getFloat() * 0.1);
(stats.getAttribute(ESM::Attribute::Strength).getModified() * gmst.fDamageStrengthMult->getFloat() * 0.1f);
}
MWMechanics::adjustWeaponDamage(damage, weapon);
MWMechanics::reduceWeaponCondition(damage, true, weapon, ptr);
......@@ -648,7 +648,7 @@ namespace MWClass
const GMST& gmst = getGmst();
int chance = store.get<ESM::GameSetting>().find("iVoiceHitOdds")->getInt();
int roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 100; // [0, 99]
int roll = static_cast<int>(std::rand() / (static_cast<double> (RAND_MAX)+1) * 100); // [0, 99]
if (roll < chance)
{
MWBase::Environment::get().getDialogueManager()->say(ptr, "hit");
......@@ -657,8 +657,8 @@ namespace MWClass
// Check for knockdown
float agilityTerm = getCreatureStats(ptr).getAttribute(ESM::Attribute::Agility).getModified() * gmst.fKnockDownMult->getFloat();
float knockdownTerm = getCreatureStats(ptr).getAttribute(ESM::Attribute::Agility).getModified()
* gmst.iKnockDownOddsMult->getInt() * 0.01 + gmst.iKnockDownOddsBase->getInt();
roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 100; // [0, 99]
* gmst.iKnockDownOddsMult->getInt() * 0.01f + gmst.iKnockDownOddsBase->getInt();
roll = static_cast<int>(std::rand() / (static_cast<double> (RAND_MAX)+1) * 100); // [0, 99]
if (ishealth && agilityTerm <= damage && knockdownTerm <= roll)
{
getCreatureStats(ptr).setKnockedDown(true);
......@@ -690,7 +690,7 @@ namespace MWClass
float unmitigatedDamage = damage;
float x = damage / (damage + getArmorRating(ptr));
damage *= std::max(gmst.fCombatArmorMinMult->getFloat(), x);
int damageDiff = unmitigatedDamage - damage;
int damageDiff = static_cast<int>(unmitigatedDamage - damage);
if (damage < 1)
damage = 1;
......@@ -938,7 +938,7 @@ namespace MWClass
gmst.fJumpEncumbranceMultiplier->getFloat() *
(1.0f - Npc::getEncumbrance(ptr)/Npc::getCapacity(ptr));
float a = npcdata->mNpcStats.getSkill(ESM::Skill::Acrobatics).getModified();
float a = static_cast<float>(npcdata->mNpcStats.getSkill(ESM::Skill::Acrobatics).getModified());
float b = 0.0f;
if(a > 50.0f)
{
......@@ -1097,7 +1097,7 @@ namespace MWClass
if (it == invStore.end() || it->getTypeName() != typeid(ESM::Armor).name())
{
// unarmored
ratings[i] = (fUnarmoredBase1 * unarmoredSkill) * (fUnarmoredBase2 * unarmoredSkill);
ratings[i] = static_cast<int>((fUnarmoredBase1 * unarmoredSkill) * (fUnarmoredBase2 * unarmoredSkill));
}
else
{
......
......@@ -345,7 +345,7 @@ namespace MWClass
info.enchant = ref->mBase->mEnchant;
if (!info.enchant.empty())
info.remainingEnchantCharge = ptr.getCellRef().getEnchantmentCharge();
info.remainingEnchantCharge = static_cast<int>(ptr.getCellRef().getEnchantmentCharge());
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getCellRefString(ptr.getCellRef());
......
......@@ -444,7 +444,7 @@ namespace MWDialogue
if (mActor.getClass().isNpc())
{
MWMechanics::NpcStats& npcStats = mActor.getClass().getNpcStats(mActor);
npcStats.setBaseDisposition(npcStats.getBaseDisposition() + mPermanentDispositionChange);
npcStats.setBaseDisposition(static_cast<int>(npcStats.getBaseDisposition() + mPermanentDispositionChange));
}
mPermanentDispositionChange = 0;
mTemporaryDispositionChange = 0;
......@@ -521,7 +521,7 @@ namespace MWDialogue
mPermanentDispositionChange += perm;
// change temp disposition so that final disposition is between 0...100
int curDisp = MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mActor);
float curDisp = static_cast<float>(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mActor));
if (curDisp + mTemporaryDispositionChange < 0)
mTemporaryDispositionChange = -curDisp;
else if (curDisp + mTemporaryDispositionChange > 100)
......@@ -564,7 +564,7 @@ namespace MWDialogue
int DialogueManager::getTemporaryDispositionChange() const
{
return mTemporaryDispositionChange;
return static_cast<int>(mTemporaryDispositionChange);
}
void DialogueManager::applyDispositionChange(int delta)
......
......@@ -41,8 +41,8 @@ void BackgroundImage::adjustSize()
MyGUI::IntSize screenSize = getSize();
int leftPadding = std::max(0.0, (screenSize.width - screenSize.height * mAspect) / 2);
int topPadding = std::max(0.0, (screenSize.height - screenSize.width / mAspect) / 2);
int leftPadding = std::max(0, static_cast<int>(screenSize.width - screenSize.height * mAspect) / 2);
int topPadding = std::max(0, static_cast<int>(screenSize.height - screenSize.width / mAspect) / 2);
mChild->setCoord(leftPadding, topPadding, screenSize.width - leftPadding*2, screenSize.height - topPadding*2);
}
......
......@@ -326,7 +326,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
mLine = NULL;
}
void sectionBreak (float margin)
void sectionBreak (int margin)
{
add_partial_text();
......@@ -465,7 +465,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
{
MyGUI::GlyphInfo* gi = style->mFont->getGlyphInfo (stream.peek ());
if (gi)
space_width += gi->advance + gi->bearingX;
space_width += static_cast<int>(gi->advance + gi->bearingX);
stream.consume ();
}
......@@ -475,7 +475,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
{
MyGUI::GlyphInfo* gi = style->mFont->getGlyphInfo (stream.peek ());
if (gi)
word_width += gi->advance + gi->bearingX;
word_width += static_cast<int>(gi->advance + gi->bearingX);
stream.consume ();
}
......@@ -623,15 +623,15 @@ namespace
RenderXform (MyGUI::ICroppedRectangle* croppedParent, MyGUI::RenderTargetInfo const & renderTargetInfo)
{
clipTop = croppedParent->_getMarginTop ();
clipLeft = croppedParent->_getMarginLeft ();
clipRight = croppedParent->getWidth () - croppedParent->_getMarginRight ();
clipBottom = croppedParent->getHeight () - croppedParent->_getMarginBottom ();
clipTop = static_cast<float>(croppedParent->_getMarginTop());
clipLeft = static_cast<int>(croppedParent->_getMarginLeft ());
clipRight = static_cast<int>(croppedParent->getWidth () - croppedParent->_getMarginRight ());
clipBottom = static_cast<int>(croppedParent->getHeight() - croppedParent->_getMarginBottom());
absoluteLeft = croppedParent->getAbsoluteLeft();
absoluteTop = croppedParent->getAbsoluteTop();
leftOffset = renderTargetInfo.leftOffset;
topOffset = renderTargetInfo.topOffset;
absoluteLeft = static_cast<int>(croppedParent->getAbsoluteLeft());
absoluteTop = static_cast<int>(croppedParent->getAbsoluteTop());
leftOffset = static_cast<int>(renderTargetInfo.leftOffset);
topOffset = static_cast<int>(renderTargetInfo.topOffset);
pixScaleX = renderTargetInfo.pixScaleX;
pixScaleY = renderTargetInfo.pixScaleY;
......@@ -1136,7 +1136,7 @@ public:
MyGUI::Colour colour = isActive ? (this_->mItemActive ? run.mStyle->mActiveColour: run.mStyle->mHotColour) : run.mStyle->mNormalColour;
glyphStream.reset (section.mRect.left + line.mRect.left + run.mLeft, line.mRect.top, colour);
glyphStream.reset(static_cast<float>(section.mRect.left + line.mRect.left + run.mLeft), static_cast<float>(line.mRect.top), colour);
Utf8Stream stream (run.mRange);
......@@ -1164,7 +1164,7 @@ public:
RenderXform renderXform (mCroppedParent, textFormat.mRenderItem->getRenderTarget()->getInfo());
GlyphStream glyphStream (textFormat.mFont, mCoord.left, mCoord.top-mViewTop,
GlyphStream glyphStream(textFormat.mFont, static_cast<float>(mCoord.left), static_cast<float>(mCoord.top - mViewTop),
-1 /*mNode->getNodeDepth()*/, vertices, renderXform);
int visit_top = (std::max) (mViewTop, mViewTop + int (renderXform.clipTop ));
......
......@@ -71,7 +71,7 @@ namespace MWGui
/// to begin when additional text is inserted. Pagination attempts to keep
/// sections together on a single page. The margin parameter adds additional space
/// before the next line of text.
virtual void sectionBreak (float margin = 0) = 0;
virtual void sectionBreak (int margin = 0) = 0;
/// Changes the alignment for the current section of text.
virtual void setSectionAlignment (Alignment sectionAlignment) = 0;
......
......@@ -129,7 +129,7 @@ void CompanionWindow::updateEncumbranceBar()
return;
float capacity = mPtr.getClass().getCapacity(mPtr);
float encumbrance = mPtr.getClass().getEncumbrance(mPtr);
mEncumbranceBar->setValue(encumbrance, capacity);
mEncumbranceBar->setValue(static_cast<int>(encumbrance), static_cast<int>(capacity));
if (mModel && mModel->hasProfit(mPtr))
{
......
......@@ -9,8 +9,8 @@ namespace MWGui
{
ControllerRepeatEvent::ControllerRepeatEvent() :
mInit(0.5),
mStep(0.1),
mInit(0.5f),
mStep(0.1f),
mEnabled(true),
mTimeLeft(0)
{
......
......@@ -549,7 +549,7 @@ namespace MWGui
size_t range = book->getSize().second - viewHeight;
mScrollBar->setScrollRange(range);
mScrollBar->setScrollPosition(range-1);
mScrollBar->setTrackSize(viewHeight / static_cast<float>(book->getSize().second) * mScrollBar->getLineSize());
mScrollBar->setTrackSize(static_cast<int>(viewHeight / static_cast<float>(book->getSize().second) * mScrollBar->getLineSize()));
onScrollbarMoved(mScrollBar, range-1);
}
else
......@@ -637,14 +637,14 @@ namespace MWGui
if (dispositionVisible && !dispositionWasVisible)
{
mDispositionBar->setVisible(true);
float offset = mDispositionBar->getHeight()+5;
int offset = mDispositionBar->getHeight()+5;
mTopicsList->setCoord(mTopicsList->getCoord() + MyGUI::IntCoord(0,offset,0,-offset));
mTopicsList->adjustSize();
}
else if (!dispositionVisible && dispositionWasVisible)
{
mDispositionBar->setVisible(false);
float offset = mDispositionBar->getHeight()+5;
int offset = mDispositionBar->getHeight()+5;
mTopicsList->setCoord(mTopicsList->getCoord() - MyGUI::IntCoord(0,offset,0,-offset));
mTopicsList->adjustSize();
}
......
......@@ -262,7 +262,7 @@ namespace MWGui
void HUD::setDrowningTimeLeft(float time, float maxTime)
{
size_t progress = time/maxTime*200.0;
size_t progress = static_cast<size_t>(time / maxTime * 200);
mDrowning->setProgressPosition(progress);
bool isDrowning = (progress == 0);
......@@ -631,7 +631,7 @@ namespace MWGui
mEnemyHealth->setProgressRange(100);
// Health is usually cast to int before displaying. Actors die whenever they are < 1 health.
// Therefore any value < 1 should show as an empty health bar. We do the same in statswindow :)
mEnemyHealth->setProgressPosition(int(stats.getHealth().getCurrent()) / stats.getHealth().getModified() * 100);
mEnemyHealth->setProgressPosition(static_cast<size_t>(stats.getHealth().getCurrent() / stats.getHealth().getModified() * 100));
static const float fNPCHealthBarFade = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fNPCHealthBarFade")->getFloat();
if (fNPCHealthBarFade > 0.f)
......
......@@ -101,7 +101,7 @@ namespace MWGui
void InventoryWindow::adjustPanes()
{
const float aspect = 0.5; // fixed aspect ratio for the avatar image
float leftPaneWidth = (mMainWidget->getSize().height-44-mArmorRating->getHeight()) * aspect;
int leftPaneWidth = static_cast<int>(mMainWidget->getSize().height - 44 - mArmorRating->getHeight()) * aspect);
mLeftPane->setSize( leftPaneWidth, mMainWidget->getSize().height-44 );
mRightPane->setCoord( mLeftPane->getPosition().left + leftPaneWidth + 4,
mRightPane->getPosition().top,
......@@ -153,10 +153,10 @@ namespace MWGui
}
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
MyGUI::IntPoint pos (Settings::Manager::getFloat(setting + " x", "Windows") * viewSize.width,
Settings::Manager::getFloat(setting + " y", "Windows") * viewSize.height);
MyGUI::IntSize size (Settings::Manager::getFloat(setting + " w", "Windows") * viewSize.width,
Settings::Manager::getFloat(setting + " h", "Windows") * viewSize.height);
MyGUI::IntPoint pos(static_cast<int>(Settings::Manager::getFloat(setting + " x", "Windows") * viewSize.width),
static_cast<int>(Settings::Manager::getFloat(setting + " y", "Windows") * viewSize.height));
MyGUI::IntSize size(static_cast<int>(Settings::Manager::getFloat(setting + " w", "Windows") * viewSize.width),
static_cast<int>(Settings::Manager::getFloat(setting + " h", "Windows") * viewSize.height));
if (size.width != mMainWidget->getWidth() || size.height != mMainWidget->getHeight())
mPreviewResize = true;
......@@ -519,7 +519,7 @@ namespace MWGui
float capacity = player.getClass().getCapacity(player);
float encumbrance = player.getClass().getEncumbrance(player);
mTradeModel->adjustEncumbrance(encumbrance);
mEncumbranceBar->setValue(encumbrance, capacity);
mEncumbranceBar->setValue(static_cast<int>(encumbrance), static_cast<int>(capacity));
}
void InventoryWindow::onFrame()
......
......@@ -141,10 +141,10 @@ void ItemView::onSelectedBackground(MyGUI::Widget *sender)
void ItemView::onMouseWheel(MyGUI::Widget *_sender, int _rel)
{
if (mScrollView->getViewOffset().left + _rel*0.3 > 0)
if (mScrollView->getViewOffset().left + _rel*0.3f > 0)
mScrollView->setViewOffset(MyGUI::IntPoint(0, 0));
else
mScrollView->setViewOffset(MyGUI::IntPoint(mScrollView->getViewOffset().left + _rel*0.3, 0));
mScrollView->setViewOffset(MyGUI::IntPoint(static_cast<int>(mScrollView->getViewOffset().left + _rel*0.3f), 0));
}
void ItemView::setSize(const MyGUI::IntSize &_value)
......
......@@ -17,7 +17,7 @@ namespace MWGui
{
JailScreen::JailScreen()
: WindowBase("openmw_jail_screen.layout"),
mTimeAdvancer(0.01),
mTimeAdvancer(0.01f),
mDays(1),
mFadeTimeRemaining(0)
{
......@@ -66,7 +66,7 @@ namespace MWGui
void JailScreen::onJailProgressChanged(int cur, int /*total*/)
{
mProgressBar->setScrollPosition(0);
mProgressBar->setTrackSize(cur / (float)(mProgressBar->getScrollRange()) * mProgressBar->getLineSize());
mProgressBar->setTrackSize(static_cast<int>(cur / (float)(mProgressBar->getScrollRange()) * mProgressBar->getLineSize()));
}
void JailScreen::onJailFinished()
......@@ -83,7 +83,7 @@ namespace MWGui
std::set<int> skills;
for (int day=0; day<mDays; ++day)
{
int skill = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * ESM::Skill::Length;
int skill = static_cast<int>(std::rand() / (static_cast<double> (RAND_MAX)+1) * ESM::Skill::Length);
skills.insert(skill);
MWMechanics::SkillValue& value = player.getClass().getNpcStats(player).getSkill(skill);
......