Ticket #2179: unit_commands.js.patch
File unit_commands.js.patch, 1.1 KB (added by , 11 years ago) |
---|
-
binaries/data/mods/public/gui/session/unit_commands.js
1275 1275 // Get all of the available entities which can be built by the selected entities 1276 1276 function getAllBuildableEntities(selection) 1277 1277 { 1278 //Array to contain already processed entity templates so buildableEnts wont be a huge set of duplicates 1279 var alreadyIncluded = []; 1280 1278 1281 var buildableEnts = []; 1279 1282 var state; 1280 1283 // Get all buildable entities 1281 1284 for (var i in selection) 1282 1285 { 1283 if ((state = GetEntityState(selection[i])) && state.buildEntities && state.buildEntities.length) 1286 if ((state = GetEntityState(selection[i])) && state.buildEntities && state.buildEntities.length && (alreadyIncluded.indexOf(state.template)) == -1) 1287 { 1284 1288 buildableEnts = buildableEnts.concat(state.buildEntities); 1289 //add the entity's template to the alreadyIncluded array 1290 alreadyIncluded.push(state.template); 1291 } 1285 1292 } 1286 1293 1287 1294 // Remove duplicates