mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-23 21:32:33 +00:00
Game setup changes, including showing name, civ, team, and some options loaded from the scenarios. Civ data added. Civ info window to preview civs. Icon tooltips. Support for random map implementation. Fixes #590.
This was SVN commit r8494.
This commit is contained in:
@@ -182,16 +182,6 @@ bool CSimulation2Impl::Update(int turnLength, const std::vector<SimulationComman
|
||||
CMessageTurnStart msgTurnStart;
|
||||
m_ComponentManager.BroadcastMessage(msgTurnStart);
|
||||
|
||||
if (m_TurnNumber == 0)
|
||||
{
|
||||
ScriptInterface& scriptInterface = m_ComponentManager.GetScriptInterface();
|
||||
CScriptVal ret;
|
||||
scriptInterface.CallFunction(scriptInterface.GetGlobalObject(), "LoadMapSettings", m_MapSettings, ret);
|
||||
|
||||
if (!m_StartupScript.empty())
|
||||
m_ComponentManager.GetScriptInterface().LoadScript(L"map startup script", m_StartupScript);
|
||||
}
|
||||
|
||||
CmpPtr<ICmpPathfinder> cmpPathfinder(m_SimContext, SYSTEM_ENTITY);
|
||||
if (!cmpPathfinder.null())
|
||||
cmpPathfinder->FinishAsyncRequests();
|
||||
@@ -401,11 +391,30 @@ void CSimulation2::SetMapSettings(const utf16string& settings)
|
||||
m->m_MapSettings = m->m_ComponentManager.GetScriptInterface().ParseJSON(settings);
|
||||
}
|
||||
|
||||
void CSimulation2::SetMapSettings(const CScriptValRooted& settings)
|
||||
{
|
||||
m->m_MapSettings = settings;
|
||||
}
|
||||
|
||||
std::string CSimulation2::GetMapSettings()
|
||||
{
|
||||
return m->m_ComponentManager.GetScriptInterface().StringifyJSON(m->m_MapSettings.get());
|
||||
}
|
||||
|
||||
void CSimulation2::LoadPlayerSettings()
|
||||
{
|
||||
GetScriptInterface().CallFunctionVoid(GetScriptInterface().GetGlobalObject(), "LoadPlayerSettings", m->m_MapSettings);
|
||||
}
|
||||
|
||||
void CSimulation2::LoadMapSettings()
|
||||
{
|
||||
// Initialize here instead of in Update()
|
||||
GetScriptInterface().CallFunctionVoid(GetScriptInterface().GetGlobalObject(), "LoadMapSettings", m->m_MapSettings);
|
||||
|
||||
if (!m->m_StartupScript.empty())
|
||||
GetScriptInterface().LoadScript(L"map startup script", m->m_StartupScript);
|
||||
}
|
||||
|
||||
LibError CSimulation2::ReloadChangedFile(const VfsPath& path)
|
||||
{
|
||||
return m->ReloadChangedFile(path);
|
||||
|
||||
Reference in New Issue
Block a user