forked from 0ad/0ad
Update territory bitmask and add a returnResource command for entities.
This was SVN commit r11878.
This commit is contained in:
parent
0d9dcac82a
commit
d7faa813f4
@ -147,9 +147,7 @@ var EntityTemplate = Class({
|
||||
return undefined;
|
||||
return +this._template.ResourceSupply.Amount;
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
resourceGatherRates: function() {
|
||||
if (!this._template.ResourceGatherer)
|
||||
return undefined;
|
||||
@ -366,6 +364,12 @@ var Entity = Class({
|
||||
Engine.PostCommand({"type": "repair", "entities": [this.id()], "target": target.id(), "autocontinue": false, "queued": queued});
|
||||
return this;
|
||||
},
|
||||
|
||||
returnResources: function(target, queued) {
|
||||
queued = queued || false;
|
||||
Engine.PostCommand({"type": "returnresource", "entities": [this.id()], "target": target.id(), "queued": queued});
|
||||
return this;
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
Engine.PostCommand({"type": "delete-entities", "entities": [this.id()]});
|
||||
|
@ -151,7 +151,7 @@ var BuildingConstructionPlan = Class({
|
||||
// Find all tiles in valid territory that are far enough away from obstructions:
|
||||
var passabilityMap = gameState.getPassabilityMap();
|
||||
var territoryMap = gameState.getTerritoryMap();
|
||||
const TERRITORY_PLAYER_MASK = 0x7F;
|
||||
const TERRITORY_PLAYER_MASK = 0x3F;
|
||||
var obstructionMask = gameState.getPassabilityClassMask("foundationObstruction");
|
||||
|
||||
if (passabilityMap.data.length != territoryMap.data.length)
|
||||
|
@ -27,7 +27,7 @@ Map.createObstructionMap = function(gameState, template){
|
||||
var passabilityMap = gameState.getMap();
|
||||
var territoryMap = gameState.getTerritoryMap();
|
||||
|
||||
const TERRITORY_PLAYER_MASK = 0x7F;
|
||||
const TERRITORY_PLAYER_MASK = 0x3F;
|
||||
|
||||
// default values
|
||||
var placementType = "land";
|
||||
@ -66,13 +66,14 @@ Map.createObstructionMap = function(gameState, template){
|
||||
(!buildOwn && tilePlayer == playerID) ||
|
||||
(!buildAlly && gameState.isPlayerAlly(tilePlayer) && tilePlayer != playerID) ||
|
||||
(!buildNeutral && tilePlayer == 0) ||
|
||||
(!buildEnemy && gameState.isPlayerEnemy(tilePlayer) && tilePlayer !=0)
|
||||
(!buildEnemy && gameState.isPlayerEnemy(tilePlayer) && tilePlayer != 0)
|
||||
);
|
||||
var tileAccessible = (gameState.ai.accessibility.map[i] == 1);
|
||||
obstructionTiles[i] = (!tileAccessible || invalidTerritory || (passabilityMap.data[i] & obstructionMask)) ? 0 : 65535;
|
||||
}
|
||||
|
||||
var map = new Map(gameState, obstructionTiles);
|
||||
|
||||
if (template && template.buildDistance()){
|
||||
var minDist = template.buildDistance().MinDistance;
|
||||
var category = template.buildDistance().FromCategory;
|
||||
|
@ -129,7 +129,7 @@ var BuildingConstructionPlan = Class({
|
||||
// Find all tiles in valid territory that are far enough away from obstructions:
|
||||
var passabilityMap = gameState.getPassabilityMap();
|
||||
var territoryMap = gameState.getTerritoryMap();
|
||||
const TERRITORY_PLAYER_MASK = 0x7F;
|
||||
const TERRITORY_PLAYER_MASK = 0x3F;
|
||||
var obstructionMask = gameState.getPassabilityClassMask("foundationObstruction");
|
||||
|
||||
if (passabilityMap.data.length != territoryMap.data.length)
|
||||
|
Loading…
Reference in New Issue
Block a user