additional fixes for petra serialization

This was SVN commit r15953.
This commit is contained in:
mimo 2014-11-11 19:02:35 +00:00
parent 13a71f6ae4
commit b596f7a893
3 changed files with 7 additions and 6 deletions

View file

@ -102,9 +102,9 @@ m.HQ.prototype.init = function(gameState, queues, deserialization)
if (this.Config.difficulty == 0)
this.targetNumWorkers = Math.max(1, Math.min(40, Math.floor(gameState.getPopulationMax())));
else if (this.Config.difficulty == 1)
this.targetNumWorkers = Math.max(1, Math.min(60, Math.floor(gameState.getPopulationMax())));
this.targetNumWorkers = Math.max(1, Math.min(60, Math.floor(gameState.getPopulationMax()/2)));
else
this.targetNumWorkers = Math.max(1, Math.min(120,Math.floor(gameState.getPopulationMax()/3.0)));
this.targetNumWorkers = Math.max(1, Math.min(120,Math.floor(gameState.getPopulationMax()/3)));
this.treasures = gameState.getEntities().filter(function (ent) {
var type = ent.resourceSupplyType();

View file

@ -695,12 +695,13 @@ m.NavalManager.prototype.Deserialize = function(gameState, data)
this[key] = data.properties[key];
this.transportPlans = [];
for (let dataPlan in data.transports)
for (let i in data.transports)
{
let dataPlan = data.transports[i];
let plan = new m.TransportPlan(gameState, [], dataPlan.startIndex, dataPlan.endIndex, dataPlan.endPos);
plan.Deserialize(dataPlan);
plan.init(gameState);
this.transportPlans[plan].push(plan);
this.transportPlans.push(plan);
}
};

View file

@ -77,7 +77,7 @@ m.ResearchPlan.prototype.Deserialize = function(gameState, data)
{
this.onStart = function (gameState) {
gameState.ai.HQ.econState = "growth";
gameState.ai.HQ.OnTownPhase(gameState)
gameState.ai.HQ.OnTownPhase(gameState);
};
this.isGo = function (gameState) {
var ret = gameState.getPopulation() >= gameState.ai.Config.Economy.popForTown;
@ -93,7 +93,7 @@ m.ResearchPlan.prototype.Deserialize = function(gameState, data)
}
else if (this.type == gameState.cityPhase())
{
plan.onStart = function (gameState) { gameState.ai.HQ.OnCityPhase(gameState) };
this.onStart = function (gameState) { gameState.ai.HQ.OnCityPhase(gameState) };
}
};