From 13d701e3d060930af0f79f428229c0490028e205 Mon Sep 17 00:00:00 2001 From: Freagarach Date: Wed, 11 May 2022 06:04:20 +0000 Subject: [PATCH] Fix maps after ea72437739. Correctly fetch the civ from the player's Identity. Also remove the notions of the CivChanged message, since it was effectively deleted already. Differential revision: https://code.wildfiregames.com/D4486 Reviewed by: @wraitii Comments by: @bb, @Silier, @smiley, @Stan, @vladislavbelov Fixes #6444 This was SVN commit r26872. --- .../public/maps/random/survivalofthefittest_triggers.js | 5 +---- binaries/data/mods/public/maps/scripts/Regicide.js | 2 +- binaries/data/mods/public/simulation/components/Trainer.js | 5 ----- .../mods/public/simulation/components/interfaces/Player.js | 7 ------- 4 files changed, 2 insertions(+), 17 deletions(-) diff --git a/binaries/data/mods/public/maps/random/survivalofthefittest_triggers.js b/binaries/data/mods/public/maps/random/survivalofthefittest_triggers.js index 5f294147d4..5cc21872ea 100644 --- a/binaries/data/mods/public/maps/random/survivalofthefittest_triggers.js +++ b/binaries/data/mods/public/maps/random/survivalofthefittest_triggers.js @@ -137,10 +137,7 @@ Trigger.prototype.LoadAttackerTemplates = function() Trigger.prototype.SetDisableTemplates = function() { for (let i = 1; i < TriggerHelper.GetNumberOfPlayers(); ++i) - { - let cmpPlayer = QueryPlayerIDInterface(i); - cmpPlayer.SetDisabledTemplates(disabledTemplates(cmpPlayer.GetCiv())); - } + QueryPlayerIDInterface(i).SetDisabledTemplates(disabledTemplates(QueryPlayerIDInterface(i, IID_Identity).GetCiv())); }; /** diff --git a/binaries/data/mods/public/maps/scripts/Regicide.js b/binaries/data/mods/public/maps/scripts/Regicide.js index 95de895498..7c096be247 100644 --- a/binaries/data/mods/public/maps/scripts/Regicide.js +++ b/binaries/data/mods/public/maps/scripts/Regicide.js @@ -5,7 +5,7 @@ Trigger.prototype.InitRegicideGame = function(msg) let playersCivs = []; for (let playerID = 1; playerID < TriggerHelper.GetNumberOfPlayers(); ++playerID) - playersCivs[playerID] = QueryPlayerIDInterface(playerID).GetCiv(); + playersCivs[playerID] = QueryPlayerIDInterface(playerID, IID_Identity).GetCiv(); // Get all hero templates of these civs let heroTemplates = {}; diff --git a/binaries/data/mods/public/simulation/components/Trainer.js b/binaries/data/mods/public/simulation/components/Trainer.js index 9e2d46968a..ddcc0e2eba 100644 --- a/binaries/data/mods/public/simulation/components/Trainer.js +++ b/binaries/data/mods/public/simulation/components/Trainer.js @@ -691,11 +691,6 @@ Trainer.prototype.Progress = function(id, allocatedTime) return usedTime; }; -Trainer.prototype.OnCivChanged = function() -{ - this.CalculateEntitiesMap(); -}; - Trainer.prototype.OnOwnershipChanged = function(msg) { if (msg.to != INVALID_PLAYER) diff --git a/binaries/data/mods/public/simulation/components/interfaces/Player.js b/binaries/data/mods/public/simulation/components/interfaces/Player.js index 4d86f400d1..574949ab77 100644 --- a/binaries/data/mods/public/simulation/components/interfaces/Player.js +++ b/binaries/data/mods/public/simulation/components/interfaces/Player.js @@ -1,10 +1,3 @@ -/** - * Message of the form { "player": number, "from": string, "to": string } - * sent from Player component to warn other components when a player changed civs. - * This should only happen in Atlas. - */ -Engine.RegisterMessageType("CivChanged"); - /** * Message of the form { "player": number, "otherPlayer": number } * sent from Player component when diplomacy changed for one player or between two players.