diff --git a/apps/components_tests/esm3/testsaveload.cpp b/apps/components_tests/esm3/testsaveload.cpp index 41a79313cc..7e5b73e4dd 100644 --- a/apps/components_tests/esm3/testsaveload.cpp +++ b/apps/components_tests/esm3/testsaveload.cpp @@ -723,7 +723,7 @@ namespace ESM TEST_P(Esm3SaveLoadRecordTest, landShouldNotChange) { LandRecordData data; - std::iota(data.mHeights.begin(), data.mHeights.end(), 1); + std::iota(data.mHeights.begin(), data.mHeights.end(), 1.0f); std::for_each(data.mHeights.begin(), data.mHeights.end(), [](float& v) { v *= Land::sHeightScale; }); data.mMinHeight = *std::min_element(data.mHeights.begin(), data.mHeights.end()); data.mMaxHeight = *std::max_element(data.mHeights.begin(), data.mHeights.end()); diff --git a/apps/essimporter/converter.hpp b/apps/essimporter/converter.hpp index 095e36c7ee..520dd27f2a 100644 --- a/apps/essimporter/converter.hpp +++ b/apps/essimporter/converter.hpp @@ -249,7 +249,7 @@ namespace ESSImport { ESM::InventoryState& invState = mContext->mPlayer.mObject.mInventory; - for (size_t i = 0; i < invState.mItems.size(); ++i) + for (uint32_t i = 0; i < static_cast(invState.mItems.size()); ++i) { // FIXME: in case of conflict (multiple items with this refID) use the already equipped one? if (invState.mItems[i].mRef.mRefID == refr.mActorData.mSelectedEnchantItem) diff --git a/apps/navmeshtool/worldspacedata.cpp b/apps/navmeshtool/worldspacedata.cpp index ec44d33e6c..df5c48e7ab 100644 --- a/apps/navmeshtool/worldspacedata.cpp +++ b/apps/navmeshtool/worldspacedata.cpp @@ -201,8 +201,8 @@ namespace NavMeshTool { if (!land.has_value() || osg::Vec2i(land->mX, land->mY) != cellPosition || (land->mDataTypes & ESM::Land::DATA_VHGT) == 0) - return { HeightfieldPlane{ ESM::Land::DEFAULT_HEIGHT }, ESM::Land::DEFAULT_HEIGHT, - ESM::Land::DEFAULT_HEIGHT }; + return { HeightfieldPlane{ static_cast(ESM::Land::DEFAULT_HEIGHT) }, + static_cast(ESM::Land::DEFAULT_HEIGHT), static_cast(ESM::Land::DEFAULT_HEIGHT) }; ESM::Land::LandData& landData = *landDatas.emplace_back(std::make_unique()); land->loadData(ESM::Land::DATA_VHGT, landData); diff --git a/apps/opencs/model/world/infoselectwrapper.cpp b/apps/opencs/model/world/infoselectwrapper.cpp index 2e9ed6e150..1ce126e0ee 100644 --- a/apps/opencs/model/world/infoselectwrapper.cpp +++ b/apps/opencs/model/world/infoselectwrapper.cpp @@ -625,8 +625,6 @@ bool CSMWorld::ConstInfoSelectWrapper::conditionIsAlwaysTrue( default: throw std::logic_error("InfoCondition: operator can not be used to compare"); } - - return false; } template @@ -651,8 +649,6 @@ bool CSMWorld::ConstInfoSelectWrapper::conditionIsNeverTrue( default: throw std::logic_error("InfoCondition: operator can not be used to compare"); } - - return false; } QVariant CSMWorld::ConstInfoSelectWrapper::getValue() const diff --git a/apps/opencs/model/world/refidcollection.cpp b/apps/opencs/model/world/refidcollection.cpp index e0d5799726..6fff14674f 100644 --- a/apps/opencs/model/world/refidcollection.cpp +++ b/apps/opencs/model/world/refidcollection.cpp @@ -753,7 +753,6 @@ void CSMWorld::RefIdCollection::cloneRecord( bool CSMWorld::RefIdCollection::touchRecord(const ESM::RefId& id) { throw std::runtime_error("RefIdCollection::touchRecord is unimplemented"); - return false; } void CSMWorld::RefIdCollection::appendRecord(std::unique_ptr record, UniversalId::Type type) diff --git a/apps/openmw/mwrender/animation.hpp b/apps/openmw/mwrender/animation.hpp index 1b5bc6b660..807f785b1b 100644 --- a/apps/openmw/mwrender/animation.hpp +++ b/apps/openmw/mwrender/animation.hpp @@ -154,7 +154,7 @@ namespace MWRender float mLoopStopTime = 0; float mStopTime = 0; - std::shared_ptr mTime = std::make_shared(0); + std::shared_ptr mTime = std::make_shared(0.0f); float mSpeedMult = 1; bool mPlaying = false; diff --git a/apps/openmw/mwrender/pathgrid.cpp b/apps/openmw/mwrender/pathgrid.cpp index a39ba86a60..137a781342 100644 --- a/apps/openmw/mwrender/pathgrid.cpp +++ b/apps/openmw/mwrender/pathgrid.cpp @@ -58,8 +58,6 @@ namespace MWRender default: return false; } - - return false; } void Pathgrid::addCell(const MWWorld::CellStore* store) diff --git a/apps/openmw/mwsound/openaloutput.cpp b/apps/openmw/mwsound/openaloutput.cpp index 0f27524912..60c9e5f3ea 100644 --- a/apps/openmw/mwsound/openaloutput.cpp +++ b/apps/openmw/mwsound/openaloutput.cpp @@ -34,7 +34,7 @@ namespace { - const int sLoudnessFPS = 20; // loudness values per second of audio + const float sLoudnessFPS = 20.0f; // loudness values per second of audio ALCenum checkALCError(ALCdevice* device, const char* func, int line) { diff --git a/apps/openmw/mwworld/inventorystore.cpp b/apps/openmw/mwworld/inventorystore.cpp index f31e261106..24e41e6016 100644 --- a/apps/openmw/mwworld/inventorystore.cpp +++ b/apps/openmw/mwworld/inventorystore.cpp @@ -54,8 +54,9 @@ void MWWorld::InventoryStore::storeEquipmentState( inventory.mEquipmentSlots[static_cast(index)] = i; } + // I'm not sure if the narrowing cast below is safe, but I think it'd break the save format if I widen the destination type if (mSelectedEnchantItem.getType() != -1 && mSelectedEnchantItem->getBase() == &ref) - inventory.mSelectedEnchantItem = index; + inventory.mSelectedEnchantItem = static_cast(index); } void MWWorld::InventoryStore::readEquipmentState( diff --git a/components/lua/configuration.cpp b/components/lua/configuration.cpp index b327270fc1..0bd04c1359 100644 --- a/components/lua/configuration.cpp +++ b/components/lua/configuration.cpp @@ -55,7 +55,7 @@ namespace LuaUtil // Find duplicates; only the last occurrence will be used (unless `sMerge` flag is used). // Search for duplicates is case insensitive. std::vector skip(cfg.mScripts.size(), false); - for (size_t i = 0; i < cfg.mScripts.size(); ++i) + for (int i = 0; i < static_cast(mScripts.size()); ++i) { const ESM::LuaScriptCfg& script = cfg.mScripts[i]; bool global = script.mFlags & ESM::LuaScriptCfg::sGlobal; diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index 07eb342221..d9e20e810a 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -1683,7 +1683,7 @@ namespace NifOsg if (hasColors) colors.emplace_back(elem.mVertColor[0], elem.mVertColor[1], elem.mVertColor[2], elem.mVertColor[3]); if (hasUV) - uvlist.emplace_back(halfToFloat(elem.mUV[0]), 1.0 - halfToFloat(elem.mUV[1])); + uvlist.emplace_back(halfToFloat(elem.mUV[0]), 1.0f - halfToFloat(elem.mUV[1])); } if (!vertices.empty()) diff --git a/components/sceneutil/riggeometry.cpp b/components/sceneutil/riggeometry.cpp index d93b88349d..f010f0dfaf 100644 --- a/components/sceneutil/riggeometry.cpp +++ b/components/sceneutil/riggeometry.cpp @@ -346,7 +346,7 @@ namespace SceneUtil std::map influencesToVertices; for (size_t i = 0; i < influences.size(); i++) - influencesToVertices[influences[i]].emplace_back(i); + influencesToVertices[influences[i]].emplace_back(static_cast(i)); mData->mInfluences.reserve(influencesToVertices.size()); mData->mInfluences.assign(influencesToVertices.begin(), influencesToVertices.end()); diff --git a/components/terrain/material.cpp b/components/terrain/material.cpp index 09d2680acd..9a0510f0ff 100644 --- a/components/terrain/material.cpp +++ b/components/terrain/material.cpp @@ -43,7 +43,7 @@ namespace // blendmap, apparently. matrix.preMultTranslate(osg::Vec3f(1.0f / blendmapScale / 4.0f, 1.0f / blendmapScale / 4.0f, 0.f)); - texMat = mTexMatMap.insert(std::make_pair(blendmapScale, new osg::TexMat(matrix))).first; + texMat = mTexMatMap.insert(std::make_pair(static_cast(blendmapScale), new osg::TexMat(matrix))).first; } return texMat->second; }