Merge branch 'cargo_type_order' into jgrpp
# Conflicts: # src/pathfinder/yapf/yapf_common.hpp # src/saveload/extended_ver_sl.cpp # src/saveload/order_sl.cpp # src/saveload/station_sl.cpp # src/track_func.h
This commit is contained in:
@@ -2721,12 +2721,12 @@ void Vehicle::CancelReservation(StationID next, Station *st)
|
||||
}
|
||||
}
|
||||
|
||||
uint32 Vehicle::GetLastLoadingStationValidCargoMask() const
|
||||
CargoTypes Vehicle::GetLastLoadingStationValidCargoMask() const
|
||||
{
|
||||
if (!HasBit(this->vehicle_flags, VF_LAST_LOAD_ST_SEP)) {
|
||||
return (this->last_loading_station != INVALID_STATION) ? ~0 : 0;
|
||||
return (this->last_loading_station != INVALID_STATION) ? ALL_CARGOTYPES : 0;
|
||||
} else {
|
||||
uint32 cargo_mask = 0;
|
||||
CargoTypes cargo_mask = 0;
|
||||
for (const Vehicle *u = this; u != NULL; u = u->Next()) {
|
||||
if (u->cargo_type < NUM_CARGO && u->last_loading_station != INVALID_STATION) {
|
||||
SetBit(cargo_mask, u->cargo_type);
|
||||
@@ -2761,11 +2761,11 @@ void Vehicle::LeaveStation()
|
||||
/* Only update the timetable if the vehicle was supposed to stop here. */
|
||||
if (this->current_order.GetNonStopType() != ONSF_STOP_EVERYWHERE) UpdateVehicleTimetable(this, false);
|
||||
|
||||
uint32 cargoes_can_load_unload = this->current_order.FilterLoadUnloadTypeCargoMask([&](const Order *o, CargoID cargo) {
|
||||
CargoTypes cargoes_can_load_unload = this->current_order.FilterLoadUnloadTypeCargoMask([&](const Order *o, CargoID cargo) {
|
||||
return ((o->GetCargoLoadType(cargo) & OLFB_NO_LOAD) == 0) || ((o->GetCargoUnloadType(cargo) & OUFB_NO_UNLOAD) == 0);
|
||||
});
|
||||
uint32 has_cargo_mask = this->GetLastLoadingStationValidCargoMask();
|
||||
uint32 cargoes_can_leave_with_cargo = FilterCargoMask([&](CargoID cargo) {
|
||||
CargoTypes has_cargo_mask = this->GetLastLoadingStationValidCargoMask();
|
||||
CargoTypes cargoes_can_leave_with_cargo = FilterCargoMask([&](CargoID cargo) {
|
||||
return this->current_order.CanLeaveWithCargo(HasBit(has_cargo_mask, cargo), cargo);
|
||||
}, cargoes_can_load_unload);
|
||||
|
||||
@@ -2778,7 +2778,7 @@ void Vehicle::LeaveStation()
|
||||
LinkRefresher::Run(this, true, false, cargoes_can_leave_with_cargo);
|
||||
}
|
||||
|
||||
if (cargoes_can_leave_with_cargo == (uint32) ~0) {
|
||||
if (cargoes_can_leave_with_cargo == ALL_CARGOTYPES) {
|
||||
/* can leave with all cargoes */
|
||||
|
||||
/* if the vehicle could load here or could stop with cargo loaded set the last loading station */
|
||||
|
Reference in New Issue
Block a user