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()