Пример #1
0
// try to order any ship that might be needed and is not ordered yet
void nobHarborBuilding::OrderShip()
{
    unsigned needed = GetNeededShipsCount();
    GameClientPlayer& owner = gwg->GetPlayer(player);    

    // Order (possibly) remaining ships
    for(unsigned ordered = owner.GetShipsToHarbor(this); ordered < needed; ++ordered)
    {
        owner.OrderShip(this);
    }
}
Пример #2
0
// try to order any ship that might be needed and is not ordered yet
void nobHarborBuilding::OrderShip()
{
	unsigned needed = GetNeededShipsCount();
	unsigned ordered = players->getElement(player)->GetShipsToHarbor(this);

	if (ordered < needed)
	{
		// need to order more ships
		needed -= ordered;

		while (needed)
		{
			if (players->getElement(player)->OrderShip(this) == false)
			{
				break;
			}

			needed--;
		}
	}
}