diff options
Diffstat (limited to 'src/aircraft_cmd.cpp')
-rw-r--r-- | src/aircraft_cmd.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index 385eb9be1..93554585e 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -36,6 +36,7 @@ #include "core/random_func.hpp" #include "core/backup_type.hpp" #include "zoom_func.h" +#include "cargotype.h" #include "table/strings.h" @@ -575,6 +576,13 @@ void UpdateAircraftCache(Aircraft *v, bool update_range) /* Squared it now so we don't have to do it later all the time. */ v->acache.cached_max_range_sqr = v->acache.cached_max_range * v->acache.cached_max_range; } + + /* Cache carried cargo types. */ + uint32 cargo_mask = 0; + for (Aircraft *u = v; u != NULL; u = u->Next()) { + if (u->cargo_type != INVALID_CARGO && u->cargo_cap > 0) SetBit(cargo_mask, u->cargo_type); + } + v->vcache.cached_cargo_mask = cargo_mask; } @@ -1221,7 +1229,6 @@ static void AircraftEntersTerminal(Aircraft *v) if (v->current_order.IsType(OT_GOTO_DEPOT)) return; Station *st = Station::Get(v->targetairport); - v->last_station_visited = v->targetairport; /* Check if station was ever visited before */ if (!(st->had_vehicle_of_type & HVOT_AIRCRAFT)) { @@ -1238,7 +1245,7 @@ static void AircraftEntersTerminal(Aircraft *v) Game::NewEvent(new ScriptEventStationFirstVehicle(st->index, v->index)); } - v->BeginLoading(); + v->BeginLoading(v->targetairport); } /** |