Fix "at least one ship selected" when sending fleet
@@ -2172,23 +2172,24 @@ func (b *OGame) sendFleet(celestialID CelestialID, ships []Quantifiable, speed S
availableShips := ExtractFleet1ShipsFromDoc(fleet1Doc)
- if !ensure {
atLeastOneShipSelected := false
+ if !ensure {
for _, ship := range ships {
if ship.Nbr > 0 && availableShips.ByID(ship.ID) > 0 {
atLeastOneShipSelected = true
break
}
}
- if !atLeastOneShipSelected {
- return Fleet{}, ErrNoShipSelected
- }
} else {
for _, ship := range ships {
if ship.Nbr > availableShips.ByID(ship.ID) {
return Fleet{}, ErrNotEnoughShips
}
+ atLeastOneShipSelected = true
+ }
}
+ if !atLeastOneShipSelected {
+ return Fleet{}, ErrNoShipSelected
}
payload := ExtractHiddenFieldsFromDoc(fleet1Doc)
