1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-11-29 16:34:30 +00:00

Fix C4244 in navmeshtilescache benchmark

apps\benchmarks\detournavigator\navmeshtilescache.cpp(97): warning C4244: 'argument': conversion from 'double' to 'size_t', possible loss of data
apps\benchmarks\detournavigator\navmeshtilescache.cpp(97): note: the template instantiation context (the oldest one first) is
apps\benchmarks\detournavigator\navmeshtilescache.cpp(192): note: see reference to function template instantiation 'void `anonymous-namespace'::getFromFilledCache<1048576,100>(benchmark::State &)' being compiled
apps\benchmarks\detournavigator\navmeshtilescache.cpp(179): note: see reference to function template instantiation 'void `anonymous-namespace'::generateKeys<std::back_insert_iterator<std::vector<`anonymous-namespace'::Key,std::allocator<`anonymous-namespace'::Key>>>,std::linear_congruential_engine<unsigned int,48271,0,2147483647>>(_T0,size_t,_T1 &)' being compiled
        with
        [
            _T0=std::back_insert_iterator<std::vector<`anonymous-namespace'::Key,std::allocator<`anonymous-namespace'::Key>>>,
            _T1=std::linear_congruential_engine<unsigned int,48271,0,2147483647>
        ]
apps\benchmarks\detournavigator\navmeshtilescache.cpp(153): note: see reference to function template instantiation '`anonymous-namespace'::Key `anonymous-namespace'::generateKey<_T1>(size_t,_T0 &)' being compiled
        with
        [
            _T1=std::linear_congruential_engine<unsigned int,48271,0,2147483647>,
            _T0=std::linear_congruential_engine<unsigned int,48271,0,2147483647>
        ]
apps\benchmarks\detournavigator\navmeshtilescache.cpp(141): note: see reference to function template instantiation 'DetourNavigator::Mesh `anonymous-namespace'::generateMesh<_T0>(size_t,_T0 &)' being compiled
        with
        [
            _T0=std::linear_congruential_engine<unsigned int,48271,0,2147483647>
        ]
apps\benchmarks\detournavigator\navmeshtilescache.cpp(99): warning C4244: 'argument': conversion from 'double' to 'size_t', possible loss of data
apps\benchmarks\detournavigator\navmeshtilescache.cpp(112): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
apps\benchmarks\detournavigator\navmeshtilescache.cpp(112): note: the template instantiation context (the oldest one first) is
apps\benchmarks\detournavigator\navmeshtilescache.cpp(144): note: see reference to function template instantiation 'DetourNavigator::Heightfield `anonymous-namespace'::generateHeightfield<_T0>(_T0 &)' being compiled
        with
        [
            _T0=std::linear_congruential_engine<unsigned int,48271,0,2147483647>
        ]
This commit is contained in:
elsid 2025-11-21 13:53:58 +01:00 committed by AnyOldName3
parent c844e93f82
commit cde34d8041

View file

@ -94,9 +94,9 @@ namespace
std::vector<AreaType> areaTypes; std::vector<AreaType> areaTypes;
if (distribution(random) < 0.939) if (distribution(random) < 0.939)
{ {
generateVertices(std::back_inserter(vertices), triangles * 2.467, random); generateVertices(std::back_inserter(vertices), static_cast<std::size_t>(triangles * 2.467), random);
generateIndices(std::back_inserter(indices), static_cast<int>(vertices.size() / 3) - 1, generateIndices(std::back_inserter(indices), static_cast<int>(vertices.size() / 3) - 1,
vertices.size() * 1.279, random); static_cast<std::size_t>(vertices.size() * 1.279), random);
generateAreaTypes(std::back_inserter(areaTypes), indices.size() / 3, random); generateAreaTypes(std::back_inserter(areaTypes), indices.size() / 3, random);
} }
return Mesh(std::move(indices), std::move(vertices), std::move(areaTypes)); return Mesh(std::move(indices), std::move(vertices), std::move(areaTypes));
@ -109,7 +109,7 @@ namespace
result.mCellPosition = generateVec2i(1000, random); result.mCellPosition = generateVec2i(1000, random);
result.mCellSize = ESM::Land::REAL_SIZE; result.mCellSize = ESM::Land::REAL_SIZE;
result.mMinHeight = distribution(random); result.mMinHeight = distribution(random);
result.mMaxHeight = result.mMinHeight + 1.0; result.mMaxHeight = result.mMinHeight + 1.0f;
result.mLength = static_cast<std::uint8_t>(ESM::Land::LAND_SIZE); result.mLength = static_cast<std::uint8_t>(ESM::Land::LAND_SIZE);
std::generate_n( std::generate_n(
std::back_inserter(result.mHeights), ESM::Land::LAND_NUM_VERTS, [&] { return distribution(random); }); std::back_inserter(result.mHeights), ESM::Land::LAND_NUM_VERTS, [&] { return distribution(random); });