Index: binaries/data/mods/public/simulation/helpers/Player.js =================================================================== --- binaries/data/mods/public/simulation/helpers/Player.js +++ binaries/data/mods/public/simulation/helpers/Player.js @@ -7,10 +7,12 @@ * the new number of player entities is obtained * (used when loading a map or when Atlas changes the number of players). */ -function LoadPlayerSettings(settings, newPlayers) +function ParsePlayerSettings(gameSettings, newPlayers) { var playerDefaults = Engine.ReadJSONFile("simulation/data/settings/player_defaults.json").PlayerData; + var settings = gameSettings.settings; + // Default settings if (!settings) settings = {}; @@ -200,6 +202,11 @@ if (settings.LockTeams) for (let i = 0; i < numPlayers; ++i) QueryPlayerIDInterface(i).SetLockTeams(true); + + // Modify the game settings. + // TODO: this is massively horrible: these settings are sent by the sim + // and are generally intended to be immutable to scripts. + gameSettings.settings = settings; } // Get a setting if it exists or return default @@ -391,7 +398,7 @@ return cmpPlayer && cmpPlayer[check](targetOwner); } -Engine.RegisterGlobal("LoadPlayerSettings", LoadPlayerSettings); +Engine.RegisterGlobal("ParsePlayerSettings", ParsePlayerSettings); Engine.RegisterGlobal("QueryOwnerEntityID", QueryOwnerEntityID); Engine.RegisterGlobal("QueryOwnerInterface", QueryOwnerInterface); Engine.RegisterGlobal("QueryPlayerIDInterface", QueryPlayerIDInterface); Index: binaries/data/mods/public/simulation/helpers/Setup.js =================================================================== --- binaries/data/mods/public/simulation/helpers/Setup.js +++ binaries/data/mods/public/simulation/helpers/Setup.js @@ -3,8 +3,10 @@ * Used to initialize non-player settings relevant to the map, like * default stance and victory conditions. DO NOT load players here */ -function LoadMapSettings(settings) +function ParseMapSettings(gameSettings) { + var settings = gameSettings.settings; + if (!settings) settings = {}; @@ -44,17 +46,17 @@ } let cmpEndGameManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_EndGameManager); - let gameSettings = { "victoryConditions": clone(settings.VictoryConditions) }; - if (gameSettings.victoryConditions.indexOf("capture_the_relic") != -1) + let gameRuleset = { "victoryConditions": clone(settings.VictoryConditions) }; + if (gameRuleset.victoryConditions.indexOf("capture_the_relic") != -1) { - gameSettings.relicCount = settings.RelicCount; - gameSettings.relicDuration = settings.RelicDuration * 60 * 1000; + gameRuleset.relicCount = settings.RelicCount; + gameRuleset.relicDuration = settings.RelicDuration * 60 * 1000; } - if (gameSettings.victoryConditions.indexOf("wonder") != -1) - gameSettings.wonderDuration = settings.WonderDuration * 60 * 1000; - if (gameSettings.victoryConditions.indexOf("regicide") != -1) - gameSettings.regicideGarrison = settings.RegicideGarrison; - cmpEndGameManager.SetGameSettings(gameSettings); + if (gameRuleset.victoryConditions.indexOf("wonder") != -1) + gameRuleset.wonderDuration = settings.WonderDuration * 60 * 1000; + if (gameRuleset.victoryConditions.indexOf("regicide") != -1) + gameRuleset.regicideGarrison = settings.RegicideGarrison; + cmpEndGameManager.SetGameSettings(gameRuleset); cmpEndGameManager.SetAlliedVictory(settings.LockTeams || !settings.LastManStanding); if (settings.LockTeams && settings.LastManStanding) @@ -65,4 +67,4 @@ cmpCeasefireManager.StartCeasefire(settings.Ceasefire * 60 * 1000); } -Engine.RegisterGlobal("LoadMapSettings", LoadMapSettings); +Engine.RegisterGlobal("ParseMapSettings", ParseMapSettings); Index: source/graphics/MapReader.h =================================================================== --- source/graphics/MapReader.h +++ source/graphics/MapReader.h @@ -63,11 +63,8 @@ // Load script settings for use by scripts int LoadScriptSettings(); - // load player settings only - int LoadPlayerSettings(); - - // load map settings only - int LoadMapSettings(); + int ParsePlayerSettings(); + int ParseMapSettings(); // UnpackTerrain: unpack the terrain from the input stream int UnpackTerrain(); @@ -87,9 +84,6 @@ // read entity data from the XML file int ReadXMLEntities(); - // Copy random map settings over to sim - int LoadRMSettings(); - // Generate random map int GenerateMap(); @@ -119,9 +113,11 @@ // startup script CStrW m_Script; + // Map settings - this is the 'settings' property of the game InitAttributes. + JS::PersistentRootedValue m_MapSettings; + // random map data CStrW m_ScriptFile; - JS::PersistentRootedValue m_ScriptSettings; JS::PersistentRootedValue m_MapData; CMapGenerator* m_MapGen; Index: source/graphics/MapReader.cpp =================================================================== --- source/graphics/MapReader.cpp +++ source/graphics/MapReader.cpp @@ -85,7 +85,7 @@ m_PlayerID = playerID_; m_SkipEntities = skipEntities; m_StartingCameraTarget = INVALID_ENTITY; - m_ScriptSettings.init(cx.GetGeneralJSContext(), settings); + m_MapSettings.init(cx.GetGeneralJSContext(), settings); filename_xml = pathname.ChangeExtension(L".xml"); @@ -119,14 +119,14 @@ if (pPostproc) pPostproc->SetPostEffect(L"default"); - // load map or script settings script - if (settings.isUndefined()) + // If no map settings were passed, load the default map settings in its place + // (this is sort of a workaround, ideally the callers would load these settings themselves, + // in case they need to be modified, but it works well enough for now). + if (m_MapSettings.isUndefined()) RegMemFun(this, &CMapReader::LoadScriptSettings, L"CMapReader::LoadScriptSettings", 50); - else - RegMemFun(this, &CMapReader::LoadRMSettings, L"CMapReader::LoadRMSettings", 50); - // load player settings script (must be done before reading map) - RegMemFun(this, &CMapReader::LoadPlayerSettings, L"CMapReader::LoadPlayerSettings", 50); + // parse player settings script (must be done before reading map) + RegMemFun(this, &CMapReader::ParsePlayerSettings, L"CMapReader::ParsePlayerSettings", 50); // unpack the data if (!only_xml) @@ -144,8 +144,8 @@ // apply misc data to the world RegMemFun(this, &CMapReader::ApplyData, L"CMapReader::ApplyData", 5); - // load map settings script (must be done after reading map) - RegMemFun(this, &CMapReader::LoadMapSettings, L"CMapReader::LoadMapSettings", 5); + // parse map settings script (must be done after reading map) + RegMemFun(this, &CMapReader::ParseMapSettings, L"CMapReader::ParseMapSettings", 5); } // LoadRandomMap: try to load the map data; reinitialise the scene to new data if successful @@ -157,7 +157,7 @@ m_ScriptFile = scriptFile; pSimulation2 = pSimulation2_; pSimContext = pSimulation2 ? &pSimulation2->GetSimContext() : NULL; - m_ScriptSettings.init(cx.GetGeneralJSContext(), settings); + m_MapSettings.init(cx.GetGeneralJSContext(), settings); pTerrain = pTerrain_; pLightEnv = pLightEnv_; pGameView = pGameView_; @@ -176,11 +176,8 @@ only_xml = false; - // copy random map settings (before entity creation) - RegMemFun(this, &CMapReader::LoadRMSettings, L"CMapReader::LoadRMSettings", 50); - - // load player settings script (must be done before reading map) - RegMemFun(this, &CMapReader::LoadPlayerSettings, L"CMapReader::LoadPlayerSettings", 50); + // parse player settings script (must be done before reading map) + RegMemFun(this, &CMapReader::ParsePlayerSettings, L"CMapReader::ParsePlayerSettings", 50); // load map generator with random map script RegMemFun(this, &CMapReader::GenerateMap, L"CMapReader::GenerateMap", 20000); @@ -203,8 +200,8 @@ // apply misc data to the world RegMemFun(this, &CMapReader::ApplyData, L"CMapReader::ApplyData", 5); - // load map settings script (must be done after reading map) - RegMemFun(this, &CMapReader::LoadMapSettings, L"CMapReader::LoadMapSettings", 5); + // parse map settings script (must be done after reading map) + RegMemFun(this, &CMapReader::ParseMapSettings, L"CMapReader::ParseMapSettings", 5); } // UnpackMap: unpack the given data from the raw data stream into local variables @@ -1200,24 +1197,22 @@ // parse the script settings if (pSimulation2) - pSimulation2->SetMapSettings(xml_reader->ReadScriptSettings()); + pSimulation2->SetInitAttributesFromSettings(xml_reader->ReadScriptSettings()); return 0; } -// load player settings script -int CMapReader::LoadPlayerSettings() +int CMapReader::ParsePlayerSettings() { if (pSimulation2) - pSimulation2->LoadPlayerSettings(true); + pSimulation2->ParsePlayerSettings(true); return 0; } -// load map settings script -int CMapReader::LoadMapSettings() +int CMapReader::ParseMapSettings() { if (pSimulation2) - pSimulation2->LoadMapSettings(); + pSimulation2->ParseMapSettings(); return 0; } @@ -1251,16 +1246,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -int CMapReader::LoadRMSettings() -{ - // copy random map settings over to sim - ENSURE(pSimulation2); - pSimulation2->SetMapSettings(m_ScriptSettings); - - return 0; -} - int CMapReader::GenerateMap() { ScriptRequest rq(pSimulation2->GetScriptInterface()); @@ -1276,7 +1261,7 @@ scriptPath = L"maps/random/"+m_ScriptFile; // Stringify settings to pass across threads - std::string scriptSettings = pSimulation2->GetScriptInterface().StringifyJSON(&m_ScriptSettings); + std::string scriptSettings = pSimulation2->GetScriptInterface().StringifyJSON(&m_MapSettings); // Try to generate map m_MapGen->GenerateMap(scriptPath, scriptSettings); Index: source/graphics/MapWriter.cpp =================================================================== --- source/graphics/MapWriter.cpp +++ source/graphics/MapWriter.cpp @@ -304,7 +304,7 @@ } { - std::string settings = sim.GetMapSettingsString(); + std::string settings = sim.GetSettingsFromInitAttributes(); if (!settings.empty()) { XMLWriter_Element scriptSettingsTag(xmlMapFile, "ScriptSettings"); Index: source/simulation2/Simulation2.h =================================================================== --- source/simulation2/Simulation2.h +++ source/simulation2/Simulation2.h @@ -76,12 +76,12 @@ * @param newPlayers will delete all the existing player entities (if any) and create new ones * (needed for loading maps, but Atlas might want to update existing player data) */ - void LoadPlayerSettings(bool newPlayers); + void ParsePlayerSettings(bool newPlayers); /** - * Loads the map settings script (called after map is loaded) + * Parse the map settings (called after map is loaded) */ - void LoadMapSettings(); + void ParseMapSettings(); /** * Set a startup script, which will get executed before the first turn. @@ -106,28 +106,19 @@ void GetInitAttributes(JS::MutableHandleValue ret); /** - * Set the initial map settings (as a UTF-8-encoded JSON string), - * which will be used to set up the simulation state. - * Called from atlas. + * 'Legacy' path: create InitAttributes from a string. + * This sets attributes to { "setting": ParseJSON(@param settings) }. + * Called from atlas & the mapReader (as fallback). + * TODO: the 'settings' object should be dropped, and then this can be simplified. + * @see SetInitAttributes */ - void SetMapSettings(const std::string& settings); + void SetInitAttributesFromSettings(const std::string& settings); /** - * Set the initial map settings, which will be used - * to set up the simulation state. - * Called from MapReader (for all map-types). + * Returns the 'settings' property of the init attributes. + * TODO: the 'settings' object should be dropped, and then this can be simplified. */ - void SetMapSettings(JS::HandleValue settings); - - /** - * Get the current map settings as a UTF-8 JSON string. - */ - std::string GetMapSettingsString(); - - /** - * Get the current map settings. - */ - void GetMapSettings(JS::MutableHandleValue ret); + std::string GetSettingsFromInitAttributes(); /** * RegMemFun incremental loader function. Index: source/simulation2/Simulation2.cpp =================================================================== --- source/simulation2/Simulation2.cpp +++ source/simulation2/Simulation2.cpp @@ -53,8 +53,7 @@ CSimulation2Impl(CUnitManager* unitManager, shared_ptr cx, CTerrain* terrain) : m_SimContext(), m_ComponentManager(m_SimContext, cx), m_EnableOOSLog(false), m_EnableSerializationTest(false), m_RejoinTestTurn(-1), m_TestingRejoin(false), - m_SecondaryTerrain(nullptr), m_SecondaryContext(nullptr), m_SecondaryComponentManager(nullptr), m_SecondaryLoadedScripts(nullptr), - m_MapSettings(cx->GetGeneralJSContext()), m_InitAttributes(cx->GetGeneralJSContext()) + m_SecondaryTerrain(nullptr), m_SecondaryContext(nullptr), m_SecondaryComponentManager(nullptr), m_SecondaryLoadedScripts(nullptr), m_InitAttributes(cx->GetGeneralJSContext()) { m_SimContext.m_UnitManager = unitManager; m_SimContext.m_Terrain = terrain; @@ -106,7 +105,7 @@ static bool LoadDefaultScripts(CComponentManager& componentManager, std::set* loadedScripts); static bool LoadScripts(CComponentManager& componentManager, std::set* loadedScripts, const VfsPath& path); - static bool LoadTriggerScripts(CComponentManager& componentManager, JS::HandleValue mapSettings, std::set* loadedScripts); + static bool LoadTriggerScripts(CComponentManager& componentManager, JS::HandleValue initAttributes, std::set* loadedScripts); Status ReloadChangedFile(const VfsPath& path); static Status ReloadChangedFileCB(void* param, const VfsPath& path) @@ -128,7 +127,6 @@ std::string m_StartupScript; JS::PersistentRootedValue m_InitAttributes; - JS::PersistentRootedValue m_MapSettings; std::set m_LoadedScripts; @@ -210,26 +208,34 @@ return ok; } -bool CSimulation2Impl::LoadTriggerScripts(CComponentManager& componentManager, JS::HandleValue mapSettings, std::set* loadedScripts) +bool CSimulation2Impl::LoadTriggerScripts(CComponentManager& componentManager, JS::HandleValue initAttributes, std::set* loadedScripts) { + ScriptInterface& scriptInterface = componentManager.GetScriptInterface(); + ScriptRequest rq(scriptInterface); + + if (!scriptInterface.HasProperty(initAttributes, "settings")) + return true; + + JS::RootedValue settings(rq.cx); + scriptInterface.GetProperty(initAttributes, "settings", &settings); + if (!scriptInterface.HasProperty(settings, "TriggerScripts")) + return true; + + std::vector scriptNames; + scriptInterface.GetProperty(settings, "TriggerScripts", scriptNames); bool ok = true; - if (componentManager.GetScriptInterface().HasProperty(mapSettings, "TriggerScripts")) + for (const std::string& triggerScript : scriptNames) { - std::vector scriptNames; - componentManager.GetScriptInterface().GetProperty(mapSettings, "TriggerScripts", scriptNames); - for (const std::string& triggerScript : scriptNames) + std::string scriptName = "maps/" + triggerScript; + if (loadedScripts) { - std::string scriptName = "maps/" + triggerScript; - if (loadedScripts) - { - if (loadedScripts->find(scriptName) != loadedScripts->end()) - continue; - loadedScripts->insert(scriptName); - } - LOGMESSAGE("Loading trigger script '%s'", scriptName.c_str()); - if (!componentManager.LoadScript(scriptName.data())) - ok = false; + if (loadedScripts->find(scriptName) != loadedScripts->end()) + continue; + loadedScripts->insert(scriptName); } + LOGMESSAGE("Loading trigger script '%s'", scriptName.c_str()); + if (!componentManager.LoadScript(scriptName.data())) + ok = false; } return ok; } @@ -338,8 +344,8 @@ void CSimulation2Impl::InitRNGSeedSimulation() { u32 seed = 0; - if (!m_ComponentManager.GetScriptInterface().HasProperty(m_MapSettings, "Seed") || - !m_ComponentManager.GetScriptInterface().GetProperty(m_MapSettings, "Seed", seed)) + if (!m_ComponentManager.GetScriptInterface().HasProperty(m_InitAttributes, "Seed") || + !m_ComponentManager.GetScriptInterface().GetProperty(m_InitAttributes, "Seed", seed)) LOGWARNING("CSimulation2Impl::InitRNGSeedSimulation: No seed value specified - using %d", seed); m_ComponentManager.SetRNGSeed(seed); @@ -348,8 +354,8 @@ void CSimulation2Impl::InitRNGSeedAI() { u32 seed = 0; - if (!m_ComponentManager.GetScriptInterface().HasProperty(m_MapSettings, "AISeed") || - !m_ComponentManager.GetScriptInterface().GetProperty(m_MapSettings, "AISeed", seed)) + if (!m_ComponentManager.GetScriptInterface().HasProperty(m_InitAttributes, "AISeed") || + !m_ComponentManager.GetScriptInterface().GetProperty(m_InitAttributes, "AISeed", seed)) LOGWARNING("CSimulation2Impl::InitRNGSeedAI: No seed value specified - using %d", seed); CmpPtr cmpAIManager(m_SimContext, SYSTEM_ENTITY); @@ -423,9 +429,9 @@ // Load the trigger scripts after we have loaded the simulation. { ScriptRequest rq2(m_SecondaryComponentManager->GetScriptInterface()); - JS::RootedValue mapSettingsCloned(rq2.cx, - m_SecondaryComponentManager->GetScriptInterface().CloneValueFromOtherCompartment(scriptInterface, m_MapSettings)); - ENSURE(LoadTriggerScripts(*m_SecondaryComponentManager, mapSettingsCloned, m_SecondaryLoadedScripts)); + JS::RootedValue initAttributesCloned(rq2.cx, + m_SecondaryComponentManager->GetScriptInterface().CloneValueFromOtherCompartment(scriptInterface, m_InitAttributes)); + ENSURE(LoadTriggerScripts(*m_SecondaryComponentManager, initAttributesCloned, m_SecondaryLoadedScripts)); } // Load the map into the secondary simulation @@ -802,6 +808,9 @@ void CSimulation2::SetInitAttributes(JS::HandleValue attribs) { m->m_InitAttributes = attribs; + + m->InitRNGSeedSimulation(); + m->InitRNGSeedAI(); } JS::Value CSimulation2::GetInitAttributes() @@ -814,44 +823,49 @@ ret.set(m->m_InitAttributes); } -void CSimulation2::SetMapSettings(const std::string& settings) +std::string CSimulation2::GetSettingsFromInitAttributes() { - m->m_ComponentManager.GetScriptInterface().ParseJSON(settings, &m->m_MapSettings); + ScriptRequest rq(GetScriptInterface()); + if (!GetScriptInterface().HasProperty(m->m_InitAttributes, "settings")) + return "{}"; + JS::RootedValue settingsVal(rq.cx); + if (!GetScriptInterface().GetProperty(m->m_InitAttributes, "settings", &settingsVal)) + { + LOGERROR("Error getting settings from init attributes"); + return "{}"; + } + + return GetScriptInterface().StringifyJSON(&settingsVal); } -void CSimulation2::SetMapSettings(JS::HandleValue settings) +void CSimulation2::SetInitAttributesFromSettings(const std::string& settings) { - m->m_MapSettings = settings; + ScriptRequest rq(GetScriptInterface()); + JS::RootedValue settingsVal(rq.cx); + GetScriptInterface().ParseJSON(settings, &settingsVal); + + GetScriptInterface().CreateObject(rq, &m->m_InitAttributes, "settings", settingsVal); m->InitRNGSeedSimulation(); m->InitRNGSeedAI(); } -std::string CSimulation2::GetMapSettingsString() -{ - return m->m_ComponentManager.GetScriptInterface().StringifyJSON(&m->m_MapSettings); -} -void CSimulation2::GetMapSettings(JS::MutableHandleValue ret) -{ - ret.set(m->m_MapSettings); -} - -void CSimulation2::LoadPlayerSettings(bool newPlayers) +void CSimulation2::ParsePlayerSettings(bool newPlayers) { ScriptRequest rq(GetScriptInterface()); JS::RootedValue global(rq.cx, rq.globalValue()); - GetScriptInterface().CallFunctionVoid(global, "LoadPlayerSettings", m->m_MapSettings, newPlayers); + GetScriptInterface().CallFunctionVoid(global, "ParsePlayerSettings", m->m_InitAttributes, newPlayers); } -void CSimulation2::LoadMapSettings() +void CSimulation2::ParseMapSettings() { ScriptRequest rq(GetScriptInterface()); JS::RootedValue global(rq.cx, rq.globalValue()); // Initialize here instead of in Update() - GetScriptInterface().CallFunctionVoid(global, "LoadMapSettings", m->m_MapSettings); + GetScriptInterface().CallFunctionVoid(global, "ParseMapSettings", m->m_InitAttributes); GetScriptInterface().FreezeObject(m->m_InitAttributes, true); GetScriptInterface().SetGlobal("InitAttributes", m->m_InitAttributes, true, true, true); @@ -860,7 +874,7 @@ GetScriptInterface().LoadScript(L"map startup script", m->m_StartupScript); // Load the trigger scripts after we have loaded the simulation and the map. - m->LoadTriggerScripts(m->m_ComponentManager, m->m_MapSettings, &m->m_LoadedScripts); + m->LoadTriggerScripts(m->m_ComponentManager, m->m_InitAttributes, &m->m_LoadedScripts); } int CSimulation2::ProgressiveLoad() Index: source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/Map.cpp =================================================================== --- source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/Map.cpp +++ source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/Map.cpp @@ -611,7 +611,7 @@ if (m_SimState == SimInactive) { // Force update of player settings - POST_MESSAGE(LoadPlayerSettings, (false)); + POST_MESSAGE(ParsePlayerSettings, (false)); POST_MESSAGE(SimStateSave, (L"default")); POST_MESSAGE(GuiSwitchPage, (L"page_session.xml")); Index: source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Player/Player.cpp =================================================================== --- source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Player/Player.cpp +++ source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Player/Player.cpp @@ -450,7 +450,7 @@ SendToEngine(); // Update player settings, to show new color - POST_MESSAGE(LoadPlayerSettings, (false)); + POST_MESSAGE(ParsePlayerSettings, (false)); } } @@ -514,7 +514,7 @@ SendToEngine(); // Reload players, notify observers - POST_MESSAGE(LoadPlayerSettings, (true)); + POST_MESSAGE(ParsePlayerSettings, (true)); m_MapSettings.NotifyObservers(); } } Index: source/tools/atlas/GameInterface/ActorViewer.cpp =================================================================== --- source/tools/atlas/GameInterface/ActorViewer.cpp +++ source/tools/atlas/GameInterface/ActorViewer.cpp @@ -294,8 +294,8 @@ m.Simulation2.ResetState(); // Set player data - m.Simulation2.SetMapSettings(m.Simulation2.GetPlayerDefaults()); - m.Simulation2.LoadPlayerSettings(true); + m.Simulation2.SetInitAttributesFromSettings(m.Simulation2.GetPlayerDefaults()); + m.Simulation2.ParsePlayerSettings(true); // Tell the simulation we've already loaded the terrain CmpPtr cmpTerrain(m.Simulation2, SYSTEM_ENTITY); Index: source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp =================================================================== --- source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp +++ source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp @@ -233,7 +233,7 @@ QUERYHANDLER(GetMapSettings) { - msg->settings = g_Game->GetSimulation2()->GetMapSettingsString(); + msg->settings = g_Game->GetSimulation2()->GetSettingsFromInitAttributes(); } BEGIN_COMMAND(SetMapSettings) @@ -242,12 +242,12 @@ void SetSettings(const std::string& settings) { - g_Game->GetSimulation2()->SetMapSettings(settings); + g_Game->GetSimulation2()->SetInitAttributesFromSettings(settings); } void Do() { - m_OldSettings = g_Game->GetSimulation2()->GetMapSettingsString(); + m_OldSettings = g_Game->GetSimulation2()->GetSettingsFromInitAttributes(); m_NewSettings = *msg->settings; SetSettings(m_NewSettings); @@ -272,9 +272,9 @@ }; END_COMMAND(SetMapSettings) -MESSAGEHANDLER(LoadPlayerSettings) +MESSAGEHANDLER(ParsePlayerSettings) { - g_Game->GetSimulation2()->LoadPlayerSettings(msg->newplayers); + g_Game->GetSimulation2()->ParsePlayerSettings(msg->newplayers); } QUERYHANDLER(GetMapSizes) Index: source/tools/atlas/GameInterface/Messages.h =================================================================== --- source/tools/atlas/GameInterface/Messages.h +++ source/tools/atlas/GameInterface/Messages.h @@ -191,7 +191,7 @@ ((std::string, settings)) ); -MESSAGE(LoadPlayerSettings, +MESSAGE(ParsePlayerSettings, ((bool, newplayers)) );