GUIInterface / observermode cleanup as recommended by leper, fixes #3999.

Default to the viewed player in the GUIInterface to avoid passing that
separately in some places, refs #3168.
Thus GetEntityState will be called for the viewed player instead of
observer playerID, therefore
fixes a fog-of-war selection relict when changing the perspective, refs
#3850.
Also remove some unused player arguments.

This was SVN commit r18283.
This commit is contained in:
elexis
2016-06-02 00:09:21 +00:00
parent 662f8ec620
commit 00ea7763f7
2 changed files with 18 additions and 22 deletions
+1 -3
View File
@@ -123,13 +123,11 @@ JS::Value GuiInterfaceCall(ScriptInterface::CxPrivate* pCxPrivate, const std::ws
if (!cmpGuiInterface)
return JS::UndefinedValue();
int player = g_Game->GetPlayerID();
JSContext* cxSim = sim->GetScriptInterface().GetContext();
JSAutoRequest rqSim(cxSim);
JS::RootedValue arg(cxSim, sim->GetScriptInterface().CloneValueFromOtherContext(*(pCxPrivate->pScriptInterface), data));
JS::RootedValue ret(cxSim);
cmpGuiInterface->ScriptCall(player, name, arg, &ret);
cmpGuiInterface->ScriptCall(g_Game->GetViewedPlayerID(), name, arg, &ret);
return pCxPrivate->pScriptInterface->CloneValueFromOtherContext(sim->GetScriptInterface(), ret);
}