...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
functionvar iHave = (function(structure) { var listbuildingIsBuilt = enumStructfunction(me,structure)building) { return building.status == BUILT; } return (list.some(function (buildingstructure) { returnvar building.statuslist == BUILT enumStruct(me,structure); } return list.some(buildingIsBuilt); } })(); |
Example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
// You need a HQ before you can design units or build defence towers if (iHave(HQ)) { // build defence towers } else { // instruct a truck to build a HQ! } |
...