1
0
forked from mirrors/0ad

Fix wrong playerID used for the controlAll developer overlay option in 96a6a136b6/D2383.

Reported By: Freagarach
This was SVN commit r23098.
This commit is contained in:
elexis
2019-10-27 14:15:56 +00:00
parent 3aa4ac7b00
commit ece4a323eb
+5 -10
View File
@@ -223,7 +223,9 @@ function determineAction(x, y, fromMinimap)
return undefined;
// If the selection isn't friendly units, no action
if (!selection.every(canControlEntity))
if (!selection.every(ownsEntity) &&
!(g_SimState.players[g_ViewedPlayer] &&
g_SimState.players[g_ViewedPlayer].controlsAll))
return undefined;
var target = undefined;
@@ -273,17 +275,10 @@ function determineAction(x, y, fromMinimap)
return { "type": "none", "cursor": "", "target": target };
}
function canControlEntity(ent)
function ownsEntity(ent)
{
let entState = GetEntityState(ent);
if (!entState)
return false;
if (entState.player == g_ViewedPlayer)
return true;
let playerState = g_SimState.players[entState.player];
return playerState && playerState.controlsAll;
return entState && entState.player == g_ViewedPlayer;
}
function tryPlaceBuilding(queued)