station_cmd.c
changeset 3471 e454e2c0c23e
parent 3435 dfba5b1c7c2d
child 3474 acaa3ba24f2e
equal deleted inserted replaced
3470:cd704e52732f 3471:e454e2c0c23e
  1478 // Heliport
  1478 // Heliport
  1479 static const byte _airport_sections_heliport[] = {
  1479 static const byte _airport_sections_heliport[] = {
  1480 	66,
  1480 	66,
  1481 };
  1481 };
  1482 
  1482 
  1483 static const byte * const _airport_map5_tiles[] = {
  1483 static const byte * const _airport_sections[] = {
  1484 	_airport_sections_country,				// Country Airfield (small)
  1484 	_airport_sections_country,				// Country Airfield (small)
  1485 	_airport_sections_town,						// City Airport (large)
  1485 	_airport_sections_town,						// City Airport (large)
  1486 	_airport_sections_heliport,				// Heliport
  1486 	_airport_sections_heliport,				// Heliport
  1487 	_airport_sections_metropolitan,   // Metropolitain Airport (large)
  1487 	_airport_sections_metropolitan,   // Metropolitain Airport (large)
  1488 	_airport_sections_international,	// International Airport (xlarge)
  1488 	_airport_sections_international,	// International Airport (xlarge)
  1504 	bool airport_upgrade = true;
  1504 	bool airport_upgrade = true;
  1505 
  1505 
  1506 	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
  1506 	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
  1507 
  1507 
  1508 	/* Check if a valid, buildable airport was chosen for construction */
  1508 	/* Check if a valid, buildable airport was chosen for construction */
  1509 	if (p1 > lengthof(_airport_map5_tiles) || !HASBIT(GetValidAirports(), p1)) return CMD_ERROR;
  1509 	if (p1 > lengthof(_airport_sections) || !HASBIT(GetValidAirports(), p1)) return CMD_ERROR;
  1510 
  1510 
  1511 	tile = TileVirtXY(x, y);
  1511 	tile = TileVirtXY(x, y);
  1512 
  1512 
  1513 	if (!(flags & DC_NO_TOWN_RATING) && !CheckIfAuthorityAllows(tile))
  1513 	if (!(flags & DC_NO_TOWN_RATING) && !CheckIfAuthorityAllows(tile))
  1514 		return CMD_ERROR;
  1514 		return CMD_ERROR;
  1599 		 * 2. airport is added to existing station (unfortunately unavoideable)
  1599 		 * 2. airport is added to existing station (unfortunately unavoideable)
  1600 		 */
  1600 		 */
  1601 		if (airport_upgrade) UpdateAirplanesOnNewStation(st);
  1601 		if (airport_upgrade) UpdateAirplanesOnNewStation(st);
  1602 
  1602 
  1603 		{
  1603 		{
  1604 			const byte *b = _airport_map5_tiles[p1];
  1604 			const byte *b = _airport_sections[p1];
  1605 
  1605 
  1606 			BEGIN_TILE_LOOP(tile_cur, w, h, tile) {
  1606 			BEGIN_TILE_LOOP(tile_cur, w, h, tile) {
  1607 				MakeAirport(tile_cur, st->owner, st->index, *b++);
  1607 				MakeAirport(tile_cur, st->owner, st->index, *b++);
  1608 			} END_TILE_LOOP(tile_cur, w, h, tile)
  1608 			} END_TILE_LOOP(tile_cur, w, h, tile)
  1609 		}
  1609 		}