mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 13:26:44 +00:00 
			
		
		
		
	Add a separate method to check whether a record is deleted or not for IdCollection
This commit is contained in:
		
							parent
							
								
									5fd48efd28
								
							
						
					
					
						commit
						a4d3e59e5c
					
				
					 6 changed files with 52 additions and 22 deletions
				
			
		
							
								
								
									
										3
									
								
								apps/opencs/model/world/idcollection.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								apps/opencs/model/world/idcollection.cpp
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,3 @@
 | 
				
			||||||
 | 
					#include "idcollection.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,9 +2,9 @@
 | 
				
			||||||
#define CSM_WOLRD_IDCOLLECTION_H
 | 
					#define CSM_WOLRD_IDCOLLECTION_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <components/esm/esmreader.hpp>
 | 
					#include <components/esm/esmreader.hpp>
 | 
				
			||||||
#include <components/esm/util.hpp>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "collection.hpp"
 | 
					#include "collection.hpp"
 | 
				
			||||||
 | 
					#include "record.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace CSMWorld
 | 
					namespace CSMWorld
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -48,7 +48,7 @@ namespace CSMWorld
 | 
				
			||||||
        std::string id = IdAccessorT().getId (record);
 | 
					        std::string id = IdAccessorT().getId (record);
 | 
				
			||||||
        int index = searchId (id);
 | 
					        int index = searchId (id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (ESM::isRecordDeleted (record))
 | 
					        if (isRecordDeleted(record))
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (index==-1)
 | 
					            if (index==-1)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,7 +4,6 @@
 | 
				
			||||||
#include <string>
 | 
					#include <string>
 | 
				
			||||||
#include <boost/shared_ptr.hpp>
 | 
					#include <boost/shared_ptr.hpp>
 | 
				
			||||||
#include <components/esm/loadland.hpp>
 | 
					#include <components/esm/loadland.hpp>
 | 
				
			||||||
#include <components/esm/util.hpp>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace CSMWorld
 | 
					namespace CSMWorld
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -27,13 +26,4 @@ namespace CSMWorld
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace ESM
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    template <>
 | 
					 | 
				
			||||||
    bool isRecordDeleted<CSMWorld::Land>(const CSMWorld::Land &land)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return false;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,7 +5,6 @@
 | 
				
			||||||
#include <string>
 | 
					#include <string>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <components/esm/loadpgrd.hpp>
 | 
					#include <components/esm/loadpgrd.hpp>
 | 
				
			||||||
#include <components/esm/util.hpp>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace CSMWorld
 | 
					namespace CSMWorld
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -27,13 +26,4 @@ namespace CSMWorld
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace ESM
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    template <>
 | 
					 | 
				
			||||||
    bool isRecordDeleted<CSMWorld::Pathgrid>(const CSMWorld::Pathgrid &pgrd)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return false;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,3 +19,27 @@ bool CSMWorld::RecordBase::isModified() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return mState==State_Modified || mState==State_ModifiedOnly;
 | 
					    return mState==State_Modified || mState==State_ModifiedOnly;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					template<>
 | 
				
			||||||
 | 
					bool CSMWorld::isRecordDeleted(const CSMWorld::Land &land)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return land.mLand->mIsDeleted;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					template<>
 | 
				
			||||||
 | 
					bool CSMWorld::isRecordDeleted(const ESM::GameSetting &setting)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					template<>
 | 
				
			||||||
 | 
					bool CSMWorld::isRecordDeleted(const ESM::MagicEffect &effect)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					template<>
 | 
				
			||||||
 | 
					bool CSMWorld::isRecordDeleted(const ESM::Skill &skill)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,6 +3,12 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdexcept>
 | 
					#include <stdexcept>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <components/esm/loadgmst.hpp>
 | 
				
			||||||
 | 
					#include <components/esm/loadmgef.hpp>
 | 
				
			||||||
 | 
					#include <components/esm/loadskil.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "land.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace CSMWorld
 | 
					namespace CSMWorld
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    struct RecordBase
 | 
					    struct RecordBase
 | 
				
			||||||
| 
						 | 
					@ -154,6 +160,23 @@ namespace CSMWorld
 | 
				
			||||||
            mState = State_Erased;
 | 
					            mState = State_Erased;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Not all records can be deleted (may be changed in the future), 
 | 
				
			||||||
 | 
					    // so we need to use a separate method to check whether a record is deleted or not.
 | 
				
			||||||
 | 
					    template<typename ESXRecordT>
 | 
				
			||||||
 | 
					    bool isRecordDeleted(const ESXRecordT &record)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return record.mIsDeleted;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    template<>
 | 
				
			||||||
 | 
					    bool isRecordDeleted(const Land &land);
 | 
				
			||||||
 | 
					    template<>
 | 
				
			||||||
 | 
					    bool isRecordDeleted(const ESM::GameSetting &setting);
 | 
				
			||||||
 | 
					    template<>
 | 
				
			||||||
 | 
					    bool isRecordDeleted(const ESM::MagicEffect &effect);
 | 
				
			||||||
 | 
					    template<>
 | 
				
			||||||
 | 
					    bool isRecordDeleted(const ESM::Skill &skill);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue