mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-09 12:42:11 +00:00
20da0892ef
Slowly moving through the open-cs errors Good progress in openCS Very good progress on openCS Getting closer with openCS OpenCS compiles and runs! Didn't have time to test it all though ix openMW everything compiles on windows?? Fix gcc Fix Clang
65 lines
2.1 KiB
C++
65 lines
2.1 KiB
C++
#include "regioncheck.hpp"
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "../prefs/state.hpp"
|
|
|
|
#include "../world/universalid.hpp"
|
|
|
|
#include <apps/opencs/model/doc/messages.hpp>
|
|
#include <apps/opencs/model/prefs/category.hpp>
|
|
#include <apps/opencs/model/prefs/setting.hpp>
|
|
#include <apps/opencs/model/world/idcollection.hpp>
|
|
#include <apps/opencs/model/world/record.hpp>
|
|
|
|
#include <components/esm3/loadregn.hpp>
|
|
|
|
CSMTools::RegionCheckStage::RegionCheckStage(const CSMWorld::IdCollection<ESM::Region>& regions)
|
|
: mRegions(regions)
|
|
{
|
|
mIgnoreBaseRecords = false;
|
|
}
|
|
|
|
int CSMTools::RegionCheckStage::setup()
|
|
{
|
|
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
|
|
|
return mRegions.getSize();
|
|
}
|
|
|
|
void CSMTools::RegionCheckStage::perform(int stage, CSMDoc::Messages& messages)
|
|
{
|
|
const CSMWorld::Record<ESM::Region>& record = mRegions.getRecord(stage);
|
|
|
|
// Skip "Base" records (setting!) and "Deleted" records
|
|
if ((mIgnoreBaseRecords && record.mState == CSMWorld::RecordBase::State_BaseOnly) || record.isDeleted())
|
|
return;
|
|
|
|
const ESM::Region& region = record.get();
|
|
|
|
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_Region, region.mId);
|
|
|
|
// test for empty name
|
|
if (region.mName.empty())
|
|
messages.add(id, "Name is missing", "", CSMDoc::Message::Severity_Error);
|
|
|
|
/// \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;
|
|
if (chances != 100)
|
|
messages.add(id, "Weather chances do not add up to 100", "", CSMDoc::Message::Severity_Error);
|
|
|
|
for (const ESM::Region::SoundRef& sound : region.mSoundList)
|
|
{
|
|
if (sound.mChance > 100)
|
|
messages.add(id, "Chance of '" + sound.mSound.getRefIdString() + "' sound to play is over 100 percent", "",
|
|
CSMDoc::Message::Severity_Warning);
|
|
}
|
|
|
|
/// \todo check data members that can't be edited in the table view
|
|
}
|