Fix Gaia not being its own mutual ally.

For `!0 === false`.
Reported by: @gameboy at
https://wildfiregames.com/forum/topic/107586-an-error-occurred/.
Introduced in c917c39a0d.

Differential revision: https://code.wildfiregames.com/D5058
Reviewed by: @wraitii
This was SVN commit r27736.
This commit is contained in:
Freagarach 2023-06-23 12:53:49 +00:00
parent f4caf15710
commit 435d842bc1

View File

@ -134,7 +134,7 @@ Diplomacy.prototype.GetDiplomacy = function()
Diplomacy.prototype.SetDiplomacy = function(dipl)
{
const playerID = Engine.QueryInterface(this.entity, IID_Player)?.GetPlayerID();
if (!playerID)
if (playerID === undefined)
return
this.diplomacy = dipl.slice();
@ -227,7 +227,7 @@ Diplomacy.prototype.IsExclusiveAlly = function(id)
Diplomacy.prototype.IsMutualAlly = function(id)
{
const playerID = Engine.QueryInterface(this.entity, IID_Player)?.GetPlayerID();
return this.IsAlly(id) && playerID && QueryPlayerIDInterface(id, IID_Diplomacy)?.IsAlly(playerID);
return playerID !== undefined && this.IsAlly(id) && QueryPlayerIDInterface(id, IID_Diplomacy)?.IsAlly(playerID);
};
/**
@ -246,7 +246,7 @@ Diplomacy.prototype.GetMutualAllies = function()
Diplomacy.prototype.IsExclusiveMutualAlly = function(id)
{
const playerID = Engine.QueryInterface(this.entity, IID_Player)?.GetPlayerID();
return playerID && playerID !== id && this.IsMutualAlly(id);
return playerID !== id && this.IsMutualAlly(id);
};
/**
@ -313,7 +313,7 @@ Diplomacy.prototype.HasSharedLos = function()
Diplomacy.prototype.UpdateSharedLos = function()
{
const playerID = Engine.QueryInterface(this.entity, IID_Player).GetPlayerID();
if (!playerID)
if (playerID === undefined)
return;
Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager)?.