1
0
forked from 0ad/0ad

Check properties exist in resourceSupplyAmount and resourceCarrying to avoid warnings. Code from wraitii

This was SVN commit r11587.
This commit is contained in:
Jonathan Waller 2012-04-20 19:48:25 +00:00
parent ed6e5bdaf0
commit b7cf51be34

View File

@ -323,9 +323,17 @@ var Entity = Class({
return !this.isOwn(); // TODO: diplomacy
},
resourceSupplyAmount: function() { return this._entity.resourceSupplyAmount; },
resourceSupplyAmount: function() {
if(this._entity.resourceSupplyAmount === undefined)
return undefined;
return this._entity.resourceSupplyAmount;
},
resourceCarrying: function() { return this._entity.resourceCarrying; },
resourceCarrying: function() {
if(this._entity.resourceCarrying === undefined)
return undefined;
return this._entity.resourceCarrying;
},
garrisoned: function() { return new EntityCollection(this._ai, this._entity.garrisoned); },