From 04636d393aea340bae6872d31da8d23b5037a03f Mon Sep 17 00:00:00 2001 From: elexis Date: Sun, 5 Jan 2025 11:11:10 +0100 Subject: [PATCH] Fix changing view to observer `id` was compared to the wrong player. This defect was introduced in 023527e56e. (cherry picked from commit e19a5eda9f54334133b852a24c6618d1e86ac622) Signed-off-by: Itms --- source/ps/scripting/JSInterface_Game.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/source/ps/scripting/JSInterface_Game.cpp b/source/ps/scripting/JSInterface_Game.cpp index c888d19e41..b208623fd9 100644 --- a/source/ps/scripting/JSInterface_Game.cpp +++ b/source/ps/scripting/JSInterface_Game.cpp @@ -84,13 +84,10 @@ void SetPlayerID(const ScriptRequest& rq, int id) void SetViewedPlayer(const ScriptRequest& rq, int id) { - if (!g_Game) + if (!g_Game || g_Game->GetViewedPlayerID() == id) return; int playerID = g_Game->GetPlayerID(); - if (playerID == id) - return; - // Forbid active players to reveal the map by changing perspective, unless cheats are allowed. if (playerID == -1 || g_Game->CheatsEnabled() || g_Game->PlayerFinished(playerID)) g_Game->SetViewedPlayerID(id);