forked from mirrors/0ad
Fix 'Options' asking for confirmation without changes during a game.
Since281bb0b2ec, opening the 'Options' menu in-game will show that there are pending changes, even if the user has done nothing. Unfortunately the cinematic logic to hide silhouettes, which comes fromcfd08bbf28, is broken following those changes. We use the configuration to hide them, which results in us, indeed, changing the configuration. There isn't really a good short term fix. This change only attemps to reset the setting if we changed it for a cinematic, which fixes the issue, but has drawbacks. Ideally, we would use a superior config level, but we need to be careful about exposing that to JS. Reported by: langbart Fixes #6821 Differential Revision: https://code.wildfiregames.com/D5040 This was SVN commit r27730.
This commit is contained in:
@@ -686,13 +686,26 @@ function toggleGUI()
|
||||
updateCinemaPath();
|
||||
}
|
||||
|
||||
var g_HasHiddenSilhouettes = false;
|
||||
function updateCinemaPath()
|
||||
{
|
||||
let isPlayingCinemaPath = GetSimState().cinemaPlaying && !g_Disconnected;
|
||||
|
||||
Engine.GetGUIObjectByName("session").hidden = !g_ShowGUI || isPlayingCinemaPath;
|
||||
Engine.GetGUIObjectByName("cinemaOverlay").hidden = !isPlayingCinemaPath;
|
||||
Engine.ConfigDB_CreateValue("user", "silhouettes", !isPlayingCinemaPath && Engine.ConfigDB_GetValue("user", "silhouettes") == "true" ? "true" : "false");
|
||||
// TODO: This isn't great and should use a different system.
|
||||
if (isPlayingCinemaPath && Engine.ConfigDB_GetValue("user", "silhouettes") == "true")
|
||||
{
|
||||
Engine.ConfigDB_CreateValue("user", "silhouettes", "false");
|
||||
g_HasHiddenSilhouettes = true;
|
||||
}
|
||||
else if (!isPlayingCinemaPath && g_HasHiddenSilhouettes)
|
||||
{
|
||||
// TODO: Keyboard shortcuts can still try to toggle silhouettes
|
||||
// which would behave incorrectly on reset.
|
||||
Engine.ConfigDB_Reload();
|
||||
g_HasHiddenSilhouettes = false;
|
||||
}
|
||||
}
|
||||
|
||||
function updateCinemaOverlay()
|
||||
|
||||
Reference in New Issue
Block a user