Fix order backup not copying dispatch schedules when not enabled
See: #559
This commit is contained in:
@@ -56,4 +56,9 @@ void BaseConsist::CopyConsistPropertiesFrom(const BaseConsist *src)
|
||||
} else {
|
||||
ClrBit(this->vehicle_flags, VF_TIMETABLE_SEPARATION);
|
||||
}
|
||||
if (HasBit(src->vehicle_flags, VF_SCHEDULED_DISPATCH)) {
|
||||
SetBit(this->vehicle_flags, VF_SCHEDULED_DISPATCH);
|
||||
} else {
|
||||
ClrBit(this->vehicle_flags, VF_SCHEDULED_DISPATCH);
|
||||
}
|
||||
}
|
||||
|
@@ -68,8 +68,7 @@ OrderBackup::OrderBackup(const Vehicle *v, uint32 user)
|
||||
tail = ©->next;
|
||||
}
|
||||
|
||||
if (v->orders != nullptr && HasBit(v->vehicle_flags, VF_SCHEDULED_DISPATCH)) {
|
||||
SetBit(this->vehicle_flags, VF_SCHEDULED_DISPATCH);
|
||||
if (v->orders != nullptr) {
|
||||
this->dispatch_schedules = v->orders->GetScheduledDispatchScheduleSet();
|
||||
}
|
||||
}
|
||||
@@ -90,10 +89,7 @@ void OrderBackup::DoRestore(Vehicle *v)
|
||||
v->orders = new OrderList(this->orders, v);
|
||||
this->orders = nullptr;
|
||||
|
||||
if (HasBit(this->vehicle_flags, VF_SCHEDULED_DISPATCH)) {
|
||||
SetBit(v->vehicle_flags, VF_SCHEDULED_DISPATCH);
|
||||
v->orders->GetScheduledDispatchScheduleSet() = std::move(this->dispatch_schedules);
|
||||
}
|
||||
|
||||
/* Make sure buoys/oil rigs are updated in the station list. */
|
||||
InvalidateWindowClassesData(WC_STATION_LIST, 0);
|
||||
|
@@ -1432,7 +1432,7 @@ void InsertOrder(Vehicle *v, Order *new_o, VehicleOrderID sel_ord)
|
||||
static CommandCost DecloneOrder(Vehicle *dst, DoCommandFlag flags)
|
||||
{
|
||||
if (flags & DC_EXEC) {
|
||||
/* Clear cheduled dispatch flag if any */
|
||||
/* Clear scheduled dispatch flag if any */
|
||||
if (HasBit(dst->vehicle_flags, VF_SCHEDULED_DISPATCH)) {
|
||||
ClrBit(dst->vehicle_flags, VF_SCHEDULED_DISPATCH);
|
||||
}
|
||||
|
Reference in New Issue
Block a user