Skip to content

Commit

Permalink
simplify CountShipDefenses code
Browse files Browse the repository at this point in the history
  • Loading branch information
alaingilbert committed Dec 6, 2020
1 parent cc6dac6 commit c803f61
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions defence.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ func (d DefensesInfos) HasMissilesDefense() bool {
// CountShipDefenses returns the count of defenses which can attack ships i.e., excluding AntiBallisticMissiles
func (d DefensesInfos) CountShipDefenses() (out int64) {
for _, defense := range Defenses {
if defense == InterplanetaryMissiles || defense == AntiBallisticMissiles {
continue
if defense != InterplanetaryMissiles && defense != AntiBallisticMissiles {
out += d.ByID(defense.GetID())
}
out += d.ByID(defense.GetID())
}
return
}
Expand Down

0 comments on commit c803f61

Please sign in to comment.