Feature: Order flag to unbunch vehicles at depot (#11945)

This commit is contained in:
Tyler Trahan
2024-02-03 08:04:24 -05:00
committed by GitHub
parent a0c480c4e4
commit f6dd5053a3
20 changed files with 293 additions and 28 deletions

View File

@@ -1765,6 +1765,12 @@ bool AfterLoadGame()
v->current_order.SetLoadType(OLFB_NO_LOAD);
}
}
} else if (IsSavegameVersionBefore(SLV_DEPOT_UNBUNCHING)) {
/* OrderDepotActionFlags were moved, instead of starting at bit 4 they now start at bit 3. */
for (Order *order : Order::Iterate()) {
if (!order->IsType(OT_GOTO_DEPOT)) continue;
order->SetDepotActionType((OrderDepotActionFlags)(order->GetDepotActionType() >> 1));
}
}
/* The water class was moved/unified. */

View File

@@ -374,6 +374,7 @@ enum SaveLoadVersion : uint16_t {
SLV_SHIP_ACCELERATION, ///< 329 PR#10734 Start using Vehicle's acceleration field for ships too.
SLV_MAX_LOAN_FOR_COMPANY, ///< 330 PR#11224 Separate max loan for each company.
SLV_DEPOT_UNBUNCHING, ///< 330 PR#11945 Allow unbunching shared order vehicles at a depot.
SL_MAX_VERSION, ///< Highest possible saveload version
};

View File

@@ -738,6 +738,10 @@ public:
SLE_CONDVAR(Vehicle, current_order_time, SLE_INT32, SLV_TIMETABLE_TICKS_TYPE, SL_MAX_VERSION),
SLE_CONDVAR(Vehicle, last_loading_tick, SLE_UINT64, SLV_LAST_LOADING_TICK, SL_MAX_VERSION),
SLE_CONDVAR(Vehicle, lateness_counter, SLE_INT32, SLV_67, SL_MAX_VERSION),
SLE_CONDVAR(Vehicle, depot_unbunching_last_departure, SLE_UINT64, SLV_DEPOT_UNBUNCHING, SL_MAX_VERSION),
SLE_CONDVAR(Vehicle, depot_unbunching_next_departure, SLE_UINT64, SLV_DEPOT_UNBUNCHING, SL_MAX_VERSION),
SLE_CONDVAR(Vehicle, round_trip_time, SLE_INT32, SLV_DEPOT_UNBUNCHING, SL_MAX_VERSION),
};
#if defined(_MSC_VER) && (_MSC_VER == 1915 || _MSC_VER == 1916)
return description;