Merge branch 'master' into jgrpp

# Conflicts:
#	src/lang/czech.txt
#	src/lang/galician.txt
#	src/lang/german.txt
#	src/order_cmd.cpp
#	src/saveload/afterload.cpp
#	src/ship.h
#	src/vehicle.cpp
This commit is contained in:
Jonathan G Rennison
2023-01-05 23:45:34 +00:00
37 changed files with 2358 additions and 1572 deletions

View File

@@ -414,7 +414,7 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, const Engine *
}
bool Aircraft::FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse)
ClosestDepot Aircraft::FindClosestDepot()
{
const Station *st = GetTargetAirportIfValid(this);
/* If the station is not a valid airport or if it has no hangars */
@@ -422,15 +422,12 @@ bool Aircraft::FindClosestDepot(TileIndex *location, DestinationID *destination,
/* the aircraft has to search for a hangar on its own */
StationID station = FindNearestHangar(this);
if (station == INVALID_STATION) return false;
if (station == INVALID_STATION) return ClosestDepot();
st = Station::Get(station);
}
if (location != nullptr) *location = st->xy;
if (destination != nullptr) *destination = st->index;
return true;
return ClosestDepot(st->xy, st->index);
}
static void CheckIfAircraftNeedsService(Aircraft *v)
@@ -1217,7 +1214,8 @@ void FindBreakdownDestination(Aircraft *v)
DestinationID destination = INVALID_STATION;
if (v->breakdown_type == BREAKDOWN_AIRCRAFT_DEPOT) {
/* Go to a hangar, if possible at our current destination */
v->FindClosestDepot(nullptr, &destination, nullptr);
ClosestDepot closestDepot = v->FindClosestDepot();
if (closestDepot.found) destination = closestDepot.destination;
} else if (v->breakdown_type == BREAKDOWN_AIRCRAFT_EM_LANDING) {
/* Go to the nearest airport with a hangar */
destination = FindNearestHangar(v);
@@ -1225,7 +1223,7 @@ void FindBreakdownDestination(Aircraft *v)
NOT_REACHED();
}
if(destination != INVALID_STATION) {
if (destination != INVALID_STATION) {
if(destination != v->current_order.GetDestination()) {
v->current_order.MakeGoToDepot(destination, ODTFB_BREAKDOWN);
if (v->state == FLYING) {