Fix #12118: When adding an unbunching order, properly check for unsafe conditions (#12136)

This commit is contained in:
Tyler Trahan
2024-03-09 08:28:05 -05:00
committed by GitHub
parent 6e0f58f700
commit ab315d0dc9
4 changed files with 61 additions and 12 deletions

View File

@@ -2426,6 +2426,30 @@ void Vehicle::HandleLoading(bool mode)
this->IncrementImplicitOrderIndex();
}
/**
* Check if the current vehicle has a full load order.
* @return true Iff this vehicle has a full load order.
*/
bool Vehicle::HasFullLoadOrder() const
{
for (Order *o : this->Orders()) {
if (o->IsType(OT_GOTO_STATION) && o->GetLoadType() & (OLFB_FULL_LOAD | OLF_FULL_LOAD_ANY)) return true;
}
return false;
}
/**
* Check if the current vehicle has a conditional order.
* @return true Iff this vehicle has a conditional order.
*/
bool Vehicle::HasConditionalOrder() const
{
for (Order *o : this->Orders()) {
if (o->IsType(OT_CONDITIONAL)) return true;
}
return false;
}
/**
* Check if the current vehicle has an unbunching order.
* @return true Iff this vehicle has an unbunching order.