Codechange: Make order load/unload flags value types. (#14861)

Order Load and Unload flags have complex logic to ensure that invalid combinations aren't used. In fact, apart from FullLoad and FullLoadAny, all mixed combinations are invalid.

Simplify logic by removing the use of bit values and treat each option as a value.
This commit is contained in:
Peter Nelson
2025-12-06 18:30:31 +00:00
committed by dP
parent a8f0d5a3ad
commit eab0f70eb5
16 changed files with 175 additions and 132 deletions

View File

@@ -1020,7 +1020,7 @@ static uint32_t VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *objec
}
const Order &order = v->First()->current_order;
bool not_loading = (order.GetUnloadType() & OUFB_NO_UNLOAD) && (order.GetLoadType() & OLFB_NO_LOAD);
bool not_loading = order.GetUnloadType() == OrderUnloadType::NoUnload && order.GetLoadType() == OrderLoadType::NoLoad;
bool in_motion = !order.IsType(OT_LOADING) || not_loading;
uint totalsets = static_cast<uint>(in_motion ? group.loaded.size() : group.loading.size());