From c98ae10e391843e55cb419a153de71b52db2520c Mon Sep 17 00:00:00 2001 From: elexis Date: Sun, 1 Jun 2025 16:14:50 +0200 Subject: [PATCH] Fix change perspective in replays Fixes change perspective features of multiplayer replays following cheat protection in 023527e56e2e31. Fixes: #8020 (cherry picked from commit 67eaa8f1a9c089c24cf93b36b276e6eb899d161a) Signed-off-by: Itms --- source/ps/scripting/JSInterface_Game.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/ps/scripting/JSInterface_Game.cpp b/source/ps/scripting/JSInterface_Game.cpp index b208623fd9..6a821691a7 100644 --- a/source/ps/scripting/JSInterface_Game.cpp +++ b/source/ps/scripting/JSInterface_Game.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2024 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -76,7 +76,7 @@ void SetPlayerID(const ScriptRequest& rq, int id) if (currentID == id) return; - if (g_Game->CheatsEnabled()) + if (g_Game->CheatsEnabled() || g_Game->IsVisualReplay()) g_Game->SetPlayerID(id); else ScriptException::Raise(rq, "Changing player ID with cheats disabled is prohibited"); @@ -89,7 +89,7 @@ void SetViewedPlayer(const ScriptRequest& rq, int id) int playerID = g_Game->GetPlayerID(); // Forbid active players to reveal the map by changing perspective, unless cheats are allowed. - if (playerID == -1 || g_Game->CheatsEnabled() || g_Game->PlayerFinished(playerID)) + if (playerID == -1 || g_Game->CheatsEnabled() || g_Game->PlayerFinished(playerID) || g_Game->IsVisualReplay()) g_Game->SetViewedPlayerID(id); else ScriptException::Raise(rq, "Changing the perspective with cheats disabled is prohibited");