Change name of Order cargo-typed get load/unload type accessors.

Move helper functions to get cargo-specific type in cargo-specific
mode, into Order class.
This commit is contained in:
Jonathan G Rennison
2016-09-03 22:59:19 +01:00
parent 7178ef22e5
commit ed99dd2583
3 changed files with 39 additions and 18 deletions

View File

@@ -136,12 +136,25 @@ public:
* @param cargo_id The cargo type index.
* @return The load type for this cargo.
*/
inline OrderLoadFlags GetLoadType(CargoID cargo_id) const
inline OrderLoadFlags GetCargoLoadTypeRaw(CargoID cargo_id) const
{
assert(cargo_id < NUM_CARGO);
return (OrderLoadFlags) GB(this->cargo_type_flags[cargo_id], 4, 4);
}
/**
* How must the consist be loaded for this type of cargo?
* @param cargo_id The cargo type index.
* @return The load type for this cargo.
*/
inline OrderLoadFlags GetCargoLoadType(CargoID cargo_id) const
{
assert(cargo_id < NUM_CARGO);
OrderLoadFlags olf = this->GetLoadType();
if (olf == OLFB_CARGO_TYPE_LOAD) olf = this->GetCargoLoadTypeRaw(cargo_id);
return olf;
}
/** How must the consist be unloaded? */
inline OrderUnloadFlags GetUnloadType() const { return (OrderUnloadFlags)GB(this->flags, 0, 4); }
@@ -151,12 +164,25 @@ public:
* @param cargo_id The cargo type index.
* @return The unload type for this cargo.
*/
inline OrderUnloadFlags GetUnloadType(CargoID cargo_id) const
inline OrderUnloadFlags GetCargoUnloadTypeRaw(CargoID cargo_id) const
{
assert(cargo_id < NUM_CARGO);
return (OrderUnloadFlags) GB(this->cargo_type_flags[cargo_id], 0, 4);
}
/**
* How must the consist be unloaded for this type of cargo?
* @param cargo_id The cargo type index.
* @return The unload type for this cargo.
*/
inline OrderUnloadFlags GetCargoUnloadType(CargoID cargo_id) const
{
assert(cargo_id < NUM_CARGO);
OrderUnloadFlags ouf = this->GetUnloadType();
if (ouf == OUFB_CARGO_TYPE_UNLOAD) ouf = this->GetCargoUnloadTypeRaw(cargo_id);
return ouf;
}
/** At which stations must we stop? */
inline OrderNonStopFlags GetNonStopType() const { return (OrderNonStopFlags)GB(this->type, 6, 2); }
/** Where must we stop at the platform? */