From 1c4706208397fb5b856cbef7fc1c7545db24094e Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Sat, 14 Oct 2023 16:22:28 +0200 Subject: [PATCH 1/3] Replace more explicitly sized reads --- components/esm3/loadrepa.cpp | 2 +- components/esm3/loadrepa.hpp | 6 +++--- components/esm3/loadscpt.cpp | 12 ++++++++---- components/esm3/loadscpt.hpp | 4 ++-- components/esm3/loadskil.cpp | 2 +- components/esm3/loadskil.hpp | 8 ++++---- components/esm3/loadweap.cpp | 3 ++- components/esm3/loadweap.hpp | 12 ++++++------ 8 files changed, 27 insertions(+), 22 deletions(-) diff --git a/components/esm3/loadrepa.cpp b/components/esm3/loadrepa.cpp index ea0fc29f19..c911cb1a23 100644 --- a/components/esm3/loadrepa.cpp +++ b/components/esm3/loadrepa.cpp @@ -28,7 +28,7 @@ namespace ESM mName = esm.getHString(); break; case fourCC("RIDT"): - esm.getHTSized<16>(mData); + esm.getHT(mData.mWeight, mData.mValue, mData.mUses, mData.mQuality); hasData = true; break; case fourCC("SCRI"): diff --git a/components/esm3/loadrepa.hpp b/components/esm3/loadrepa.hpp index 63f0a2959d..37fe94c349 100644 --- a/components/esm3/loadrepa.hpp +++ b/components/esm3/loadrepa.hpp @@ -22,14 +22,14 @@ namespace ESM struct Data { float mWeight; - int mValue; + int32_t mValue; - int mUses; + int32_t mUses; float mQuality; }; // Size = 16 Data mData; - unsigned int mRecordFlags; + uint32_t mRecordFlags; RefId mId, mScript; std::string mName, mModel, mIcon; diff --git a/components/esm3/loadscpt.cpp b/components/esm3/loadscpt.cpp index 51752deca3..c1dc759cdc 100644 --- a/components/esm3/loadscpt.cpp +++ b/components/esm3/loadscpt.cpp @@ -12,12 +12,12 @@ namespace ESM { void Script::loadSCVR(ESMReader& esm) { - int s = mData.mStringTableSize; + uint32_t s = mData.mStringTableSize; std::vector tmp(s); // not using getHExact, vanilla doesn't seem to mind unused bytes at the end esm.getSubHeader(); - int left = esm.getSubSize(); + uint32_t left = esm.getSubSize(); if (left < s) esm.fail("SCVR string list is smaller than specified"); esm.getExact(tmp.data(), s); @@ -99,7 +99,11 @@ namespace ESM { esm.getSubHeader(); mId = esm.getMaybeFixedRefIdSize(32); - esm.getTSized<20>(mData); + esm.getT(mData.mNumShorts); + esm.getT(mData.mNumLongs); + esm.getT(mData.mNumFloats); + esm.getT(mData.mScriptDataSize); + esm.getT(mData.mStringTableSize); hasHeader = true; break; @@ -114,7 +118,7 @@ namespace ESM esm.getSubHeader(); uint32_t subSize = esm.getSubSize(); - if (subSize != static_cast(mData.mScriptDataSize)) + if (subSize != mData.mScriptDataSize) { std::stringstream ss; ss << "Script data size defined in SCHD subrecord does not match size of SCDT subrecord"; diff --git a/components/esm3/loadscpt.hpp b/components/esm3/loadscpt.hpp index f0fab766cf..61b27f1423 100644 --- a/components/esm3/loadscpt.hpp +++ b/components/esm3/loadscpt.hpp @@ -29,7 +29,7 @@ namespace ESM { /// Data from script-precompling in the editor. /// \warning Do not use them. OpenCS currently does not precompile scripts. - int mNumShorts, mNumLongs, mNumFloats, mScriptDataSize, mStringTableSize; + uint32_t mNumShorts, mNumLongs, mNumFloats, mScriptDataSize, mStringTableSize; }; struct SCHD { @@ -37,7 +37,7 @@ namespace ESM Script::SCHDstruct mData; }; - unsigned int mRecordFlags; + uint32_t mRecordFlags; RefId mId; SCHDstruct mData; diff --git a/components/esm3/loadskil.cpp b/components/esm3/loadskil.cpp index 8661230e8c..fd53726f90 100644 --- a/components/esm3/loadskil.cpp +++ b/components/esm3/loadskil.cpp @@ -55,7 +55,7 @@ namespace ESM hasIndex = true; break; case fourCC("SKDT"): - esm.getHTSized<24>(mData); + esm.getHT(mData.mAttribute, mData.mSpecialization, mData.mUseValue); hasData = true; break; case fourCC("DESC"): diff --git a/components/esm3/loadskil.hpp b/components/esm3/loadskil.hpp index dac7745d3f..978e3d5dc4 100644 --- a/components/esm3/loadskil.hpp +++ b/components/esm3/loadskil.hpp @@ -24,7 +24,7 @@ namespace ESM ESM::RefId mFailureSound; ESM::RefId mHitSound; std::string mName; - int mAutoCalcMax; + int32_t mAutoCalcMax; static constexpr int Length = 6; @@ -44,13 +44,13 @@ namespace ESM /// Return a string descriptor for this record type. Currently used for debugging / error logs only. static std::string_view getRecordType() { return "Skill"; } - unsigned int mRecordFlags; + uint32_t mRecordFlags; SkillId mId; struct SKDTstruct { - int mAttribute; // see defs.hpp - int mSpecialization; // 0 - Combat, 1 - Magic, 2 - Stealth + int32_t mAttribute; // see defs.hpp + int32_t mSpecialization; // 0 - Combat, 1 - Magic, 2 - Stealth float mUseValue[4]; // How much skill improves through use. Meaning // of each field depends on what skill this // is. We should document this better later. diff --git a/components/esm3/loadweap.cpp b/components/esm3/loadweap.cpp index 501f0602e4..31c03b00fe 100644 --- a/components/esm3/loadweap.cpp +++ b/components/esm3/loadweap.cpp @@ -29,7 +29,8 @@ namespace ESM mName = esm.getHString(); break; case fourCC("WPDT"): - esm.getHTSized<32>(mData); + esm.getHT(mData.mWeight, mData.mValue, mData.mType, mData.mHealth, mData.mSpeed, mData.mReach, + mData.mEnchant, mData.mChop, mData.mSlash, mData.mThrust, mData.mFlags); hasData = true; break; case fourCC("SCRI"): diff --git a/components/esm3/loadweap.hpp b/components/esm3/loadweap.hpp index 6eec3a9ef4..e8355d0f55 100644 --- a/components/esm3/loadweap.hpp +++ b/components/esm3/loadweap.hpp @@ -62,19 +62,19 @@ namespace ESM struct WPDTstruct { float mWeight; - int mValue; - short mType; - unsigned short mHealth; + int32_t mValue; + int16_t mType; + uint16_t mHealth; float mSpeed, mReach; - unsigned short mEnchant; // Enchantment points. The real value is mEnchant/10.f + uint16_t mEnchant; // Enchantment points. The real value is mEnchant/10.f unsigned char mChop[2], mSlash[2], mThrust[2]; // Min and max - int mFlags; + int32_t mFlags; }; // 32 bytes #pragma pack(pop) WPDTstruct mData; - unsigned int mRecordFlags; + uint32_t mRecordFlags; RefId mId, mEnchant, mScript; std::string mName, mModel, mIcon; From 514723a4e6ba0281cb7bfe5bcb1af2f11cd64d03 Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Sat, 14 Oct 2023 16:36:45 +0200 Subject: [PATCH 2/3] Use fixed size ints for Region and use an array for weather odds --- apps/esmtool/record.cpp | 14 ++-- apps/opencs/model/tools/regioncheck.cpp | 4 +- .../model/world/nestedcoladapterimp.cpp | 65 ++----------------- apps/openmw/mwbase/world.hpp | 2 +- apps/openmw/mwscript/skyextensions.cpp | 4 +- apps/openmw/mwworld/weather.cpp | 38 +++-------- apps/openmw/mwworld/weather.hpp | 6 +- apps/openmw/mwworld/worldimp.cpp | 2 +- apps/openmw/mwworld/worldimp.hpp | 2 +- components/esm3/loadregn.cpp | 18 +++-- components/esm3/loadregn.hpp | 13 ++-- components/esm3/weatherstate.cpp | 6 +- components/esm3/weatherstate.hpp | 10 +-- 13 files changed, 47 insertions(+), 137 deletions(-) diff --git a/apps/esmtool/record.cpp b/apps/esmtool/record.cpp index b13668dafc..e293055919 100644 --- a/apps/esmtool/record.cpp +++ b/apps/esmtool/record.cpp @@ -1201,16 +1201,10 @@ namespace EsmTool std::cout << " Name: " << mData.mName << std::endl; std::cout << " Weather:" << std::endl; - std::cout << " Clear: " << (int)mData.mData.mClear << std::endl; - std::cout << " Cloudy: " << (int)mData.mData.mCloudy << std::endl; - std::cout << " Foggy: " << (int)mData.mData.mFoggy << std::endl; - std::cout << " Overcast: " << (int)mData.mData.mOvercast << std::endl; - std::cout << " Rain: " << (int)mData.mData.mOvercast << std::endl; - std::cout << " Thunder: " << (int)mData.mData.mThunder << std::endl; - std::cout << " Ash: " << (int)mData.mData.mAsh << std::endl; - std::cout << " Blight: " << (int)mData.mData.mBlight << std::endl; - std::cout << " Snow: " << (int)mData.mData.mSnow << std::endl; - std::cout << " Blizzard: " << (int)mData.mData.mBlizzard << std::endl; + std::array weathers + = { "Clear", "Cloudy", "Fog", "Overcast", "Rain", "Thunder", "Ash", "Blight", "Snow", "Blizzard" }; + for (size_t i = 0; i < weathers.size(); ++i) + std::cout << " " << weathers[i] << ": " << mData.mData.mProbabilities[i] << std::endl; std::cout << " Map Color: " << mData.mMapColor << std::endl; if (!mData.mSleepList.empty()) std::cout << " Sleep List: " << mData.mSleepList << std::endl; diff --git a/apps/opencs/model/tools/regioncheck.cpp b/apps/opencs/model/tools/regioncheck.cpp index 4affc1bd44..08e8a17714 100644 --- a/apps/opencs/model/tools/regioncheck.cpp +++ b/apps/opencs/model/tools/regioncheck.cpp @@ -47,9 +47,7 @@ void CSMTools::RegionCheckStage::perform(int stage, CSMDoc::Messages& messages) /// \todo test that the ID in mSleeplist exists // test that chances add up to 100 - int chances = region.mData.mClear + region.mData.mCloudy + region.mData.mFoggy + region.mData.mOvercast - + region.mData.mRain + region.mData.mThunder + region.mData.mAsh + region.mData.mBlight + region.mData.mSnow - + region.mData.mBlizzard; + auto chances = std::accumulate(region.mData.mProbabilities.begin(), region.mData.mProbabilities.end(), 0u); if (chances != 100) messages.add(id, "Weather chances do not add up to 100", "", CSMDoc::Message::Severity_Error); diff --git a/apps/opencs/model/world/nestedcoladapterimp.cpp b/apps/opencs/model/world/nestedcoladapterimp.cpp index 0f3670431d..1f9958e84e 100644 --- a/apps/opencs/model/world/nestedcoladapterimp.cpp +++ b/apps/opencs/model/world/nestedcoladapterimp.cpp @@ -1076,31 +1076,8 @@ namespace CSMWorld } else if (subColIndex == 1) { - switch (subRowIndex) - { - case 0: - return region.mData.mClear; - case 1: - return region.mData.mCloudy; - case 2: - return region.mData.mFoggy; - case 3: - return region.mData.mOvercast; - case 4: - return region.mData.mRain; - case 5: - return region.mData.mThunder; - case 6: - return region.mData.mAsh; - case 7: - return region.mData.mBlight; - case 8: - return region.mData.mSnow; - case 9: - return region.mData.mBlizzard; - default: - break; - } + if (subRowIndex >= 0 && subRowIndex < region.mData.mProbabilities.size()) + return region.mData.mProbabilities[subRowIndex]; } throw std::runtime_error("index out of range"); @@ -1110,45 +1087,11 @@ namespace CSMWorld Record& record, const QVariant& value, int subRowIndex, int subColIndex) const { ESM::Region region = record.get(); - unsigned char chance = static_cast(value.toInt()); + uint8_t chance = static_cast(value.toInt()); if (subColIndex == 1) { - switch (subRowIndex) - { - case 0: - region.mData.mClear = chance; - break; - case 1: - region.mData.mCloudy = chance; - break; - case 2: - region.mData.mFoggy = chance; - break; - case 3: - region.mData.mOvercast = chance; - break; - case 4: - region.mData.mRain = chance; - break; - case 5: - region.mData.mThunder = chance; - break; - case 6: - region.mData.mAsh = chance; - break; - case 7: - region.mData.mBlight = chance; - break; - case 8: - region.mData.mSnow = chance; - break; - case 9: - region.mData.mBlizzard = chance; - break; - default: - throw std::runtime_error("index out of range"); - } + region.mData.mProbabilities.at(subRowIndex) = chance; record.setModified(region); } diff --git a/apps/openmw/mwbase/world.hpp b/apps/openmw/mwbase/world.hpp index e5499f6680..14e3b2b3b7 100644 --- a/apps/openmw/mwbase/world.hpp +++ b/apps/openmw/mwbase/world.hpp @@ -232,7 +232,7 @@ namespace MWBase virtual void setMoonColour(bool red) = 0; - virtual void modRegion(const ESM::RefId& regionid, const std::vector& chances) = 0; + virtual void modRegion(const ESM::RefId& regionid, const std::vector& chances) = 0; virtual void changeToInteriorCell( std::string_view cellName, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent = true) diff --git a/apps/openmw/mwscript/skyextensions.cpp b/apps/openmw/mwscript/skyextensions.cpp index 39944970bf..d2b41fb87a 100644 --- a/apps/openmw/mwscript/skyextensions.cpp +++ b/apps/openmw/mwscript/skyextensions.cpp @@ -102,11 +102,11 @@ namespace MWScript std::string_view region{ runtime.getStringLiteral(runtime[0].mInteger) }; runtime.pop(); - std::vector chances; + std::vector chances; chances.reserve(10); while (arg0 > 0) { - chances.push_back(std::clamp(runtime[0].mInteger, 0, 127)); + chances.push_back(std::clamp(runtime[0].mInteger, 0, 100)); runtime.pop(); arg0--; } diff --git a/apps/openmw/mwworld/weather.cpp b/apps/openmw/mwworld/weather.cpp index 3338acd832..0da70bdd48 100644 --- a/apps/openmw/mwworld/weather.cpp +++ b/apps/openmw/mwworld/weather.cpp @@ -285,19 +285,8 @@ namespace MWWorld RegionWeather::RegionWeather(const ESM::Region& region) : mWeather(invalidWeatherID) - , mChances() + , mChances(region.mData.mProbabilities.begin(), region.mData.mProbabilities.end()) { - mChances.reserve(10); - mChances.push_back(region.mData.mClear); - mChances.push_back(region.mData.mCloudy); - mChances.push_back(region.mData.mFoggy); - mChances.push_back(region.mData.mOvercast); - mChances.push_back(region.mData.mRain); - mChances.push_back(region.mData.mThunder); - mChances.push_back(region.mData.mAsh); - mChances.push_back(region.mData.mBlight); - mChances.push_back(region.mData.mSnow); - mChances.push_back(region.mData.mBlizzard); } RegionWeather::RegionWeather(const ESM::RegionWeatherState& state) @@ -313,19 +302,9 @@ namespace MWWorld return state; } - void RegionWeather::setChances(const std::vector& chances) + void RegionWeather::setChances(const std::vector& chances) { - if (mChances.size() < chances.size()) - { - mChances.reserve(chances.size()); - } - - int i = 0; - for (char chance : chances) - { - mChances[i] = chance; - i++; - } + mChances = chances; // Regional weather no longer supports the current type, select a new weather pattern. if ((static_cast(mWeather) >= mChances.size()) || (mChances[mWeather] == 0)) @@ -357,15 +336,14 @@ namespace MWWorld // If chances A and B has values 30 and 70 then by generating 100 numbers 1..100, 30% will be lesser or equal 30 // and 70% will be greater than 30 (in theory). auto& prng = MWBase::Environment::get().getWorld()->getPrng(); - int chance = Misc::Rng::rollDice(100, prng) + 1; // 1..100 - int sum = 0; - int i = 0; - for (; static_cast(i) < mChances.size(); ++i) + unsigned int chance = static_cast(Misc::Rng::rollDice(100, prng) + 1); // 1..100 + unsigned int sum = 0; + for (size_t i = 0; i < mChances.size(); ++i) { sum += mChances[i]; if (chance <= sum) { - mWeather = i; + mWeather = static_cast(i); return; } } @@ -649,7 +627,7 @@ namespace MWWorld } } - void WeatherManager::modRegion(const ESM::RefId& regionID, const std::vector& chances) + void WeatherManager::modRegion(const ESM::RefId& regionID, const std::vector& chances) { // Sets the region's probability for various weather patterns. Note that this appears to be saved permanently. // In Morrowind, this seems to have the following behavior when applied to the current region: diff --git a/apps/openmw/mwworld/weather.hpp b/apps/openmw/mwworld/weather.hpp index 57c69cde11..65f926c096 100644 --- a/apps/openmw/mwworld/weather.hpp +++ b/apps/openmw/mwworld/weather.hpp @@ -230,7 +230,7 @@ namespace MWWorld operator ESM::RegionWeatherState() const; - void setChances(const std::vector& chances); + void setChances(const std::vector& chances); void setWeather(int weatherID); @@ -238,7 +238,7 @@ namespace MWWorld private: int mWeather; - std::vector mChances; + std::vector mChances; void chooseNewWeather(); }; @@ -286,7 +286,7 @@ namespace MWWorld * @param ID of the weather setting to shift to */ void changeWeather(const ESM::RefId& regionID, const unsigned int weatherID); - void modRegion(const ESM::RefId& regionID, const std::vector& chances); + void modRegion(const ESM::RefId& regionID, const std::vector& chances); void playerTeleported(const ESM::RefId& playerRegion, bool isExterior); /** diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index b9bf454895..5be1e52530 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1879,7 +1879,7 @@ namespace MWWorld mWeatherManager->changeWeather(region, id); } - void World::modRegion(const ESM::RefId& regionid, const std::vector& chances) + void World::modRegion(const ESM::RefId& regionid, const std::vector& chances) { mWeatherManager->modRegion(regionid, chances); } diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index 46043afe46..4b9a0ccb98 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -329,7 +329,7 @@ namespace MWWorld void setMoonColour(bool red) override; - void modRegion(const ESM::RefId& regionid, const std::vector& chances) override; + void modRegion(const ESM::RefId& regionid, const std::vector& chances) override; void changeToInteriorCell(const std::string_view cellName, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent = true) override; diff --git a/components/esm3/loadregn.cpp b/components/esm3/loadregn.cpp index 3411d49a7c..5148a446c2 100644 --- a/components/esm3/loadregn.cpp +++ b/components/esm3/loadregn.cpp @@ -27,15 +27,14 @@ namespace ESM { esm.getSubHeader(); // Cold weather not included before 1.3 - if (esm.getSubSize() == sizeof(mData)) + if (esm.getSubSize() == mData.mProbabilities.size()) { - esm.getTSized<10>(mData); + esm.getT(mData.mProbabilities); } - else if (esm.getSubSize() == sizeof(mData) - 2) + else if (esm.getSubSize() == mData.mProbabilities.size() - 2) { - mData.mSnow = 0; - mData.mBlizzard = 0; - esm.getExact(&mData, sizeof(mData) - 2); + mData.mProbabilities.fill(0); + esm.getExact(&mData.mProbabilities, esm.getSubSize()); } else { @@ -85,9 +84,9 @@ namespace ESM esm.writeHNOCString("FNAM", mName); if (esm.getVersion() == VER_12) - esm.writeHNT("WEAT", mData, sizeof(mData) - 2); + esm.writeHNT("WEAT", mData.mProbabilities, mData.mProbabilities.size() - 2); else - esm.writeHNT("WEAT", mData); + esm.writeHNT("WEAT", mData.mProbabilities); esm.writeHNOCRefId("BNAM", mSleepList); @@ -104,8 +103,7 @@ namespace ESM void Region::blank() { mRecordFlags = 0; - mData.mClear = mData.mCloudy = mData.mFoggy = mData.mOvercast = mData.mRain = mData.mThunder = mData.mAsh - = mData.mBlight = mData.mSnow = mData.mBlizzard = 0; + mData.mProbabilities.fill(0); mMapColor = 0; diff --git a/components/esm3/loadregn.hpp b/components/esm3/loadregn.hpp index 00c5546e2f..757566a360 100644 --- a/components/esm3/loadregn.hpp +++ b/components/esm3/loadregn.hpp @@ -1,6 +1,7 @@ #ifndef OPENMW_ESM_REGN_H #define OPENMW_ESM_REGN_H +#include #include #include @@ -24,26 +25,24 @@ namespace ESM /// Return a string descriptor for this record type. Currently used for debugging / error logs only. static std::string_view getRecordType() { return "Region"; } -#pragma pack(push) -#pragma pack(1) struct WEATstruct { // These are probabilities that add up to 100 - unsigned char mClear, mCloudy, mFoggy, mOvercast, mRain, mThunder, mAsh, mBlight, mSnow, mBlizzard; + // Clear, Cloudy, Foggy, Overcast, Rain, Thunder, Ash, Blight, Snow, Blizzard + std::array mProbabilities; }; // 10 bytes -#pragma pack(pop) // Reference to a sound that is played randomly in this region struct SoundRef { ESM::RefId mSound; - unsigned char mChance; + uint8_t mChance; }; WEATstruct mData; - int mMapColor; // RGBA + int32_t mMapColor; // RGBA - unsigned int mRecordFlags; + uint32_t mRecordFlags; // sleepList refers to a leveled list of creatures you can meet if // you sleep outside in this region. RefId mId, mSleepList; diff --git a/components/esm3/weatherstate.cpp b/components/esm3/weatherstate.cpp index 4c6896d37e..a7a10fe624 100644 --- a/components/esm3/weatherstate.cpp +++ b/components/esm3/weatherstate.cpp @@ -41,7 +41,7 @@ namespace ESM esm.getHNT(region.mWeather, regionWeatherRecord); while (esm.isNextSub(regionChanceRecord)) { - char chance; + uint8_t chance; esm.getHT(chance); region.mChances.push_back(chance); } @@ -66,9 +66,9 @@ namespace ESM { esm.writeHNCRefId(regionNameRecord, it->first); esm.writeHNT(regionWeatherRecord, it->second.mWeather); - for (size_t i = 0; i < it->second.mChances.size(); ++i) + for (const uint8_t& chance : it->second.mChances) { - esm.writeHNT(regionChanceRecord, it->second.mChances[i]); + esm.writeHNT(regionChanceRecord, chance); } } } diff --git a/components/esm3/weatherstate.hpp b/components/esm3/weatherstate.hpp index 3fad90ddb4..625ba0ba6e 100644 --- a/components/esm3/weatherstate.hpp +++ b/components/esm3/weatherstate.hpp @@ -13,8 +13,8 @@ namespace ESM struct RegionWeatherState { - int mWeather; - std::vector mChances; + int32_t mWeather; + std::vector mChances; }; struct WeatherState @@ -24,9 +24,9 @@ namespace ESM bool mFastForward; float mWeatherUpdateTime; float mTransitionFactor; - int mCurrentWeather; - int mNextWeather; - int mQueuedWeather; + int32_t mCurrentWeather; + int32_t mNextWeather; + int32_t mQueuedWeather; std::map mRegions; void load(ESMReader& esm); From fbafa13b3d3579ddf92481dd458ce0cea660529e Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Sat, 14 Oct 2023 17:01:55 +0200 Subject: [PATCH 3/3] Appease the compiler --- apps/opencs/model/world/nestedcoladapterimp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/opencs/model/world/nestedcoladapterimp.cpp b/apps/opencs/model/world/nestedcoladapterimp.cpp index 1f9958e84e..b96cf46465 100644 --- a/apps/opencs/model/world/nestedcoladapterimp.cpp +++ b/apps/opencs/model/world/nestedcoladapterimp.cpp @@ -1076,7 +1076,7 @@ namespace CSMWorld } else if (subColIndex == 1) { - if (subRowIndex >= 0 && subRowIndex < region.mData.mProbabilities.size()) + if (subRowIndex >= 0 && static_cast(subRowIndex) < region.mData.mProbabilities.size()) return region.mData.mProbabilities[subRowIndex]; }