@ -2,6 +2,8 @@
# include <components/misc/stringops.hpp>
# include "../prefs/state.hpp"
# include "../world/record.hpp"
# include "../world/universalid.hpp"
@ -18,6 +20,7 @@ CSMTools::ReferenceableCheckStage::ReferenceableCheckStage(
mScripts ( scripts ) ,
mPlayerPresent ( false )
{
mIgnoreBaseRecords = CSMPrefs : : get ( ) [ " Reports " ] [ " ignore-base-records " ] . isTrue ( ) ;
}
void CSMTools : : ReferenceableCheckStage : : perform ( int stage , CSMDoc : : Messages & messages )
@ -228,6 +231,8 @@ void CSMTools::ReferenceableCheckStage::perform (int stage, CSMDoc::Messages& me
int CSMTools : : ReferenceableCheckStage : : setup ( )
{
mPlayerPresent = false ;
mIgnoreBaseRecords = CSMPrefs : : get ( ) [ " Reports " ] [ " ignore-base-records " ] . isTrue ( ) ;
return mReferencables . getSize ( ) + 1 ;
}
@ -238,7 +243,8 @@ void CSMTools::ReferenceableCheckStage::bookCheck(
{
const CSMWorld : : RecordBase & baseRecord = records . getRecord ( stage ) ;
if ( baseRecord . isDeleted ( ) )
// Skip "Base" records (setting!) and "Deleted" records
if ( ( mIgnoreBaseRecords & & baseRecord . isBaseOnly ( ) ) | | baseRecord . isDeleted ( ) )
return ;
const ESM : : Book & book = ( dynamic_cast < const CSMWorld : : Record < ESM : : Book > & > ( baseRecord ) ) . get ( ) ;
@ -257,7 +263,8 @@ void CSMTools::ReferenceableCheckStage::activatorCheck(
{
const CSMWorld : : RecordBase & baseRecord = records . getRecord ( stage ) ;
if ( baseRecord . isDeleted ( ) )
// Skip "Base" records (setting!) and "Deleted" records
if ( ( mIgnoreBaseRecords & & baseRecord . isBaseOnly ( ) ) | | baseRecord . isDeleted ( ) )
return ;
const ESM : : Activator & activator = ( dynamic_cast < const CSMWorld : : Record < ESM : : Activator > & > ( baseRecord ) ) . get ( ) ;
@ -278,7 +285,8 @@ void CSMTools::ReferenceableCheckStage::potionCheck(
{
const CSMWorld : : RecordBase & baseRecord = records . getRecord ( stage ) ;
if ( baseRecord . isDeleted ( ) )
// Skip "Base" records (setting!) and "Deleted" records
if ( ( mIgnoreBaseRecords & & baseRecord . isBaseOnly ( ) ) | | baseRecord . isDeleted ( ) )
return ;
const ESM : : Potion & potion = ( dynamic_cast < const CSMWorld : : Record < ESM : : Potion > & > ( baseRecord ) ) . get ( ) ;
@ -299,7 +307,8 @@ void CSMTools::ReferenceableCheckStage::apparatusCheck(
{
const CSMWorld : : RecordBase & baseRecord = records . getRecord ( stage ) ;
if ( baseRecord . isDeleted ( ) )
// Skip "Base" records (setting!) and "Deleted" records
if ( ( mIgnoreBaseRecords & & baseRecord . isBaseOnly ( ) ) | | baseRecord . isDeleted ( ) )
return ;
const ESM : : Apparatus & apparatus = ( dynamic_cast < const CSMWorld : : Record < ESM : : Apparatus > & > ( baseRecord ) ) . get ( ) ;
@ -320,7 +329,8 @@ void CSMTools::ReferenceableCheckStage::armorCheck(
{
const CSMWorld : : RecordBase & baseRecord = records . getRecord ( stage ) ;
if ( baseRecord . isDeleted ( ) )
// Skip "Base" records (setting!) and "Deleted" records
if ( ( mIgnoreBaseRecords & & baseRecord . isBaseOnly ( ) ) | | baseRecord . isDeleted ( ) )
return ;
const ESM : : Armor & armor = ( dynamic_cast < const CSMWorld : : Record < ESM : : Armor > & > ( baseRecord ) ) . get ( ) ;
@ -347,7 +357,8 @@ void CSMTools::ReferenceableCheckStage::clothingCheck(
{
const CSMWorld : : RecordBase & baseRecord = records . getRecord ( stage ) ;
if ( baseRecord . isDeleted ( ) )
// Skip "Base" records (setting!) and "Deleted" records
if ( ( mIgnoreBaseRecords & & baseRecord . isBaseOnly ( ) ) | | baseRecord . isDeleted ( ) )
return ;
const ESM : : Clothing & clothing = ( dynamic_cast < const CSMWorld : : Record < ESM : : Clothing > & > ( baseRecord ) ) . get ( ) ;
@ -365,7 +376,8 @@ void CSMTools::ReferenceableCheckStage::containerCheck(
{
const CSMWorld : : RecordBase & baseRecord = records . getRecord ( stage ) ;
if ( baseRecord . isDeleted ( ) )
// Skip "Base" records (setting!) and "Deleted" records
if ( ( mIgnoreBaseRecords & & baseRecord . isBaseOnly ( ) ) | | baseRecord . isDeleted ( ) )
return ;
const ESM : : Container & container = ( dynamic_cast < const CSMWorld : : Record < ESM : : Container > & > ( baseRecord ) ) . get ( ) ;
@ -397,7 +409,8 @@ void CSMTools::ReferenceableCheckStage::creatureCheck (
{
const CSMWorld : : RecordBase & baseRecord = records . getRecord ( stage ) ;
if ( baseRecord . isDeleted ( ) )
// Skip "Base" records (setting!) and "Deleted" records
if ( ( mIgnoreBaseRecords & & baseRecord . isBaseOnly ( ) ) | | baseRecord . isDeleted ( ) )
return ;
const ESM : : Creature & creature = ( dynamic_cast < const CSMWorld : : Record < ESM : : Creature > & > ( baseRecord ) ) . get ( ) ;
@ -473,7 +486,8 @@ void CSMTools::ReferenceableCheckStage::doorCheck(
{
const CSMWorld : : RecordBase & baseRecord = records . getRecord ( stage ) ;
if ( baseRecord . isDeleted ( ) )
// Skip "Base" records (setting!) and "Deleted" records
if ( ( mIgnoreBaseRecords & & baseRecord . isBaseOnly ( ) ) | | baseRecord . isDeleted ( ) )
return ;
const ESM : : Door & door = ( dynamic_cast < const CSMWorld : : Record < ESM : : Door > & > ( baseRecord ) ) . get ( ) ;
@ -497,7 +511,8 @@ void CSMTools::ReferenceableCheckStage::ingredientCheck(
{
const CSMWorld : : RecordBase & baseRecord = records . getRecord ( stage ) ;
if ( baseRecord . isDeleted ( ) )
// Skip "Base" records (setting!) and "Deleted" records
if ( ( mIgnoreBaseRecords & & baseRecord . isBaseOnly ( ) ) | | baseRecord . isDeleted ( ) )
return ;
const ESM : : Ingredient & ingredient = ( dynamic_cast < const CSMWorld : : Record < ESM : : Ingredient > & > ( baseRecord ) ) . get ( ) ;
@ -516,10 +531,9 @@ void CSMTools::ReferenceableCheckStage::creaturesLevListCheck(
{
const CSMWorld : : RecordBase & baseRecord = records . getRecord ( stage ) ;
if ( baseRecord . isDeleted ( ) )
{
// Skip "Base" records (setting!) and "Deleted" records
if ( ( mIgnoreBaseRecords & & baseRecord . isBaseOnly ( ) ) | | baseRecord . isDeleted ( ) )
return ;
}
const ESM : : CreatureLevList & CreatureLevList = ( dynamic_cast < const CSMWorld : : Record < ESM : : CreatureLevList > & > ( baseRecord ) ) . get ( ) ;
CSMWorld : : UniversalId id ( CSMWorld : : UniversalId : : Type_CreatureLevelledList , CreatureLevList . mId ) ; //CreatureLevList but Type_CreatureLevelledList :/
@ -534,10 +548,9 @@ void CSMTools::ReferenceableCheckStage::itemLevelledListCheck(
{
const CSMWorld : : RecordBase & baseRecord = records . getRecord ( stage ) ;
if ( baseRecord . isDeleted ( ) )
{
// Skip "Base" records (setting!) and "Deleted" records
if ( ( mIgnoreBaseRecords & & baseRecord . isBaseOnly ( ) ) | | baseRecord . isDeleted ( ) )
return ;
}
const ESM : : ItemLevList & ItemLevList = ( dynamic_cast < const CSMWorld : : Record < ESM : : ItemLevList > & > ( baseRecord ) ) . get ( ) ;
CSMWorld : : UniversalId id ( CSMWorld : : UniversalId : : Type_ItemLevelledList , ItemLevList . mId ) ;
@ -551,7 +564,8 @@ void CSMTools::ReferenceableCheckStage::lightCheck(
{
const CSMWorld : : RecordBase & baseRecord = records . getRecord ( stage ) ;
if ( baseRecord . isDeleted ( ) )
// Skip "Base" records (setting!) and "Deleted" records
if ( ( mIgnoreBaseRecords & & baseRecord . isBaseOnly ( ) ) | | baseRecord . isDeleted ( ) )
return ;
const ESM : : Light & light = ( dynamic_cast < const CSMWorld : : Record < ESM : : Light > & > ( baseRecord ) ) . get ( ) ;
@ -574,7 +588,8 @@ void CSMTools::ReferenceableCheckStage::lockpickCheck(
{
const CSMWorld : : RecordBase & baseRecord = records . getRecord ( stage ) ;
if ( baseRecord . isDeleted ( ) )
// Skip "Base" records (setting!) and "Deleted" records
if ( ( mIgnoreBaseRecords & & baseRecord . isBaseOnly ( ) ) | | baseRecord . isDeleted ( ) )
return ;
const ESM : : Lockpick & lockpick = ( dynamic_cast < const CSMWorld : : Record < ESM : : Lockpick > & > ( baseRecord ) ) . get ( ) ;
@ -595,7 +610,8 @@ void CSMTools::ReferenceableCheckStage::miscCheck(
{
const CSMWorld : : RecordBase & baseRecord = records . getRecord ( stage ) ;
if ( baseRecord . isDeleted ( ) )
// Skip "Base" records (setting!) and "Deleted" records
if ( ( mIgnoreBaseRecords & & baseRecord . isBaseOnly ( ) ) | | baseRecord . isDeleted ( ) )
return ;
const ESM : : Miscellaneous & miscellaneous = ( dynamic_cast < const CSMWorld : : Record < ESM : : Miscellaneous > & > ( baseRecord ) ) . get ( ) ;
@ -619,6 +635,14 @@ void CSMTools::ReferenceableCheckStage::npcCheck (
const ESM : : NPC & npc = ( dynamic_cast < const CSMWorld : : Record < ESM : : NPC > & > ( baseRecord ) ) . get ( ) ;
CSMWorld : : UniversalId id ( CSMWorld : : UniversalId : : Type_Npc , npc . mId ) ;
//Detect if player is present
if ( Misc : : StringUtils : : ciEqual ( npc . mId , " player " ) ) //Happy now, scrawl?
mPlayerPresent = true ;
// Skip "Base" records (setting!)
if ( mIgnoreBaseRecords & & baseRecord . isBaseOnly ( ) )
return ;
short level ( npc . mNpdt . mLevel ) ;
char disposition ( npc . mNpdt . mDisposition ) ;
char reputation ( npc . mNpdt . mReputation ) ;
@ -626,10 +650,6 @@ void CSMTools::ReferenceableCheckStage::npcCheck (
//Don't know what unknown is for
int gold ( npc . mNpdt . mGold ) ;
//Detect if player is present
if ( Misc : : StringUtils : : ciEqual ( npc . mId , " player " ) ) //Happy now, scrawl?
mPlayerPresent = true ;
if ( npc . mNpdtType = = ESM : : NPC : : NPC_WITH_AUTOCALCULATED_STATS ) //12 = autocalculated
{
if ( ( npc . mFlags & ESM : : NPC : : Autocalc ) = = 0 ) //0x0010 = autocalculated flag
@ -728,7 +748,8 @@ void CSMTools::ReferenceableCheckStage::weaponCheck(
{
const CSMWorld : : RecordBase & baseRecord = records . getRecord ( stage ) ;
if ( baseRecord . isDeleted ( ) )
// Skip "Base" records (setting!) and "Deleted" records
if ( ( mIgnoreBaseRecords & & baseRecord . isBaseOnly ( ) ) | | baseRecord . isDeleted ( ) )
return ;
const ESM : : Weapon & weapon = ( dynamic_cast < const CSMWorld : : Record < ESM : : Weapon > & > ( baseRecord ) ) . get ( ) ;
@ -808,7 +829,8 @@ void CSMTools::ReferenceableCheckStage::probeCheck(
{
const CSMWorld : : RecordBase & baseRecord = records . getRecord ( stage ) ;
if ( baseRecord . isDeleted ( ) )
// Skip "Base" records (setting!) and "Deleted" records
if ( ( mIgnoreBaseRecords & & baseRecord . isBaseOnly ( ) ) | | baseRecord . isDeleted ( ) )
return ;
const ESM : : Probe & probe = ( dynamic_cast < const CSMWorld : : Record < ESM : : Probe > & > ( baseRecord ) ) . get ( ) ;
@ -827,7 +849,8 @@ void CSMTools::ReferenceableCheckStage::repairCheck (
{
const CSMWorld : : RecordBase & baseRecord = records . getRecord ( stage ) ;
if ( baseRecord . isDeleted ( ) )
// Skip "Base" records (setting!) and "Deleted" records
if ( ( mIgnoreBaseRecords & & baseRecord . isBaseOnly ( ) ) | | baseRecord . isDeleted ( ) )
return ;
const ESM : : Repair & repair = ( dynamic_cast < const CSMWorld : : Record < ESM : : Repair > & > ( baseRecord ) ) . get ( ) ;
@ -846,7 +869,8 @@ void CSMTools::ReferenceableCheckStage::staticCheck (
{
const CSMWorld : : RecordBase & baseRecord = records . getRecord ( stage ) ;
if ( baseRecord . isDeleted ( ) )
// Skip "Base" records (setting!) and "Deleted" records
if ( ( mIgnoreBaseRecords & & baseRecord . isBaseOnly ( ) ) | | baseRecord . isDeleted ( ) )
return ;
const ESM : : Static & staticElement = ( dynamic_cast < const CSMWorld : : Record < ESM : : Static > & > ( baseRecord ) ) . get ( ) ;