Example #1
0
bool UFlareFleet::CanMerge(UFlareFleet* Fleet, FText& OutInfo)
{
	if (GetShipCount() + Fleet->GetShipCount() > GetMaxShipCount())
	{
		OutInfo = LOCTEXT("MergeFleetMaxShips", "Can't add, max ships reached");
		return false;
	}

	if (IsTraveling())
	{
		OutInfo = LOCTEXT("MergeFleetTravel", "Can't add during travel");
		return false;
	}

	if (Fleet->IsTraveling())
	{
		OutInfo = LOCTEXT("MergeOtherFleetTravel", "Can't add travelling ships");
		return false;
	}

	if (GetCurrentSector() != Fleet->GetCurrentSector())
	{
		OutInfo = LOCTEXT("MergeFleetDifferenSector", "Can't add from a different sector");
		return false;
	}

	return true;
}
Example #2
0
int Hex::GetShipCount(const Colour& c, ShipType type) const
{
    auto squad = FindSquadron(c, type);
    return squad ? squad->GetShipCount() : 0;
}
Example #3
0
bool Hex::HasShip(const Colour& c, ShipType type) const
{
    return GetShipCount(c, type) > 0;
}