forked from 0ad/0ad
petra: fix serialization on f057eb5aba
and fix placement of rotary mills
This was SVN commit r17998.
This commit is contained in:
parent
dd7ee8f53f
commit
017d5cc7de
@ -46,34 +46,35 @@ m.Config = function(difficulty)
|
||||
"armyMergeSize" : 1400 // squared.
|
||||
};
|
||||
|
||||
// military
|
||||
this.buildings =
|
||||
{
|
||||
"base" : {
|
||||
"default" : [ "structures/{civ}_civil_centre" ],
|
||||
"ptol" : [ "structures/{civ}_military_colony" ],
|
||||
"sele" : [ "structures/{civ}_military_colony" ]
|
||||
"base": {
|
||||
"default": [ "structures/{civ}_civil_centre" ],
|
||||
"ptol": [ "structures/{civ}_military_colony" ],
|
||||
"sele": [ "structures/{civ}_military_colony" ]
|
||||
},
|
||||
"advanced" : {
|
||||
"default" : [],
|
||||
"athen" : [ "structures/{civ}_gymnasion", "structures/{civ}_prytaneion", "structures/{civ}_theatron" ],
|
||||
"brit" : [ "structures/{civ}_rotarymill" ],
|
||||
"cart" : [ "structures/{civ}_embassy_celtic",
|
||||
"structures/{civ}_embassy_iberian", "structures/{civ}_embassy_italiote" ],
|
||||
"gaul" : [ "structures/{civ}_tavern" ],
|
||||
"iber" : [ "structures/{civ}_monument" ],
|
||||
"mace" : [ "structures/{civ}_siege_workshop", "structures/{civ}_library", "structures/{civ}_theatron" ],
|
||||
"maur" : [ "structures/{civ}_elephant_stables" ],
|
||||
"pers" : [ "structures/{civ}_stables", "structures/{civ}_apadana" ],
|
||||
"ptol" : [ "structures/{civ}_library" ],
|
||||
"rome" : [ "structures/{civ}_army_camp" ],
|
||||
"sele" : [ "structures/{civ}_library" ],
|
||||
"spart" : [ "structures/{civ}_syssiton", "structures/{civ}_theatron" ]
|
||||
"advanced": {
|
||||
"default": [],
|
||||
"athen": [ "structures/{civ}_gymnasion", "structures/{civ}_prytaneion",
|
||||
"structures/{civ}_theatron" ],
|
||||
"brit": [ "structures/{civ}_rotarymill" ],
|
||||
"cart": [ "structures/{civ}_embassy_celtic", "structures/{civ}_embassy_iberian",
|
||||
"structures/{civ}_embassy_italiote" ],
|
||||
"gaul": [ "structures/{civ}_rotarymill", "structures/{civ}_tavern" ],
|
||||
"iber": [ "structures/{civ}_monument" ],
|
||||
"mace": [ "structures/{civ}_siege_workshop", "structures/{civ}_library",
|
||||
"structures/{civ}_theatron" ],
|
||||
"maur": [ "structures/{civ}_elephant_stables", "structures/{civ}_pillar_ashoka" ],
|
||||
"pers": [ "structures/{civ}_stables", "structures/{civ}_apadana" ],
|
||||
"ptol": [ "structures/{civ}_library" ],
|
||||
"rome": [ "structures/{civ}_army_camp" ],
|
||||
"sele": [ "structures/{civ}_library" ],
|
||||
"spart": [ "structures/{civ}_syssiton", "structures/{civ}_theatron" ]
|
||||
},
|
||||
"naval" : {
|
||||
"default" : [],
|
||||
// "brit" : [ "structures/{civ}_crannog" ],
|
||||
"cart" : [ "structures/{civ}_super_dock" ]
|
||||
"naval": {
|
||||
"default": [],
|
||||
// "brit": [ "structures/{civ}_crannog" ],
|
||||
"cart": [ "structures/{civ}_super_dock" ]
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1607,14 +1607,22 @@ m.HQ.prototype.constructTrainingBuildings = function(gameState, queues)
|
||||
for (let advanced of this.bAdvanced)
|
||||
nAdvanced += gameState.countEntitiesAndQueuedByType(advanced, true);
|
||||
|
||||
if (!nAdvanced || (nAdvanced < this.bAdvanced.length && gameState.getPopulation() > 120))
|
||||
if (!nAdvanced || (nAdvanced < this.bAdvanced.length && gameState.getPopulation() > 110))
|
||||
{
|
||||
for (let advanced of this.bAdvanced)
|
||||
{
|
||||
if (gameState.countEntitiesAndQueuedByType(advanced, true) > 0 || !this.canBuild(gameState, advanced))
|
||||
continue;
|
||||
let preferredBase = this.findBestBaseForMilitary(gameState);
|
||||
queues.militaryBuilding.addPlan(new m.ConstructionPlan(gameState, advanced, { "preferredBase": preferredBase }));
|
||||
let template = gameState.getTemplate(advanced);
|
||||
if (!template)
|
||||
continue;
|
||||
if (template.hasDefensiveFire() || template.trainableEntities())
|
||||
{
|
||||
let preferredBase = this.findBestBaseForMilitary(gameState);
|
||||
queues.militaryBuilding.addPlan(new m.ConstructionPlan(gameState, advanced, { "preferredBase": preferredBase }));
|
||||
}
|
||||
else // not a military building, but still use this queue
|
||||
queues.militaryBuilding.addPlan(new m.ConstructionPlan(gameState, advanced));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2151,6 +2159,7 @@ m.HQ.prototype.Serialize = function()
|
||||
"bAdvanced": this.bAdvanced,
|
||||
"saveResources": this.saveResources,
|
||||
"saveSpace": this.saveSpace,
|
||||
"needCorral": this.needCorral,
|
||||
"needFarm": this.needFarm,
|
||||
"needFish": this.needFish,
|
||||
"canBuildUnits": this.canBuildUnits,
|
||||
|
@ -234,9 +234,10 @@ m.ConstructionPlan.prototype.findGoodPosition = function(gameState)
|
||||
placement.addInfluence(x, z, 120/cellSize, -50);
|
||||
else if (template.hasClass("Military"))
|
||||
placement.addInfluence(x, z, 40/cellSize, -40);
|
||||
else if (template.genericName() === "Rotary Mill" && ent.hasClass("Field"))
|
||||
placement.addInfluence(x, z, 60/cellSize, 40);
|
||||
});
|
||||
}
|
||||
|
||||
if (template.hasClass("Farmstead"))
|
||||
{
|
||||
for (let j = 0; j < placement.map.length; ++j)
|
||||
|
@ -227,20 +227,17 @@ m.HQ.prototype.regionAnalysis = function(gameState)
|
||||
*/
|
||||
m.HQ.prototype.structureAnalysis = function(gameState)
|
||||
{
|
||||
var civ = gameState.playerData.civ;
|
||||
if (civ in this.Config.buildings.base)
|
||||
this.bBase = this.Config.buildings.base[civ];
|
||||
else
|
||||
this.bBase = this.Config.buildings.base['default'];
|
||||
var civref = gameState.playerData.civ;
|
||||
var civ = civref in this.Config.buildings.base ? civref : 'default';
|
||||
this.bBase = [];
|
||||
for (let base of this.Config.buildings.base[civ])
|
||||
this.bBase.push(gameState.applyCiv(base));
|
||||
|
||||
if (civ in this.Config.buildings.advanced)
|
||||
this.bAdvanced = this.Config.buildings.advanced[civ];
|
||||
else
|
||||
this.bAdvanced = this.Config.buildings.advanced['default'];
|
||||
for (let i in this.bBase)
|
||||
this.bBase[i] = gameState.applyCiv(this.bBase[i]);
|
||||
for (let i in this.bAdvanced)
|
||||
this.bAdvanced[i] = gameState.applyCiv(this.bAdvanced[i]);
|
||||
civ = civref in this.Config.buildings.advanced ? civref : 'default';
|
||||
this.bAdvanced = [];
|
||||
for (let advanced of this.Config.buildings.advanced[civ])
|
||||
if (!gameState.isDisabledTemplates(gameState.applyCiv(advanced)))
|
||||
this.bAdvanced.push(gameState.applyCiv(advanced));
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user