mirror of
				https://github.com/TES3MP/openmw-tes3mp.git
				synced 2025-11-04 05:56:41 +00:00 
			
		
		
		
	added add-on global variables in the same way add-on GMSTs were added
This commit is contained in:
		
							parent
							
								
									6f5a772d02
								
							
						
					
					
						commit
						868916a9a2
					
				
					 2 changed files with 37 additions and 0 deletions
				
			
		| 
						 | 
					@ -20,6 +20,7 @@ void CSMDoc::Document::load (const std::vector<boost::filesystem::path>::const_i
 | 
				
			||||||
        getData().loadFile (*end2, false);
 | 
					        getData().loadFile (*end2, false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    addOptionalGmsts();
 | 
					    addOptionalGmsts();
 | 
				
			||||||
 | 
					    addOptionalGlobals();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void CSMDoc::Document::addOptionalGmsts()
 | 
					void CSMDoc::Document::addOptionalGmsts()
 | 
				
			||||||
| 
						 | 
					@ -139,6 +140,26 @@ void CSMDoc::Document::addOptionalGmsts()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void CSMDoc::Document::addOptionalGlobals()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    static const char *sGlobals[] =
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        "dayspassed",
 | 
				
			||||||
 | 
					        "pcwerewolf",
 | 
				
			||||||
 | 
					        "pcyear",
 | 
				
			||||||
 | 
					        0
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (int i=0; sGlobals[i]; ++i)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        ESM::Global global;
 | 
				
			||||||
 | 
					        global.mId = sGlobals[i];
 | 
				
			||||||
 | 
					        global.mType = ESM::VT_Int;
 | 
				
			||||||
 | 
					        global.mValue = 0;
 | 
				
			||||||
 | 
					        addOptionalGlobal (global);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void CSMDoc::Document::addOptionalGmst (const ESM::GameSetting& gmst)
 | 
					void CSMDoc::Document::addOptionalGmst (const ESM::GameSetting& gmst)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (getData().getGmsts().searchId (gmst.mId)==-1)
 | 
					    if (getData().getGmsts().searchId (gmst.mId)==-1)
 | 
				
			||||||
| 
						 | 
					@ -150,6 +171,17 @@ void CSMDoc::Document::addOptionalGmst (const ESM::GameSetting& gmst)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void CSMDoc::Document::addOptionalGlobal (const ESM::Global& global)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if (getData().getGlobals().searchId (global.mId)==-1)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        CSMWorld::Record<ESM::Global> record;
 | 
				
			||||||
 | 
					        record.mBase = global;
 | 
				
			||||||
 | 
					        record.mState = CSMWorld::RecordBase::State_BaseOnly;
 | 
				
			||||||
 | 
					        getData().getGlobals().appendRecord (record);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void CSMDoc::Document::createBase()
 | 
					void CSMDoc::Document::createBase()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    static const char *sGlobals[] =
 | 
					    static const char *sGlobals[] =
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,6 +20,7 @@ class QAbstractItemModel;
 | 
				
			||||||
namespace ESM
 | 
					namespace ESM
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    struct GameSetting;
 | 
					    struct GameSetting;
 | 
				
			||||||
 | 
					    struct Global;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace CSMDoc
 | 
					namespace CSMDoc
 | 
				
			||||||
| 
						 | 
					@ -53,8 +54,12 @@ namespace CSMDoc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            void addOptionalGmsts();
 | 
					            void addOptionalGmsts();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            void addOptionalGlobals();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            void addOptionalGmst (const ESM::GameSetting& gmst);
 | 
					            void addOptionalGmst (const ESM::GameSetting& gmst);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            void addOptionalGlobal (const ESM::Global& global);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public:
 | 
					        public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Document (const std::vector<boost::filesystem::path>& files, bool new_);
 | 
					            Document (const std::vector<boost::filesystem::path>& files, bool new_);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue