diff --git a/src/airport.h b/src/airport.h index f20c054a9c..cc220502eb 100644 --- a/src/airport.h +++ b/src/airport.h @@ -35,9 +35,9 @@ enum AirportTypes { AT_HELIDEPOT = 6, ///< Heli depot. AT_INTERCON = 7, ///< Intercontinental airport. AT_HELISTATION = 8, ///< Heli station airport. - AT_INTERCONTINENTAL2 = 9, ///< Intercontinental airport 2. - AT_CIRCLE = 10, ///< Circle airport. - AT_OILRIG = 11, ///< Oilrig airport. + AT_OILRIG = 9, ///< Oilrig airport. + AT_INTERCONTINENTAL2 = 10, ///< Intercontinental airport 2. + AT_CIRCLE = 11, ///< Circle airport. NEW_AIRPORT_OFFSET = 12, ///< Number of the first newgrf airport. NUM_AIRPORTS = 128, ///< Maximal number of airports. NUM_AIRPORTS_PER_GRF = 128, diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index 8123d86e43..b9a2398134 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -880,7 +880,18 @@ bool AfterLoadGame() } } } - + if(SlXvIsFeaturePresent(XSLFI_HUGE_AIRPORTS, 1, 1)) { + /* This version of the JGR huge airports patch shifted the IDs of the airports, which caused other problems. */ + for (Station *st : Station::Iterate()) { + if (st->airport.tile == INVALID_TILE) continue; + if (st->airport.type == 11) { /* oil rig */ + st->airport.type = AT_OILRIG; /* Shift ID */ + } else if(st->airport.type == 9) /* intercontinental 2 */ + st->airport.type = AT_INTERCONTINENTAL2; + else if(st->airport.type == 10) /* circle */ + st->airport.type = AT_CIRCLE; + } + } if (SlXvIsFeaturePresent(XSLFI_SPRINGPP)) { /* * Reject huge airports @@ -909,10 +920,12 @@ bool AfterLoadGame() } } - if (SlXvIsFeaturePresent(XSLFI_SPRINGPP, 1, 1)) { + if (SlXvIsFeaturePresent(XSLFI_HUGE_AIRPORTS, 1, 1) || SlXvIsFeaturePresent(XSLFI_SPRINGPP, 1, 1)) { /* * Reject helicopters aproaching oil rigs using the wrong aircraft movement data - * Annoyingly SpringPP v2.0.102 has a bug where it uses the same ID for AT_INTERCONTINENTAL2 and AT_OILRIG + * Annoyingly SpringPP v2.0.102 has a bug where it uses the same ID for AT_INTERCONTINENTAL2 and AT_OILRIG. + * The initial commit of the huge airports patch also had a bug where IDs had been swapped, + * which caused issues with old savegames loaded in that version. * Do this here as AfterLoadVehicles can also check it indirectly via the newgrf code. */ for (Aircraft *v : Aircraft::Iterate()) { diff --git a/src/saveload/extended_ver_sl.cpp b/src/saveload/extended_ver_sl.cpp index b0297ae695..84009a787f 100644 --- a/src/saveload/extended_ver_sl.cpp +++ b/src/saveload/extended_ver_sl.cpp @@ -113,7 +113,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = { { XSLFI_FLOW_STAT_FLAGS, XSCF_NULL, 1, 1, "flow_stat_flags", nullptr, nullptr, nullptr }, { XSLFI_SPEED_RESTRICTION, XSCF_NULL, 1, 1, "speed_restriction", nullptr, nullptr, "VESR" }, { XSLFI_STATION_GOODS_EXTRA, XSCF_NULL, 1, 1, "station_goods_extra", nullptr, nullptr, nullptr }, - { XSLFI_HUGE_AIRPORTS, XSCF_NULL, 1, 1, "huge_airports", nullptr, nullptr, nullptr }, + { XSLFI_HUGE_AIRPORTS, XSCF_NULL, 2, 2, "huge_airports", nullptr, nullptr, nullptr }, { XSLFI_TRIP_HISTORY, XSCF_NULL, 1, 1, "trip_history", nullptr, nullptr, nullptr }, { XSLFI_NULL, XSCF_NULL, 0, 0, nullptr, nullptr, nullptr, nullptr },// This is the end marker }; diff --git a/src/table/airport_defaults.h b/src/table/airport_defaults.h index bffccc5731..527622def2 100644 --- a/src/table/airport_defaults.h +++ b/src/table/airport_defaults.h @@ -773,9 +773,9 @@ extern const AirportSpec _origin_airport_specs[] = { AS(helidepot, 2, 2, 1976, MAX_YEAR, 4, 2, 7, ATP_TTDP_SMALL, APC_HELIPORT, STR_AIRPORT_HELIDEPOT, SPR_AIRPORT_PREVIEW_HELIDEPOT), AS(intercontinental, 9, 11, 2002, MAX_YEAR, 10, 25, 72, ATP_TTDP_LARGE, APC_HUB, STR_AIRPORT_INTERCONTINENTAL, SPR_AIRPORT_PREVIEW_INTERCONTINENTAL), AS(helistation, 4, 2, 1980, MAX_YEAR, 4, 3, 14, ATP_TTDP_SMALL, APC_HELIPORT, STR_AIRPORT_HELISTATION, SPR_AIRPORT_PREVIEW_HELISTATION), - AS(intercontinental2,12,10, 2005, MAX_YEAR, 11, 30, 80, ATP_TTDP_LARGE, APC_HUGE, STR_AIRPORT_INTERCONTINENTAL2, 0), - AS_C(circle, 15,15, 2015, MAX_YEAR, 15, 50,150, 30, ATP_TTDP_LARGE,APC_HUGE, STR_AIRPORT_CIRCLE, 0), AS_GENERIC(&_airportfta_oilrig, nullptr, _default_airports_rotation, 0, nullptr, 0, 1, 1, 0, 4, 0, 0, 0, 0, ATP_TTDP_OILRIG, APC_HELIPORT, STR_NULL, 0, false), + AS(intercontinental2,12,10, 2005, MAX_YEAR, 11, 30, 80, ATP_TTDP_LARGE, APC_HUGE, STR_AIRPORT_INTERCONTINENTAL2, 0), + AS_C(circle, 15,15, 2015, MAX_YEAR, 15, 50,150, 30, ATP_TTDP_LARGE,APC_HUGE, STR_AIRPORT_CIRCLE, 0) }; assert_compile(NEW_AIRPORT_OFFSET == lengthof(_origin_airport_specs));