/* //returns the number of free gates for an airport public int getNumberOfFreeGates(Airline airline) { var contracts = this.Airport.getAirlineContracts(airline).Where(c => c.ContractDate <= GameObject.GetInstance().GameTime); if (contracts.Count() == 0) return 0; int gates = contracts.Sum(c => c.NumberOfGates); return gates - (AirportHelpers.GetAirportRoutes(this.Airport, airline).Count / Gate.RoutesPerGate); }*/ //switches from one airline to another public void switchAirline(Airline airlineFrom, Airline airlineTo) { List<AirportContract> contracts = this.Airport.getAirlineContracts(airlineFrom); foreach (AirportContract contractFrom in contracts) { contractFrom.Airline = airlineTo; } airlineFrom.removeAirport(this.Airport); if (!airlineTo.Airports.Contains(this.Airport)) airlineTo.addAirport(this.Airport); }
/* //returns the number of free gates for an airport public int getNumberOfFreeGates(Airline airline) { var contracts = this.Airport.getAirlineContracts(airline).Where(c => c.ContractDate <= GameObject.GetInstance().GameTime); if (contracts.Count() == 0) return 0; int gates = contracts.Sum(c => c.NumberOfGates); return gates - (AirportHelpers.GetAirportRoutes(this.Airport, airline).Count / Gate.RoutesPerGate); }*/ //switches from one airline to another public void switchAirline(Airline airlineFrom, Airline airlineTo) { List<AirportContract> contracts = this.Airport.getAirlineContracts(airlineFrom); foreach (AirportContract contractFrom in contracts) { contractFrom.Airline = airlineTo; for (int i = 0; i < contractFrom.NumberOfGates; i++) { Gate gate = contractFrom.Airport.Terminals.getGates().Where(g => g.Airline == airlineFrom).First(); gate.Airline = airlineTo; } } airlineFrom.removeAirport(this.Airport); if (!airlineTo.Airports.Contains(this.Airport)) airlineTo.addAirport(this.Airport); }