Index: binaries/data/mods/public/simulation/components/AIProxy.js =================================================================== --- binaries/data/mods/public/simulation/components/AIProxy.js +++ binaries/data/mods/public/simulation/components/AIProxy.js @@ -68,7 +68,7 @@ // not yet notified, be sure that the owner is set before doing so // as the Create event is sent only on first ownership changed let cmpOwnership = Engine.QueryInterface(this.entity, IID_Ownership); - if (!cmpOwnership || cmpOwnership.GetOwner() < 0) + if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER) return false; } Index: binaries/data/mods/public/simulation/components/Fogging.js =================================================================== --- binaries/data/mods/public/simulation/components/Fogging.js +++ binaries/data/mods/public/simulation/components/Fogging.js @@ -160,7 +160,7 @@ Fogging.prototype.IsMiraged = function(player) { - if (player < 0 || player >= this.mirages.length) + if (player == INVALID_PLAYER || player >= this.mirages.length) return false; return this.miraged[player]; @@ -168,7 +168,7 @@ Fogging.prototype.GetMirage = function(player) { - if (player < 0 || player >= this.mirages.length) + if (player == INVALID_PLAYER || player >= this.mirages.length) return INVALID_ENTITY; return this.mirages[player]; @@ -176,7 +176,7 @@ Fogging.prototype.WasSeen = function(player) { - if (player < 0 || player >= this.seen.length) + if (player == INVALID_PLAYER || player >= this.seen.length) return false; return this.seen[player]; @@ -208,7 +208,7 @@ Fogging.prototype.OnVisibilityChanged = function(msg) { - if (msg.player < 0 || msg.player >= this.mirages.length) + if (msg.player == INVALID_PLAYER || msg.player >= this.mirages.length) return; if (msg.newVisibility == VIS_VISIBLE) Index: binaries/data/mods/public/simulation/components/GarrisonHolder.js =================================================================== --- binaries/data/mods/public/simulation/components/GarrisonHolder.js +++ binaries/data/mods/public/simulation/components/GarrisonHolder.js @@ -270,7 +270,7 @@ { let entityIndex = this.entities.indexOf(entity); // Error: invalid entity ID, usually it's already been ejected - if (entityIndex == -1) + if (entityIndex == INVALID_ENTITY) return false; // Find spawning location @@ -559,7 +559,7 @@ // or on some of its garrisoned units let entityIndex = this.entities.indexOf(msg.entity); - if (entityIndex != -1) + if (entityIndex != INVALID_ENTITY) { // If the entity is dead, remove it directly instead of ejecting the corpse let cmpHealth = Engine.QueryInterface(msg.entity, IID_Health); @@ -584,7 +584,7 @@ GarrisonHolder.prototype.OnGlobalEntityRenamed = function(msg) { let entityIndex = this.entities.indexOf(msg.entity); - if (entityIndex != -1) + if (entityIndex != INVALID_ENTITY) { let vgpRenamed; for (let vgp of this.visibleGarrisonPoints) @@ -611,7 +611,7 @@ else { entityIndex = this.initGarrison.indexOf(msg.entity); - if (entityIndex != -1) + if (entityIndex != INVALID_ENTITY) this.initGarrison[entityIndex] = msg.newentity; } }; @@ -645,7 +645,7 @@ for (let entity of entities) { let entityIndex = this.entities.indexOf(entity); - if (entityIndex == -1) + if (entityIndex == INVALID_ENTITY) continue; let cmpHealth = Engine.QueryInterface(entity, IID_Health); if (cmpHealth)