mirror of
				https://github.com/TES3MP/openmw-tes3mp.git
				synced 2025-10-31 20:56:42 +00:00 
			
		
		
		
	add skill records when creating a new base file
This commit is contained in:
		
							parent
							
								
									4208d52b1a
								
							
						
					
					
						commit
						114f99ddbf
					
				
					 5 changed files with 45 additions and 13 deletions
				
			
		|  | @ -198,6 +198,16 @@ void CSMDoc::Document::createBase() | |||
|     } | ||||
| 
 | ||||
|     /// \todo add GMSTs
 | ||||
| 
 | ||||
|     for (int i=0; i<27; ++i) | ||||
|     { | ||||
|         ESM::Skill record; | ||||
|         record.mIndex = i; | ||||
|         record.mId = ESM::Skill::getIndexToId (record.mIndex); | ||||
|         record.blank(); | ||||
| 
 | ||||
|         getData().getSkills().add (record); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| CSMDoc::Document::Document (const std::vector<boost::filesystem::path>& files, bool new_) | ||||
|  |  | |||
|  | @ -74,6 +74,16 @@ CSMWorld::IdCollection<ESM::GameSetting>& CSMWorld::Data::getGmsts() | |||
|     return mGmsts; | ||||
| } | ||||
| 
 | ||||
| const CSMWorld::IdCollection<ESM::Skill>& CSMWorld::Data::getSkills() const | ||||
| { | ||||
|     return mSkills; | ||||
| } | ||||
| 
 | ||||
| CSMWorld::IdCollection<ESM::Skill>& CSMWorld::Data::getSkills() | ||||
| { | ||||
|     return mSkills; | ||||
| } | ||||
| 
 | ||||
| QAbstractItemModel *CSMWorld::Data::getTableModel (const UniversalId& id) | ||||
| { | ||||
|     std::map<UniversalId::Type, QAbstractItemModel *>::iterator iter = mModelIndex.find (id.getType()); | ||||
|  |  | |||
|  | @ -46,6 +46,10 @@ namespace CSMWorld | |||
| 
 | ||||
|             IdCollection<ESM::GameSetting>& getGmsts(); | ||||
| 
 | ||||
|             const IdCollection<ESM::Skill>& getSkills() const; | ||||
| 
 | ||||
|             IdCollection<ESM::Skill>& getSkills(); | ||||
| 
 | ||||
|             QAbstractItemModel *getTableModel (const UniversalId& id); | ||||
|             ///< If no table model is available for \a id, an exception is thrown.
 | ||||
|             ///
 | ||||
|  |  | |||
|  | @ -103,19 +103,7 @@ void Skill::load(ESMReader &esm) | |||
| 
 | ||||
|     // create an ID from the index and the name (only used in the editor and likely to change in the
 | ||||
|     // future)
 | ||||
|     std::ostringstream stream; | ||||
| 
 | ||||
|     stream << "#"; | ||||
| 
 | ||||
|     if (mIndex<10) | ||||
|         stream << "0"; | ||||
| 
 | ||||
|     stream << mIndex; | ||||
| 
 | ||||
|     if (mIndex>=0 && mIndex<Length) | ||||
|         stream << sSkillNameIds[mIndex].substr (6); | ||||
| 
 | ||||
|     mId = stream.str(); | ||||
|     mId = getIndexToId (mIndex); | ||||
| } | ||||
| void Skill::save(ESMWriter &esm) | ||||
| { | ||||
|  | @ -129,5 +117,23 @@ void Skill::save(ESMWriter &esm) | |||
|         mData.mAttribute = 0; | ||||
|         mData.mSpecialization = 0; | ||||
|         mData.mUseValue[0] = mData.mUseValue[1] = mData.mUseValue[2] = mData.mUseValue[3] = 1.0; | ||||
|         mDescription.clear(); | ||||
|     } | ||||
| 
 | ||||
|     std::string Skill::getIndexToId (int index) | ||||
|     { | ||||
|         std::ostringstream stream; | ||||
| 
 | ||||
|         stream << "#"; | ||||
| 
 | ||||
|         if (index<10) | ||||
|             stream << "0"; | ||||
| 
 | ||||
|         stream << index; | ||||
| 
 | ||||
|         if (index>=0 && index<Length) | ||||
|             stream << sSkillNameIds[index].substr (6); | ||||
| 
 | ||||
|         return stream.str(); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -78,6 +78,8 @@ struct Skill | |||
| 
 | ||||
|     void blank(); | ||||
|      ///< Set record to default state (does not touch the ID/index).
 | ||||
| 
 | ||||
|     static std::string getIndexToId (int index); | ||||
| }; | ||||
| } | ||||
| #endif | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue