From 3967509cdd11b3abf3aa1eca69f627492c1a0b2a Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Sun, 17 Jul 2022 19:54:59 +0200 Subject: [PATCH] Use meaningful names instead of pretending we don't know what snow is --- apps/esmtool/record.cpp | 4 ++-- apps/opencs/model/tools/regioncheck.cpp | 2 +- apps/opencs/model/world/nestedcoladapterimp.cpp | 8 ++++---- apps/openmw/mwworld/weather.cpp | 4 ++-- components/esm3/loadregn.cpp | 8 ++++---- components/esm3/loadregn.hpp | 6 +----- 6 files changed, 14 insertions(+), 18 deletions(-) diff --git a/apps/esmtool/record.cpp b/apps/esmtool/record.cpp index f9c3dea5d4..fbda7eee6b 100644 --- a/apps/esmtool/record.cpp +++ b/apps/esmtool/record.cpp @@ -1184,8 +1184,8 @@ void Record::print() 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 << " UnknownA: " << (int)mData.mData.mA << std::endl; - std::cout << " UnknownB: " << (int)mData.mData.mB << std::endl; + std::cout << " Snow: " << (int)mData.mData.mSnow << std::endl; + std::cout << " Blizzard: " << (int)mData.mData.mBlizzard << 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 27a73be93d..127281f5d9 100644 --- a/apps/opencs/model/tools/regioncheck.cpp +++ b/apps/opencs/model/tools/regioncheck.cpp @@ -38,7 +38,7 @@ void CSMTools::RegionCheckStage::perform (int stage, CSMDoc::Messages& messages) // 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.mA + region.mData.mB; + region.mData.mSnow + region.mData.mBlizzard; 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 08a23f4410..131c71d5a0 100644 --- a/apps/opencs/model/world/nestedcoladapterimp.cpp +++ b/apps/opencs/model/world/nestedcoladapterimp.cpp @@ -1059,8 +1059,8 @@ namespace CSMWorld case 5: return region.mData.mThunder; case 6: return region.mData.mAsh; case 7: return region.mData.mBlight; - case 8: return region.mData.mA; // Snow - case 9: return region.mData.mB; // Blizzard + case 8: return region.mData.mSnow; + case 9: return region.mData.mBlizzard; default: break; } } @@ -1086,8 +1086,8 @@ namespace CSMWorld 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.mA = chance; break; - case 9: region.mData.mB = 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"); } diff --git a/apps/openmw/mwworld/weather.cpp b/apps/openmw/mwworld/weather.cpp index 062796e914..95b1c69ae1 100644 --- a/apps/openmw/mwworld/weather.cpp +++ b/apps/openmw/mwworld/weather.cpp @@ -286,8 +286,8 @@ namespace mChances.push_back(region.mData.mThunder); mChances.push_back(region.mData.mAsh); mChances.push_back(region.mData.mBlight); - mChances.push_back(region.mData.mA); - mChances.push_back(region.mData.mB); + mChances.push_back(region.mData.mSnow); + mChances.push_back(region.mData.mBlizzard); } RegionWeather::RegionWeather(const ESM::RegionWeatherState& state) diff --git a/components/esm3/loadregn.cpp b/components/esm3/loadregn.cpp index 54f722f89a..9de89d1889 100644 --- a/components/esm3/loadregn.cpp +++ b/components/esm3/loadregn.cpp @@ -26,15 +26,15 @@ namespace ESM case fourCC("WEAT"): { esm.getSubHeader(); - // May include the additional two bytes (but not necessarily) + // Cold weather not included before 1.3 if (esm.getSubSize() == sizeof(mData)) { esm.getT(mData); } else if (esm.getSubSize() == sizeof(mData) - 2) { - mData.mA = 0; - mData.mB = 0; + mData.mSnow = 0; + mData.mBlizzard = 0; esm.getExact(&mData, sizeof(mData) - 2); } else @@ -105,7 +105,7 @@ namespace ESM { mRecordFlags = 0; mData.mClear = mData.mCloudy = mData.mFoggy = mData.mOvercast = mData.mRain = - mData.mThunder = mData.mAsh = mData.mBlight = mData.mA = mData.mB = 0; + mData.mThunder = mData.mAsh = mData.mBlight = mData.mSnow = mData.mBlizzard = 0; mMapColor = 0; diff --git a/components/esm3/loadregn.hpp b/components/esm3/loadregn.hpp index e47c30d2d2..555b5e1b8d 100644 --- a/components/esm3/loadregn.hpp +++ b/components/esm3/loadregn.hpp @@ -29,11 +29,7 @@ struct Region struct WEATstruct { // These are probabilities that add up to 100 - unsigned char mClear, mCloudy, mFoggy, mOvercast, mRain, mThunder, mAsh, mBlight, - // Unknown weather, probably snow and something. Only - // present in file version 1.3. - // the engine uses mA as "snow" and mB as "blizard" - mA, mB; + unsigned char mClear, mCloudy, mFoggy, mOvercast, mRain, mThunder, mAsh, mBlight, mSnow, mBlizzard; }; // 10 bytes #pragma pack(pop)