Add: Setting to disable aircraft range limit (#15433)

This commit is contained in:
EmperorJake
2026-04-06 00:51:12 +10:00
committed by GitHub
parent 4707f78744
commit fed04d0a03
7 changed files with 37 additions and 1 deletions
+20
View File
@@ -50,6 +50,8 @@
#include "void_map.h"
#include "station_func.h"
#include "station_base.h"
#include "aircraft.h"
#include "aircraft_cmd.h"
#include "table/strings.h"
#include "table/settings.h"
@@ -364,6 +366,24 @@ static void RoadVehSlopeSteepnessChanged(int32_t)
}
}
/**
* This function updates the aircraft cache when the aircraft range setting is changed.
*/
static void AircraftRangeChanged(int32_t)
{
for (Aircraft *v : Aircraft::Iterate()) {
v->acache.cached_max_range = Engine::Get(v->engine_type)->GetRange();
v->acache.cached_max_range_sqr = v->acache.cached_max_range * v->acache.cached_max_range;
/* Reset destination is too far state */
if (v->flags.Test(VehicleAirFlag::DestinationTooFar)) {
v->flags.Reset(VehicleAirFlag::DestinationTooFar);
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP);
DeleteVehicleNews(v->index, AdviceType::AircraftDestinationTooFar);
}
}
}
static void TownFoundingChanged(int32_t)
{
if (_game_mode != GM_EDITOR && _settings_game.economy.found_town == TF_FORBIDDEN) {