Added Player/MaxPopulation for technologies.

This was SVN commit r12739.
This commit is contained in:
quantumstate 2012-10-07 22:19:03 +00:00
parent cc34cf169c
commit 7d0e660fbb
2 changed files with 9 additions and 3 deletions

View file

@ -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;

View file

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