Remove arg overloading in useUtility

This commit is contained in:
Kevin Chang
2015-11-16 16:36:15 -08:00
parent f5127c2475
commit 41c4b4243a
2 changed files with 3 additions and 8 deletions

View File

@@ -547,13 +547,8 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
return this; return this;
}; };
Ship.prototype.useUtility = function(group, rating, clobber) { Ship.prototype.useUtility = function(group, rating, name, clobber) {
var component; var component = Components.findHardpoint(group, 0, rating, name);
if (group == 'cm') {
component = Components.findHardpoint(group, 0, null, rating); //overload Rating as Name for countermeasures
} else {
component = Components.findHardpoint(group, 0, rating);
}
for (var i = this.hardpoints.length; i--; ) { for (var i = this.hardpoints.length; i--; ) {
if ((clobber || !this.hardpoints[i].c) && !this.hardpoints[i].maxClass) { if ((clobber || !this.hardpoints[i].c) && !this.hardpoints[i].maxClass) {
this.use(this.hardpoints[i], component.id, component); this.use(this.hardpoints[i], component.id, component);

View File

@@ -298,7 +298,7 @@
</ul> </ul>
<div class="select-group cap" translate="Heat Sink Launcher"></div> <div class="select-group cap" translate="Heat Sink Launcher"></div>
<ul> <ul>
<li class="lc" ng-click="useUtility('cm','Heat Sink Launcher')" translate="Heat Sink Launcher"></li> <li class="lc" ng-click="useUtility('cm',null,'Heat Sink Launcher')" translate="Heat Sink Launcher"></li>
</ul> </ul>
</div> </div>
</div> </div>