From e94181b2b26e15d27b8cb255db262ede3126f0bf Mon Sep 17 00:00:00 2001 From: psi29a Date: Tue, 4 May 2021 21:03:14 +0000 Subject: [PATCH] Merge branch 'constexpr' into 'master' Sprinkle a couple of constexpr found by VS See merge request OpenMW/openmw!800 (cherry picked from commit 5e8ea624bc85acebf457592dd10b790124ecf6ef) 5704b2ac Sprinkle a couple of constexpr found by VS --- components/esm/loadland.cpp | 6 +++--- components/terrain/quadtreeworld.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/esm/loadland.cpp b/components/esm/loadland.cpp index 2aa8f21dbe..38596628f2 100644 --- a/components/esm/loadland.cpp +++ b/components/esm/loadland.cpp @@ -161,9 +161,9 @@ namespace ESM { // Generate WNAM record signed char wnam[LAND_GLOBAL_MAP_LOD_SIZE]; - float max = std::numeric_limits::max(); - float min = std::numeric_limits::min(); - float vertMult = static_cast(ESM::Land::LAND_SIZE - 1) / LAND_GLOBAL_MAP_LOD_SIZE_SQRT; + constexpr float max = std::numeric_limits::max(); + constexpr float min = std::numeric_limits::min(); + constexpr float vertMult = static_cast(ESM::Land::LAND_SIZE - 1) / LAND_GLOBAL_MAP_LOD_SIZE_SQRT; for (int row = 0; row < LAND_GLOBAL_MAP_LOD_SIZE_SQRT; ++row) { for (int col = 0; col < LAND_GLOBAL_MAP_LOD_SIZE_SQRT; ++col) diff --git a/components/terrain/quadtreeworld.cpp b/components/terrain/quadtreeworld.cpp index 70b44935c2..e9f5805566 100644 --- a/components/terrain/quadtreeworld.cpp +++ b/components/terrain/quadtreeworld.cpp @@ -212,8 +212,8 @@ public: { // We arrived at a leaf. // Since the tree is used for LOD level selection instead of culling, we do not need to load the actual height data here. - float minZ = -std::numeric_limits::max(); - float maxZ = std::numeric_limits::max(); + constexpr float minZ = -std::numeric_limits::max(); + constexpr float maxZ = std::numeric_limits::max(); float cellWorldSize = mStorage->getCellWorldSize(); osg::BoundingBox boundingBox(osg::Vec3f((center.x()-halfSize)*cellWorldSize, (center.y()-halfSize)*cellWorldSize, minZ), osg::Vec3f((center.x()+halfSize)*cellWorldSize, (center.y()+halfSize)*cellWorldSize, maxZ));