mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-30 02:56:44 +00:00 
			
		
		
		
	Merge branch 'gmstfixing' into next
This commit is contained in:
		
						commit
						0713afb97d
					
				
					 4 changed files with 153 additions and 0 deletions
				
			
		|  | @ -18,6 +18,136 @@ void CSMDoc::Document::load (const std::vector<boost::filesystem::path>::const_i | ||||||
| 
 | 
 | ||||||
|     if (lastAsModified) |     if (lastAsModified) | ||||||
|         getData().loadFile (*end2, false); |         getData().loadFile (*end2, false); | ||||||
|  | 
 | ||||||
|  |     addOptionalGmsts(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void CSMDoc::Document::addOptionalGmsts() | ||||||
|  | { | ||||||
|  |     static const char *sFloats[] = | ||||||
|  |     { | ||||||
|  |         "fCombatDistanceWerewolfMod", | ||||||
|  |         "fFleeDistance", | ||||||
|  |         "fWereWolfAcrobatics", | ||||||
|  |         "fWereWolfAgility", | ||||||
|  |         "fWereWolfAlchemy", | ||||||
|  |         "fWereWolfAlteration", | ||||||
|  |         "fWereWolfArmorer", | ||||||
|  |         "fWereWolfAthletics", | ||||||
|  |         "fWereWolfAxe", | ||||||
|  |         "fWereWolfBlock", | ||||||
|  |         "fWereWolfBluntWeapon", | ||||||
|  |         "fWereWolfConjuration", | ||||||
|  |         "fWereWolfDestruction", | ||||||
|  |         "fWereWolfEnchant", | ||||||
|  |         "fWereWolfEndurance", | ||||||
|  |         "fWereWolfFatigue", | ||||||
|  |         "fWereWolfHandtoHand", | ||||||
|  |         "fWereWolfHealth", | ||||||
|  |         "fWereWolfHeavyArmor", | ||||||
|  |         "fWereWolfIllusion", | ||||||
|  |         "fWereWolfIntellegence", | ||||||
|  |         "fWereWolfLightArmor", | ||||||
|  |         "fWereWolfLongBlade", | ||||||
|  |         "fWereWolfLuck", | ||||||
|  |         "fWereWolfMagicka", | ||||||
|  |         "fWereWolfMarksman", | ||||||
|  |         "fWereWolfMediumArmor", | ||||||
|  |         "fWereWolfMerchantile", | ||||||
|  |         "fWereWolfMysticism", | ||||||
|  |         "fWereWolfPersonality", | ||||||
|  |         "fWereWolfRestoration", | ||||||
|  |         "fWereWolfRunMult", | ||||||
|  |         "fWereWolfSecurity", | ||||||
|  |         "fWereWolfShortBlade", | ||||||
|  |         "fWereWolfSilverWeaponDamageMult", | ||||||
|  |         "fWereWolfSneak", | ||||||
|  |         "fWereWolfSpear", | ||||||
|  |         "fWereWolfSpeechcraft", | ||||||
|  |         "fWereWolfSpeed", | ||||||
|  |         "fWereWolfStrength", | ||||||
|  |         "fWereWolfUnarmored", | ||||||
|  |         "fWereWolfWillPower", | ||||||
|  |         0 | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     static const char *sIntegers[] = | ||||||
|  |     { | ||||||
|  |         "iWereWolfBounty", | ||||||
|  |         "iWereWolfFightMod", | ||||||
|  |         "iWereWolfFleeMod", | ||||||
|  |         "iWereWolfLevelToAttack", | ||||||
|  |         0 | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     static const char *sStrings[] = | ||||||
|  |     { | ||||||
|  |         "sCompanionShare", | ||||||
|  |         "sCompanionWarningButtonOne", | ||||||
|  |         "sCompanionWarningButtonTwo", | ||||||
|  |         "sCompanionWarningMessage", | ||||||
|  |         "sDeleteNote", | ||||||
|  |         "sEditNote", | ||||||
|  |         "sEffectSummonCreature01", | ||||||
|  |         "sEffectSummonCreature02", | ||||||
|  |         "sEffectSummonCreature03", | ||||||
|  |         "sEffectSummonCreature04", | ||||||
|  |         "sEffectSummonCreature05", | ||||||
|  |         "sEffectSummonFabricant", | ||||||
|  |         "sLevitateDisabled", | ||||||
|  |         "sMagicCreature01ID", | ||||||
|  |         "sMagicCreature02ID", | ||||||
|  |         "sMagicCreature03ID", | ||||||
|  |         "sMagicCreature04ID", | ||||||
|  |         "sMagicCreature05ID", | ||||||
|  |         "sMagicFabricantID", | ||||||
|  |         "sMaxSale", | ||||||
|  |         "sProfitValue", | ||||||
|  |         "sTeleportDisabled", | ||||||
|  |         "sWerewolfAlarmMessage", | ||||||
|  |         "sWerewolfPopup", | ||||||
|  |         "sWerewolfRefusal", | ||||||
|  |         "sWerewolfRestMessage", | ||||||
|  |         0 | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     for (int i=0; sFloats[i]; ++i) | ||||||
|  |     { | ||||||
|  |         ESM::GameSetting gmst; | ||||||
|  |         gmst.mId = sFloats[i]; | ||||||
|  |         gmst.mF = 0; | ||||||
|  |         gmst.mType = ESM::VT_Float; | ||||||
|  |         addOptionalGmst (gmst); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     for (int i=0; sIntegers[i]; ++i) | ||||||
|  |     { | ||||||
|  |         ESM::GameSetting gmst; | ||||||
|  |         gmst.mId = sIntegers[i]; | ||||||
|  |         gmst.mI = 0; | ||||||
|  |         gmst.mType = ESM::VT_Long; | ||||||
|  |         addOptionalGmst (gmst); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     for (int i=0; sStrings[i]; ++i) | ||||||
|  |     { | ||||||
|  |         ESM::GameSetting gmst; | ||||||
|  |         gmst.mId = sStrings[i]; | ||||||
|  |         gmst.mStr = "<no text>"; | ||||||
|  |         gmst.mType = ESM::VT_String; | ||||||
|  |         addOptionalGmst (gmst); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void CSMDoc::Document::addOptionalGmst (const ESM::GameSetting& gmst) | ||||||
|  | { | ||||||
|  |     if (getData().getGmsts().searchId (gmst.mId)==-1) | ||||||
|  |     { | ||||||
|  |         CSMWorld::Record<ESM::GameSetting> record; | ||||||
|  |         record.mBase = gmst; | ||||||
|  |         record.mState = CSMWorld::RecordBase::State_BaseOnly; | ||||||
|  |         getData().getGmsts().appendRecord (record); | ||||||
|  |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void CSMDoc::Document::createBase() | void CSMDoc::Document::createBase() | ||||||
|  |  | ||||||
|  | @ -17,6 +17,11 @@ | ||||||
| 
 | 
 | ||||||
| class QAbstractItemModel; | class QAbstractItemModel; | ||||||
| 
 | 
 | ||||||
|  | namespace ESM | ||||||
|  | { | ||||||
|  |     struct GameSetting; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| namespace CSMDoc | namespace CSMDoc | ||||||
| { | { | ||||||
|     class Document : public QObject |     class Document : public QObject | ||||||
|  | @ -46,6 +51,10 @@ namespace CSMDoc | ||||||
| 
 | 
 | ||||||
|             void createBase(); |             void createBase(); | ||||||
| 
 | 
 | ||||||
|  |             void addOptionalGmsts(); | ||||||
|  | 
 | ||||||
|  |             void addOptionalGmst (const ESM::GameSetting& gmst); | ||||||
|  | 
 | ||||||
|         public: |         public: | ||||||
| 
 | 
 | ||||||
|             Document (const std::vector<boost::filesystem::path>& files, bool new_); |             Document (const std::vector<boost::filesystem::path>& files, bool new_); | ||||||
|  |  | ||||||
|  | @ -54,6 +54,16 @@ CSMWorld::IdCollection<ESM::Global>& CSMWorld::Data::getGlobals() | ||||||
|     return mGlobals; |     return mGlobals; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | const CSMWorld::IdCollection<ESM::GameSetting>& CSMWorld::Data::getGmsts() const | ||||||
|  | { | ||||||
|  |     return mGmsts; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | CSMWorld::IdCollection<ESM::GameSetting>& CSMWorld::Data::getGmsts() | ||||||
|  | { | ||||||
|  |     return mGmsts; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| QAbstractTableModel *CSMWorld::Data::getTableModel (const UniversalId& id) | QAbstractTableModel *CSMWorld::Data::getTableModel (const UniversalId& id) | ||||||
| { | { | ||||||
|     std::map<UniversalId::Type, QAbstractTableModel *>::iterator iter = mModelIndex.find (id.getType()); |     std::map<UniversalId::Type, QAbstractTableModel *>::iterator iter = mModelIndex.find (id.getType()); | ||||||
|  |  | ||||||
|  | @ -40,6 +40,10 @@ namespace CSMWorld | ||||||
| 
 | 
 | ||||||
|             IdCollection<ESM::Global>& getGlobals(); |             IdCollection<ESM::Global>& getGlobals(); | ||||||
| 
 | 
 | ||||||
|  |             const IdCollection<ESM::GameSetting>& getGmsts() const; | ||||||
|  | 
 | ||||||
|  |             IdCollection<ESM::GameSetting>& getGmsts(); | ||||||
|  | 
 | ||||||
|             QAbstractTableModel *getTableModel (const UniversalId& id); |             QAbstractTableModel *getTableModel (const UniversalId& id); | ||||||
|             ///< If no table model is available for \a id, an exception is thrown.
 |             ///< If no table model is available for \a id, an exception is thrown.
 | ||||||
|             ///
 |             ///
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue