mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-21 17:39:40 +00:00
Merge branch 'shuffle_those_mods' into 'master'
Fix targeted scripts losing their targets when rearranging your load order See merge request OpenMW/openmw!715
This commit is contained in:
commit
71fda935e8
3 changed files with 10 additions and 3 deletions
|
@ -235,13 +235,20 @@ namespace MWScript
|
|||
}
|
||||
}
|
||||
|
||||
bool GlobalScripts::readRecord (ESM::ESMReader& reader, uint32_t type)
|
||||
bool GlobalScripts::readRecord (ESM::ESMReader& reader, uint32_t type, const std::map<int, int>& contentFileMap)
|
||||
{
|
||||
if (type==ESM::REC_GSCR)
|
||||
{
|
||||
ESM::GlobalScript script;
|
||||
script.load (reader);
|
||||
|
||||
if (script.mTargetRef.hasContentFile())
|
||||
{
|
||||
auto iter = contentFileMap.find(script.mTargetRef.mContentFile);
|
||||
if (iter != contentFileMap.end())
|
||||
script.mTargetRef.mContentFile = iter->second;
|
||||
}
|
||||
|
||||
auto iter = mScripts.find (script.mId);
|
||||
|
||||
if (iter==mScripts.end())
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace MWScript
|
|||
|
||||
void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
|
||||
|
||||
bool readRecord (ESM::ESMReader& reader, uint32_t type);
|
||||
bool readRecord (ESM::ESMReader& reader, uint32_t type, const std::map<int, int>& contentFileMap);
|
||||
///< Records for variables that do not exist are dropped silently.
|
||||
///
|
||||
/// \return Known type?
|
||||
|
|
|
@ -461,7 +461,7 @@ void MWState::StateManager::loadGame (const Character *character, const std::str
|
|||
|
||||
case ESM::REC_GSCR:
|
||||
|
||||
MWBase::Environment::get().getScriptManager()->getGlobalScripts().readRecord (reader, n.intval);
|
||||
MWBase::Environment::get().getScriptManager()->getGlobalScripts().readRecord (reader, n.intval, contentFileMap);
|
||||
break;
|
||||
|
||||
case ESM::REC_GMAP:
|
||||
|
|
Loading…
Reference in a new issue