1
0
forked from mirrors/0ad

Fix changing view to observer

`id` was compared to the wrong player.
This defect was introduced in 023527e56e.

(cherry picked from commit e19a5eda9f)
Signed-off-by: Itms <itms@wildfiregames.com>
This commit is contained in:
elexis
2025-01-05 11:11:10 +01:00
committed by Itms
parent 83a3794ea3
commit 04636d393a
+1 -4
View File
@@ -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);