diff --git a/src/script/api/script_order.cpp b/src/script/api/script_order.cpp index e37ed9d1b3..bab0603ea5 100644 --- a/src/script/api/script_order.cpp +++ b/src/script/api/script_order.cpp @@ -207,12 +207,11 @@ static ScriptOrder::OrderPosition RealOrderPositionToScriptOrderPosition(Vehicle case OT_GOTO_STATION: return (order_flags & ~(OF_NON_STOP_FLAGS | OF_UNLOAD_FLAGS | OF_LOAD_FLAGS)) == 0 && /* Test the different mutual exclusive flags. */ - ((order_flags & OF_TRANSFER) == 0 || (order_flags & OF_UNLOAD) == 0) && - ((order_flags & OF_TRANSFER) == 0 || (order_flags & OF_NO_UNLOAD) == 0) && - ((order_flags & OF_UNLOAD) == 0 || (order_flags & OF_NO_UNLOAD) == 0) && - ((order_flags & OF_UNLOAD) == 0 || (order_flags & OF_NO_UNLOAD) == 0) && - ((order_flags & OF_NO_UNLOAD) == 0 || (order_flags & OF_NO_LOAD) == 0) && - ((order_flags & OF_FULL_LOAD_ANY) == 0 || (order_flags & OF_NO_LOAD) == 0); + HasAtMostOneBit(order_flags & (OF_TRANSFER | OF_UNLOAD | OF_NO_UNLOAD)) && + HasAtMostOneBit(order_flags & (OF_NO_UNLOAD | OF_NO_LOAD)) && + HasAtMostOneBit(order_flags & (OF_FULL_LOAD | OF_NO_LOAD)) && + /* "Full load any" is "Full load" plus a bit. On its own that bit is invalid. */ + ((order_flags & OF_FULL_LOAD_ANY) != (OF_FULL_LOAD_ANY & ~OF_FULL_LOAD)); case OT_GOTO_DEPOT: return (order_flags & ~(OF_NON_STOP_FLAGS | OF_DEPOT_FLAGS)) == 0 && diff --git a/src/script/api/script_order.hpp b/src/script/api/script_order.hpp index 5a2e54e947..1ecddfc226 100644 --- a/src/script/api/script_order.hpp +++ b/src/script/api/script_order.hpp @@ -57,9 +57,9 @@ public: /** Never unload the vehicle; only for stations. Cannot be set when OF_UNLOAD, OF_TRANSFER or OF_NO_LOAD is set. */ OF_NO_UNLOAD = 1 << 4, - /** Wt till the vehicle is fully loaded; only for stations. Cannot be set when OF_NO_LOAD is set. */ + /** Wait till the vehicle is fully loaded; only for stations. Cannot be set when OF_NO_LOAD is set. */ OF_FULL_LOAD = 2 << 5, - /** Wt till at least one cargo of the vehicle is fully loaded; only for stations. Cannot be set when OF_NO_LOAD is set. */ + /** Wait till at least one cargo of the vehicle is fully loaded; only for stations. Cannot be set when OF_NO_LOAD is set. */ OF_FULL_LOAD_ANY = 3 << 5, /** Do not load any cargo; only for stations. Cannot be set when OF_NO_UNLOAD, OF_FULL_LOAD or OF_FULL_LOAD_ANY is set. */ OF_NO_LOAD = 1 << 7,