mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-22 09:11:34 +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)
|
if (type==ESM::REC_GSCR)
|
||||||
{
|
{
|
||||||
ESM::GlobalScript script;
|
ESM::GlobalScript script;
|
||||||
script.load (reader);
|
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);
|
auto iter = mScripts.find (script.mId);
|
||||||
|
|
||||||
if (iter==mScripts.end())
|
if (iter==mScripts.end())
|
||||||
|
|
|
@ -73,7 +73,7 @@ namespace MWScript
|
||||||
|
|
||||||
void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
|
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.
|
///< Records for variables that do not exist are dropped silently.
|
||||||
///
|
///
|
||||||
/// \return Known type?
|
/// \return Known type?
|
||||||
|
|
|
@ -461,7 +461,7 @@ void MWState::StateManager::loadGame (const Character *character, const std::str
|
||||||
|
|
||||||
case ESM::REC_GSCR:
|
case ESM::REC_GSCR:
|
||||||
|
|
||||||
MWBase::Environment::get().getScriptManager()->getGlobalScripts().readRecord (reader, n.intval);
|
MWBase::Environment::get().getScriptManager()->getGlobalScripts().readRecord (reader, n.intval, contentFileMap);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ESM::REC_GMAP:
|
case ESM::REC_GMAP:
|
||||||
|
|
Loading…
Reference in a new issue