Merge branch 'warn-baby-warn' into 'master'

Fix MSVC warnings

Closes #7882

See merge request OpenMW/openmw!4804
This commit is contained in:
Alexei Kotov 2025-07-25 21:45:34 +03:00
commit 730a62effc
15 changed files with 23 additions and 25 deletions

View File

@ -703,7 +703,7 @@ macOS15_Xcode16_arm64:
- Get-Volume - Get-Volume
- Copy-Item C:\ProgramData\chocolatey\logs\chocolatey.log - Copy-Item C:\ProgramData\chocolatey\logs\chocolatey.log
cache: cache:
key: ninja-2022-v12 key: ninja-2022-v13
paths: paths:
- ccache - ccache
- deps - deps
@ -861,7 +861,7 @@ macOS15_Xcode16_arm64:
- Get-Volume - Get-Volume
- Copy-Item C:\ProgramData\chocolatey\logs\chocolatey.log - Copy-Item C:\ProgramData\chocolatey\logs\chocolatey.log
cache: cache:
key: msbuild-2022-v12 key: msbuild-2022-v13
paths: paths:
- deps - deps
- MSVC2022_64/deps/Qt - MSVC2022_64/deps/Qt

View File

@ -377,6 +377,8 @@ case $VS_VERSION in
MSVC_DISPLAY_YEAR="2022" MSVC_DISPLAY_YEAR="2022"
QT_MSVC_YEAR="2019" QT_MSVC_YEAR="2019"
VCPKG_TRIPLET="x64-windows"
;; ;;
16|16.0|2019 ) 16|16.0|2019 )
@ -386,6 +388,8 @@ case $VS_VERSION in
MSVC_DISPLAY_YEAR="2019" MSVC_DISPLAY_YEAR="2019"
QT_MSVC_YEAR="2019" QT_MSVC_YEAR="2019"
VCPKG_TRIPLET="x64-windows-2019"
;; ;;
15|15.0|2017 ) 15|15.0|2017 )
@ -546,7 +550,7 @@ fi
QT_VER='6.6.3' QT_VER='6.6.3'
AQT_VERSION='v3.1.15' AQT_VERSION='v3.1.15'
VCPKG_TAG="2024-11-10" VCPKG_TAG="2025-07-23"
VCPKG_PATH="vcpkg-x64-${VS_VERSION:?}-${VCPKG_TAG:?}" VCPKG_PATH="vcpkg-x64-${VS_VERSION:?}-${VCPKG_TAG:?}"
VCPKG_PDB_PATH="vcpkg-x64-${VS_VERSION:?}-pdb-${VCPKG_TAG:?}" VCPKG_PDB_PATH="vcpkg-x64-${VS_VERSION:?}-pdb-${VCPKG_TAG:?}"
VCPKG_MANIFEST="${VCPKG_PATH:?}.txt" VCPKG_MANIFEST="${VCPKG_PATH:?}.txt"
@ -633,16 +637,16 @@ printf "vcpkg packages ${VCPKG_TAG:?}... "
fi fi
add_cmake_opts -DCMAKE_TOOLCHAIN_FILE="$(real_pwd)/${VCPKG_PATH:?}/scripts/buildsystems/vcpkg.cmake" add_cmake_opts -DCMAKE_TOOLCHAIN_FILE="$(real_pwd)/${VCPKG_PATH:?}/scripts/buildsystems/vcpkg.cmake"
add_cmake_opts -DLuaJit_INCLUDE_DIR="$(real_pwd)/${VCPKG_PATH:?}/installed/x64-windows/include/luajit" add_cmake_opts -DLuaJit_INCLUDE_DIR="$(real_pwd)/${VCPKG_PATH:?}/installed/${VCPKG_TRIPLET}/include/luajit"
add_cmake_opts -DLuaJit_LIBRARY="$(real_pwd)/${VCPKG_PATH:?}/installed/x64-windows/lib/lua51.lib" add_cmake_opts -DLuaJit_LIBRARY="$(real_pwd)/${VCPKG_PATH:?}/installed/${VCPKG_TRIPLET}/lib/lua51.lib"
for CONFIGURATION in ${CONFIGURATIONS[@]}; do for CONFIGURATION in ${CONFIGURATIONS[@]}; do
if [[ ${CONFIGURATION:?} == "Debug" ]]; then if [[ ${CONFIGURATION:?} == "Debug" ]]; then
VCPKG_DLL_BIN="$(pwd)/${VCPKG_PATH:?}/installed/x64-windows/debug/bin" VCPKG_DLL_BIN="$(pwd)/${VCPKG_PATH:?}/installed/${VCPKG_TRIPLET}/debug/bin"
add_runtime_dlls ${CONFIGURATION:?} "${VCPKG_DLL_BIN:?}/Debug/MyGUIEngine_d.dll" add_runtime_dlls ${CONFIGURATION:?} "${VCPKG_DLL_BIN:?}/Debug/MyGUIEngine_d.dll"
else else
VCPKG_DLL_BIN="$(pwd)/${VCPKG_PATH:?}/installed/x64-windows/bin" VCPKG_DLL_BIN="$(pwd)/${VCPKG_PATH:?}/installed/${VCPKG_TRIPLET}/bin"
add_runtime_dlls ${CONFIGURATION:?} "${VCPKG_DLL_BIN:?}/Release/MyGUIEngine.dll" add_runtime_dlls ${CONFIGURATION:?} "${VCPKG_DLL_BIN:?}/Release/MyGUIEngine.dll"
fi fi

View File

@ -723,7 +723,7 @@ namespace ESM
TEST_P(Esm3SaveLoadRecordTest, landShouldNotChange) TEST_P(Esm3SaveLoadRecordTest, landShouldNotChange)
{ {
LandRecordData data; 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; }); 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.mMinHeight = *std::min_element(data.mHeights.begin(), data.mHeights.end());
data.mMaxHeight = *std::max_element(data.mHeights.begin(), data.mHeights.end()); data.mMaxHeight = *std::max_element(data.mHeights.begin(), data.mHeights.end());

View File

@ -249,7 +249,7 @@ namespace ESSImport
{ {
ESM::InventoryState& invState = mContext->mPlayer.mObject.mInventory; 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<uint32_t>(invState.mItems.size()); ++i)
{ {
// FIXME: in case of conflict (multiple items with this refID) use the already equipped one? // FIXME: in case of conflict (multiple items with this refID) use the already equipped one?
if (invState.mItems[i].mRef.mRefID == refr.mActorData.mSelectedEnchantItem) if (invState.mItems[i].mRef.mRefID == refr.mActorData.mSelectedEnchantItem)

View File

@ -201,8 +201,8 @@ namespace NavMeshTool
{ {
if (!land.has_value() || osg::Vec2i(land->mX, land->mY) != cellPosition if (!land.has_value() || osg::Vec2i(land->mX, land->mY) != cellPosition
|| (land->mDataTypes & ESM::Land::DATA_VHGT) == 0) || (land->mDataTypes & ESM::Land::DATA_VHGT) == 0)
return { HeightfieldPlane{ ESM::Land::DEFAULT_HEIGHT }, ESM::Land::DEFAULT_HEIGHT, return { HeightfieldPlane{ static_cast<float>(ESM::Land::DEFAULT_HEIGHT) },
ESM::Land::DEFAULT_HEIGHT }; static_cast<float>(ESM::Land::DEFAULT_HEIGHT), static_cast<float>(ESM::Land::DEFAULT_HEIGHT) };
ESM::Land::LandData& landData = *landDatas.emplace_back(std::make_unique<ESM::Land::LandData>()); ESM::Land::LandData& landData = *landDatas.emplace_back(std::make_unique<ESM::Land::LandData>());
land->loadData(ESM::Land::DATA_VHGT, landData); land->loadData(ESM::Land::DATA_VHGT, landData);

View File

@ -625,8 +625,6 @@ bool CSMWorld::ConstInfoSelectWrapper::conditionIsAlwaysTrue(
default: default:
throw std::logic_error("InfoCondition: operator can not be used to compare"); throw std::logic_error("InfoCondition: operator can not be used to compare");
} }
return false;
} }
template <typename T1, typename T2> template <typename T1, typename T2>
@ -651,8 +649,6 @@ bool CSMWorld::ConstInfoSelectWrapper::conditionIsNeverTrue(
default: default:
throw std::logic_error("InfoCondition: operator can not be used to compare"); throw std::logic_error("InfoCondition: operator can not be used to compare");
} }
return false;
} }
QVariant CSMWorld::ConstInfoSelectWrapper::getValue() const QVariant CSMWorld::ConstInfoSelectWrapper::getValue() const

View File

@ -753,7 +753,6 @@ void CSMWorld::RefIdCollection::cloneRecord(
bool CSMWorld::RefIdCollection::touchRecord(const ESM::RefId& id) bool CSMWorld::RefIdCollection::touchRecord(const ESM::RefId& id)
{ {
throw std::runtime_error("RefIdCollection::touchRecord is unimplemented"); throw std::runtime_error("RefIdCollection::touchRecord is unimplemented");
return false;
} }
void CSMWorld::RefIdCollection::appendRecord(std::unique_ptr<RecordBase> record, UniversalId::Type type) void CSMWorld::RefIdCollection::appendRecord(std::unique_ptr<RecordBase> record, UniversalId::Type type)

View File

@ -154,7 +154,7 @@ namespace MWRender
float mLoopStopTime = 0; float mLoopStopTime = 0;
float mStopTime = 0; float mStopTime = 0;
std::shared_ptr<float> mTime = std::make_shared<float>(0); std::shared_ptr<float> mTime = std::make_shared<float>(0.0f);
float mSpeedMult = 1; float mSpeedMult = 1;
bool mPlaying = false; bool mPlaying = false;

View File

@ -58,8 +58,6 @@ namespace MWRender
default: default:
return false; return false;
} }
return false;
} }
void Pathgrid::addCell(const MWWorld::CellStore* store) void Pathgrid::addCell(const MWWorld::CellStore* store)

View File

@ -34,7 +34,7 @@
namespace 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) ALCenum checkALCError(ALCdevice* device, const char* func, int line)
{ {

View File

@ -55,7 +55,7 @@ void MWWorld::InventoryStore::storeEquipmentState(
} }
if (mSelectedEnchantItem.getType() != -1 && mSelectedEnchantItem->getBase() == &ref) if (mSelectedEnchantItem.getType() != -1 && mSelectedEnchantItem->getBase() == &ref)
inventory.mSelectedEnchantItem = index; inventory.mSelectedEnchantItem = static_cast<uint32_t>(index);
} }
void MWWorld::InventoryStore::readEquipmentState( void MWWorld::InventoryStore::readEquipmentState(

View File

@ -55,7 +55,7 @@ namespace LuaUtil
// Find duplicates; only the last occurrence will be used (unless `sMerge` flag is used). // Find duplicates; only the last occurrence will be used (unless `sMerge` flag is used).
// Search for duplicates is case insensitive. // Search for duplicates is case insensitive.
std::vector<bool> skip(cfg.mScripts.size(), false); std::vector<bool> skip(cfg.mScripts.size(), false);
for (size_t i = 0; i < cfg.mScripts.size(); ++i) for (int i = 0; i < static_cast<int>(cfg.mScripts.size()); ++i)
{ {
const ESM::LuaScriptCfg& script = cfg.mScripts[i]; const ESM::LuaScriptCfg& script = cfg.mScripts[i];
bool global = script.mFlags & ESM::LuaScriptCfg::sGlobal; bool global = script.mFlags & ESM::LuaScriptCfg::sGlobal;

View File

@ -1686,7 +1686,7 @@ namespace NifOsg
if (hasColors) if (hasColors)
colors.emplace_back(elem.mVertColor[0], elem.mVertColor[1], elem.mVertColor[2], elem.mVertColor[3]); colors.emplace_back(elem.mVertColor[0], elem.mVertColor[1], elem.mVertColor[2], elem.mVertColor[3]);
if (hasUV) 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()) if (!vertices.empty())

View File

@ -362,7 +362,7 @@ namespace SceneUtil
std::map<BoneWeights, VertexList> influencesToVertices; std::map<BoneWeights, VertexList> influencesToVertices;
for (size_t i = 0; i < influences.size(); i++) for (size_t i = 0; i < influences.size(); i++)
influencesToVertices[influences[i]].emplace_back(i); influencesToVertices[influences[i]].emplace_back(static_cast<VertexList::value_type>(i));
mData->mInfluences.reserve(influencesToVertices.size()); mData->mInfluences.reserve(influencesToVertices.size());
mData->mInfluences.assign(influencesToVertices.begin(), influencesToVertices.end()); mData->mInfluences.assign(influencesToVertices.begin(), influencesToVertices.end());

View File

@ -43,7 +43,8 @@ namespace
// blendmap, apparently. // blendmap, apparently.
matrix.preMultTranslate(osg::Vec3f(1.0f / blendmapScale / 4.0f, 1.0f / blendmapScale / 4.0f, 0.f)); 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<float>(blendmapScale), new osg::TexMat(matrix)))
.first;
} }
return texMat->second; return texMat->second;
} }