Skip to content

Commit

Permalink
add HasFlyableShips to ShipsInfos
Browse files Browse the repository at this point in the history
  • Loading branch information
alaingilbert committed Jan 26, 2021
1 parent 0b9fdf1 commit 8329fc5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ships.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@ func (s ShipsInfos) HasShips() bool {
return false
}

// HasFlyableShips returns either or not at least one flyable ship is present
func (s ShipsInfos) HasFlyableShips() bool {
for _, ship := range Ships {
shipID := ship.GetID()
if shipID.IsFlyableShip() {
if s.ByID(shipID) > 0 {
return true
}
}
}
return false
}

// Speed returns the speed of the slowest ship
func (s ShipsInfos) Speed(techs Researches, isCollector, isGeneral bool) int64 {
var minSpeed int64 = math.MaxInt64
Expand Down

0 comments on commit 8329fc5

Please sign in to comment.