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

View File

@ -377,6 +377,8 @@ case $VS_VERSION in
MSVC_DISPLAY_YEAR="2022"
QT_MSVC_YEAR="2019"
VCPKG_TRIPLET="x64-windows"
;;
16|16.0|2019 )
@ -386,6 +388,8 @@ case $VS_VERSION in
MSVC_DISPLAY_YEAR="2019"
QT_MSVC_YEAR="2019"
VCPKG_TRIPLET="x64-windows-2019"
;;
15|15.0|2017 )
@ -546,7 +550,7 @@ fi
QT_VER='6.6.3'
AQT_VERSION='v3.1.15'
VCPKG_TAG="2024-11-10"
VCPKG_TAG="2025-07-23"
VCPKG_PATH="vcpkg-x64-${VS_VERSION:?}-${VCPKG_TAG:?}"
VCPKG_PDB_PATH="vcpkg-x64-${VS_VERSION:?}-pdb-${VCPKG_TAG:?}"
VCPKG_MANIFEST="${VCPKG_PATH:?}.txt"
@ -633,16 +637,16 @@ printf "vcpkg packages ${VCPKG_TAG:?}... "
fi
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_LIBRARY="$(real_pwd)/${VCPKG_PATH:?}/installed/x64-windows/lib/lua51.lib"
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/${VCPKG_TRIPLET}/lib/lua51.lib"
for CONFIGURATION in ${CONFIGURATIONS[@]}; do
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"
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"
fi

View File

@ -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());

View File

@ -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<uint32_t>(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)

View File

@ -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<float>(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>());
land->loadData(ESM::Land::DATA_VHGT, landData);

View File

@ -625,8 +625,6 @@ bool CSMWorld::ConstInfoSelectWrapper::conditionIsAlwaysTrue(
default:
throw std::logic_error("InfoCondition: operator can not be used to compare");
}
return false;
}
template <typename T1, typename T2>
@ -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

View File

@ -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<RecordBase> record, UniversalId::Type type)

View File

@ -154,7 +154,7 @@ namespace MWRender
float mLoopStopTime = 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;
bool mPlaying = false;

View File

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

View File

@ -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)
{

View File

@ -55,7 +55,7 @@ void MWWorld::InventoryStore::storeEquipmentState(
}
if (mSelectedEnchantItem.getType() != -1 && mSelectedEnchantItem->getBase() == &ref)
inventory.mSelectedEnchantItem = index;
inventory.mSelectedEnchantItem = static_cast<uint32_t>(index);
}
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).
// Search for duplicates is case insensitive.
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];
bool global = script.mFlags & ESM::LuaScriptCfg::sGlobal;

View File

@ -1686,7 +1686,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())

View File

@ -362,7 +362,7 @@ namespace SceneUtil
std::map<BoneWeights, VertexList> influencesToVertices;
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.assign(influencesToVertices.begin(), influencesToVertices.end());

View File

@ -43,7 +43,8 @@ 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<float>(blendmapScale), new osg::TexMat(matrix)))
.first;
}
return texMat->second;
}