예제 #1
0
void TeamState::InitHex(const Team& team, const MapPos& pos, int rotation, Map& map)
{
	Race race(team.GetRace());

	Hex& hex = map.AddHex(HexPtr(new Hex(race.GetStartSector(team.GetColour()), pos, rotation)));
	hex.SetColour(team.GetColour());
	m_infTrack.RemoveDiscs(1);

	for (Square* pSquare : hex.GetAvailableSquares(team))
	{
		m_popTrack.Remove(SquareTypeToResource(pSquare->GetType()), 1);
		pSquare->SetOccupied(true);
	}

	ShipType ship = race.GetStartShip();
	hex.AddShip(ship, team.GetColour());
	RemoveShips(ship, 1);
}
예제 #2
0
파일: Hex.cpp 프로젝트: molip/Eclipsoid
std::vector<Square*> Hex::GetAvailableSquares(const Team& team)
{
    VERIFY_MODEL(m_colour == team.GetColour());

    std::vector<Square*> squares;

    for (Square& s : m_squares)
        if (!s.IsOccupied() && s.CanOccupy(team))
            squares.push_back(&s);
    return squares;
}
예제 #3
0
파일: Hex.cpp 프로젝트: molip/Eclipsoid
int Hex::GetPinnage(const Team& team) const
{
    int nPinnage = 0;
    for (auto& fleet : m_fleets)
    {
        if (fleet.FindSquadron(ShipType::GCDS))
            return 1000;
        if (!(Race(team.GetRace()).IsAncientsAlly() && fleet.GetColour() == Colour::None))
            nPinnage += (fleet.GetColour() == team.GetColour() ? -1 : 1) * fleet.GetShipCount();
    }
    return nPinnage;
}
예제 #4
0
파일: Hex.cpp 프로젝트: molip/Eclipsoid
bool Hex::IsOwnedBy(const Team& team) const
{
    return m_colour == team.GetColour();
}
예제 #5
0
파일: Hex.cpp 프로젝트: molip/Eclipsoid
bool Hex::CanExploreFrom(const Team& team) const
{
    // "...next to a hex where you have a Ship or an Influence Disc"
    // "If you Explore from a hex with only a Ship, it must not be pinned"
    return IsOwnedBy(team) || (HasShip(team.GetColour()) && CanMoveOut(team));
}