From 7d0e660fbba3bb63dab0fb53f92ed0fc02397a94 Mon Sep 17 00:00:00 2001 From: quantumstate Date: Sun, 7 Oct 2012 22:19:03 +0000 Subject: [PATCH] Added Player/MaxPopulation for technologies. This was SVN commit r12739. --- binaries/data/mods/public/globalscripts/Technologies.js | 4 +++- binaries/data/mods/public/simulation/components/Player.js | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/binaries/data/mods/public/globalscripts/Technologies.js b/binaries/data/mods/public/globalscripts/Technologies.js index 65304139e3..e22f4d0ac3 100644 --- a/binaries/data/mods/public/globalscripts/Technologies.js +++ b/binaries/data/mods/public/globalscripts/Technologies.js @@ -24,7 +24,9 @@ function GetTechModifiedProperty(currentTechModifications, entityTemplateData, p // TODO: will we ever need the full template? // Get the classes which this entity template belongs to - var rawClasses = entityTemplateData.Identity.Classes; + var rawClasses; + if (entityTemplateData && entityTemplateData.Identity) + rawClasses = entityTemplateData.Identity.Classes; var classes = (rawClasses && "_string" in rawClasses ? rawClasses._string.split(/\s+/) : []); var retValue = propertyValue; diff --git a/binaries/data/mods/public/simulation/components/Player.js b/binaries/data/mods/public/simulation/components/Player.js index 17c9cf45a1..4adf97c237 100644 --- a/binaries/data/mods/public/simulation/components/Player.js +++ b/binaries/data/mods/public/simulation/components/Player.js @@ -94,7 +94,7 @@ Player.prototype.GetPopulationCount = function() Player.prototype.GetPopulationLimit = function() { - return Math.min(this.maxPop, this.popBonuses); + return Math.min(this.GetMaxPopulation(), this.popBonuses); }; Player.prototype.SetMaxPopulation = function(max) @@ -104,7 +104,11 @@ Player.prototype.SetMaxPopulation = function(max) Player.prototype.GetMaxPopulation = function() { - return this.maxPop; + var cmpTechMan = Engine.QueryInterface(this.entity, IID_TechnologyManager); + if (cmpTechMan) + return cmpTechMan.ApplyModifications("Player/MaxPopulation", this.maxPop, this.entity); + else + return this.maxPop; }; Player.prototype.IsTrainingBlocked = function()