diff options
author | rubidium <rubidium@openttd.org> | 2012-03-04 16:40:06 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2012-03-04 16:40:06 +0000 |
commit | e6a828def1b25671b4115903cb81d97c4e2348d6 (patch) | |
tree | 2940dc3adf4fef35d6e7a32540dd08b5e408a3ea /src | |
parent | 26df0fb5938733000d01b0ac263449b4a3c1371b (diff) | |
download | openttd-e6a828def1b25671b4115903cb81d97c4e2348d6.tar.xz |
(svn r24006) -Fix [FS#5088]: AI used in names in API for GSOrder
Diffstat (limited to 'src')
-rw-r--r-- | src/script/api/ai/ai_order.hpp.sq | 34 | ||||
-rw-r--r-- | src/script/api/ai_changelog.hpp | 1 | ||||
-rw-r--r-- | src/script/api/game/game_order.hpp.sq | 34 | ||||
-rw-r--r-- | src/script/api/script_order.cpp | 66 | ||||
-rw-r--r-- | src/script/api/script_order.hpp | 50 |
5 files changed, 93 insertions, 92 deletions
diff --git a/src/script/api/ai/ai_order.hpp.sq b/src/script/api/ai/ai_order.hpp.sq index 9916c5808..71cc8cfe9 100644 --- a/src/script/api/ai/ai_order.hpp.sq +++ b/src/script/api/ai/ai_order.hpp.sq @@ -25,23 +25,23 @@ void SQAIOrder_Register(Squirrel *engine) SQAIOrder.DefSQConst(engine, ScriptOrder::ERR_ORDER_TOO_MANY, "ERR_ORDER_TOO_MANY"); SQAIOrder.DefSQConst(engine, ScriptOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION, "ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION"); SQAIOrder.DefSQConst(engine, ScriptOrder::ERR_ORDER_AIRCRAFT_NOT_ENOUGH_RANGE, "ERR_ORDER_AIRCRAFT_NOT_ENOUGH_RANGE"); - SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_NONE, "AIOF_NONE"); - SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_NON_STOP_INTERMEDIATE, "AIOF_NON_STOP_INTERMEDIATE"); - SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_NON_STOP_DESTINATION, "AIOF_NON_STOP_DESTINATION"); - SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_UNLOAD, "AIOF_UNLOAD"); - SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_TRANSFER, "AIOF_TRANSFER"); - SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_NO_UNLOAD, "AIOF_NO_UNLOAD"); - SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_FULL_LOAD, "AIOF_FULL_LOAD"); - SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_FULL_LOAD_ANY, "AIOF_FULL_LOAD_ANY"); - SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_NO_LOAD, "AIOF_NO_LOAD"); - SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_SERVICE_IF_NEEDED, "AIOF_SERVICE_IF_NEEDED"); - SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_STOP_IN_DEPOT, "AIOF_STOP_IN_DEPOT"); - SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_GOTO_NEAREST_DEPOT, "AIOF_GOTO_NEAREST_DEPOT"); - SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_NON_STOP_FLAGS, "AIOF_NON_STOP_FLAGS"); - SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_UNLOAD_FLAGS, "AIOF_UNLOAD_FLAGS"); - SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_LOAD_FLAGS, "AIOF_LOAD_FLAGS"); - SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_DEPOT_FLAGS, "AIOF_DEPOT_FLAGS"); - SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_INVALID, "AIOF_INVALID"); + SQAIOrder.DefSQConst(engine, ScriptOrder::OF_NONE, "OF_NONE"); + SQAIOrder.DefSQConst(engine, ScriptOrder::OF_NON_STOP_INTERMEDIATE, "OF_NON_STOP_INTERMEDIATE"); + SQAIOrder.DefSQConst(engine, ScriptOrder::OF_NON_STOP_DESTINATION, "OF_NON_STOP_DESTINATION"); + SQAIOrder.DefSQConst(engine, ScriptOrder::OF_UNLOAD, "OF_UNLOAD"); + SQAIOrder.DefSQConst(engine, ScriptOrder::OF_TRANSFER, "OF_TRANSFER"); + SQAIOrder.DefSQConst(engine, ScriptOrder::OF_NO_UNLOAD, "OF_NO_UNLOAD"); + SQAIOrder.DefSQConst(engine, ScriptOrder::OF_FULL_LOAD, "OF_FULL_LOAD"); + SQAIOrder.DefSQConst(engine, ScriptOrder::OF_FULL_LOAD_ANY, "OF_FULL_LOAD_ANY"); + SQAIOrder.DefSQConst(engine, ScriptOrder::OF_NO_LOAD, "OF_NO_LOAD"); + SQAIOrder.DefSQConst(engine, ScriptOrder::OF_SERVICE_IF_NEEDED, "OF_SERVICE_IF_NEEDED"); + SQAIOrder.DefSQConst(engine, ScriptOrder::OF_STOP_IN_DEPOT, "OF_STOP_IN_DEPOT"); + SQAIOrder.DefSQConst(engine, ScriptOrder::OF_GOTO_NEAREST_DEPOT, "OF_GOTO_NEAREST_DEPOT"); + SQAIOrder.DefSQConst(engine, ScriptOrder::OF_NON_STOP_FLAGS, "OF_NON_STOP_FLAGS"); + SQAIOrder.DefSQConst(engine, ScriptOrder::OF_UNLOAD_FLAGS, "OF_UNLOAD_FLAGS"); + SQAIOrder.DefSQConst(engine, ScriptOrder::OF_LOAD_FLAGS, "OF_LOAD_FLAGS"); + SQAIOrder.DefSQConst(engine, ScriptOrder::OF_DEPOT_FLAGS, "OF_DEPOT_FLAGS"); + SQAIOrder.DefSQConst(engine, ScriptOrder::OF_INVALID, "OF_INVALID"); SQAIOrder.DefSQConst(engine, ScriptOrder::OC_LOAD_PERCENTAGE, "OC_LOAD_PERCENTAGE"); SQAIOrder.DefSQConst(engine, ScriptOrder::OC_RELIABILITY, "OC_RELIABILITY"); SQAIOrder.DefSQConst(engine, ScriptOrder::OC_MAX_SPEED, "OC_MAX_SPEED"); diff --git a/src/script/api/ai_changelog.hpp b/src/script/api/ai_changelog.hpp index 03aee661a..d360e465f 100644 --- a/src/script/api/ai_changelog.hpp +++ b/src/script/api/ai_changelog.hpp @@ -62,6 +62,7 @@ * like CONFIG_RANDOM. * \li AIEvent has all its types renamed from AI_ET_ prefix to just ET_ prefix, * like ET_SUBSIDY_OFFER. + * \li AIOrder has all its types renamed from AIOF_ prefix to just OF_ prefix. * * API removals: * \li AICompany::GetCompanyValue, use AICompany::GetQuarterlyCompanyValue instead. diff --git a/src/script/api/game/game_order.hpp.sq b/src/script/api/game/game_order.hpp.sq index 1f1bbf4fa..f95dce925 100644 --- a/src/script/api/game/game_order.hpp.sq +++ b/src/script/api/game/game_order.hpp.sq @@ -25,23 +25,23 @@ void SQGSOrder_Register(Squirrel *engine) SQGSOrder.DefSQConst(engine, ScriptOrder::ERR_ORDER_TOO_MANY, "ERR_ORDER_TOO_MANY"); SQGSOrder.DefSQConst(engine, ScriptOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION, "ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION"); SQGSOrder.DefSQConst(engine, ScriptOrder::ERR_ORDER_AIRCRAFT_NOT_ENOUGH_RANGE, "ERR_ORDER_AIRCRAFT_NOT_ENOUGH_RANGE"); - SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_NONE, "AIOF_NONE"); - SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_NON_STOP_INTERMEDIATE, "AIOF_NON_STOP_INTERMEDIATE"); - SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_NON_STOP_DESTINATION, "AIOF_NON_STOP_DESTINATION"); - SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_UNLOAD, "AIOF_UNLOAD"); - SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_TRANSFER, "AIOF_TRANSFER"); - SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_NO_UNLOAD, "AIOF_NO_UNLOAD"); - SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_FULL_LOAD, "AIOF_FULL_LOAD"); - SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_FULL_LOAD_ANY, "AIOF_FULL_LOAD_ANY"); - SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_NO_LOAD, "AIOF_NO_LOAD"); - SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_SERVICE_IF_NEEDED, "AIOF_SERVICE_IF_NEEDED"); - SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_STOP_IN_DEPOT, "AIOF_STOP_IN_DEPOT"); - SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_GOTO_NEAREST_DEPOT, "AIOF_GOTO_NEAREST_DEPOT"); - SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_NON_STOP_FLAGS, "AIOF_NON_STOP_FLAGS"); - SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_UNLOAD_FLAGS, "AIOF_UNLOAD_FLAGS"); - SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_LOAD_FLAGS, "AIOF_LOAD_FLAGS"); - SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_DEPOT_FLAGS, "AIOF_DEPOT_FLAGS"); - SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_INVALID, "AIOF_INVALID"); + SQGSOrder.DefSQConst(engine, ScriptOrder::OF_NONE, "OF_NONE"); + SQGSOrder.DefSQConst(engine, ScriptOrder::OF_NON_STOP_INTERMEDIATE, "OF_NON_STOP_INTERMEDIATE"); + SQGSOrder.DefSQConst(engine, ScriptOrder::OF_NON_STOP_DESTINATION, "OF_NON_STOP_DESTINATION"); + SQGSOrder.DefSQConst(engine, ScriptOrder::OF_UNLOAD, "OF_UNLOAD"); + SQGSOrder.DefSQConst(engine, ScriptOrder::OF_TRANSFER, "OF_TRANSFER"); + SQGSOrder.DefSQConst(engine, ScriptOrder::OF_NO_UNLOAD, "OF_NO_UNLOAD"); + SQGSOrder.DefSQConst(engine, ScriptOrder::OF_FULL_LOAD, "OF_FULL_LOAD"); + SQGSOrder.DefSQConst(engine, ScriptOrder::OF_FULL_LOAD_ANY, "OF_FULL_LOAD_ANY"); + SQGSOrder.DefSQConst(engine, ScriptOrder::OF_NO_LOAD, "OF_NO_LOAD"); + SQGSOrder.DefSQConst(engine, ScriptOrder::OF_SERVICE_IF_NEEDED, "OF_SERVICE_IF_NEEDED"); + SQGSOrder.DefSQConst(engine, ScriptOrder::OF_STOP_IN_DEPOT, "OF_STOP_IN_DEPOT"); + SQGSOrder.DefSQConst(engine, ScriptOrder::OF_GOTO_NEAREST_DEPOT, "OF_GOTO_NEAREST_DEPOT"); + SQGSOrder.DefSQConst(engine, ScriptOrder::OF_NON_STOP_FLAGS, "OF_NON_STOP_FLAGS"); + SQGSOrder.DefSQConst(engine, ScriptOrder::OF_UNLOAD_FLAGS, "OF_UNLOAD_FLAGS"); + SQGSOrder.DefSQConst(engine, ScriptOrder::OF_LOAD_FLAGS, "OF_LOAD_FLAGS"); + SQGSOrder.DefSQConst(engine, ScriptOrder::OF_DEPOT_FLAGS, "OF_DEPOT_FLAGS"); + SQGSOrder.DefSQConst(engine, ScriptOrder::OF_INVALID, "OF_INVALID"); SQGSOrder.DefSQConst(engine, ScriptOrder::OC_LOAD_PERCENTAGE, "OC_LOAD_PERCENTAGE"); SQGSOrder.DefSQConst(engine, ScriptOrder::OC_RELIABILITY, "OC_RELIABILITY"); SQGSOrder.DefSQConst(engine, ScriptOrder::OC_MAX_SPEED, "OC_MAX_SPEED"); diff --git a/src/script/api/script_order.cpp b/src/script/api/script_order.cpp index e4fb78dae..3ad55de1e 100644 --- a/src/script/api/script_order.cpp +++ b/src/script/api/script_order.cpp @@ -182,23 +182,23 @@ static int ScriptOrderPositionToRealOrderPosition(VehicleID vehicle_id, ScriptOr /* static */ bool ScriptOrder::AreOrderFlagsValid(TileIndex destination, ScriptOrderFlags order_flags) { - OrderType ot = (order_flags & AIOF_GOTO_NEAREST_DEPOT) ? OT_GOTO_DEPOT : ::GetOrderTypeByTile(destination); + OrderType ot = (order_flags & OF_GOTO_NEAREST_DEPOT) ? OT_GOTO_DEPOT : ::GetOrderTypeByTile(destination); switch (ot) { case OT_GOTO_STATION: - return (order_flags & ~(AIOF_NON_STOP_FLAGS | AIOF_UNLOAD_FLAGS | AIOF_LOAD_FLAGS)) == 0 && + return (order_flags & ~(OF_NON_STOP_FLAGS | OF_UNLOAD_FLAGS | OF_LOAD_FLAGS)) == 0 && /* Test the different mutual exclusive flags. */ - ((order_flags & AIOF_TRANSFER) == 0 || (order_flags & AIOF_UNLOAD) == 0) && - ((order_flags & AIOF_TRANSFER) == 0 || (order_flags & AIOF_NO_UNLOAD) == 0) && - ((order_flags & AIOF_UNLOAD) == 0 || (order_flags & AIOF_NO_UNLOAD) == 0) && - ((order_flags & AIOF_UNLOAD) == 0 || (order_flags & AIOF_NO_UNLOAD) == 0) && - ((order_flags & AIOF_NO_UNLOAD) == 0 || (order_flags & AIOF_NO_LOAD) == 0) && - ((order_flags & AIOF_FULL_LOAD_ANY) == 0 || (order_flags & AIOF_NO_LOAD) == 0); + ((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); case OT_GOTO_DEPOT: - return (order_flags & ~(AIOF_NON_STOP_FLAGS | AIOF_DEPOT_FLAGS)) == 0 && - ((order_flags & AIOF_SERVICE_IF_NEEDED) == 0 || (order_flags & AIOF_STOP_IN_DEPOT) == 0); + return (order_flags & ~(OF_NON_STOP_FLAGS | OF_DEPOT_FLAGS)) == 0 && + ((order_flags & OF_SERVICE_IF_NEEDED) == 0 || (order_flags & OF_STOP_IN_DEPOT) == 0); - case OT_GOTO_WAYPOINT: return (order_flags & ~(AIOF_NON_STOP_FLAGS)) == 0; + case OT_GOTO_WAYPOINT: return (order_flags & ~(OF_NON_STOP_FLAGS)) == 0; default: return false; } } @@ -284,18 +284,18 @@ static int ScriptOrderPositionToRealOrderPosition(VehicleID vehicle_id, ScriptOr /* static */ ScriptOrder::ScriptOrderFlags ScriptOrder::GetOrderFlags(VehicleID vehicle_id, OrderPosition order_position) { - if (!IsValidVehicleOrder(vehicle_id, order_position)) return AIOF_INVALID; + if (!IsValidVehicleOrder(vehicle_id, order_position)) return OF_INVALID; const Order *order = ::ResolveOrder(vehicle_id, order_position); - if (order == NULL || order->GetType() == OT_CONDITIONAL || order->GetType() == OT_DUMMY) return AIOF_INVALID; + if (order == NULL || order->GetType() == OT_CONDITIONAL || order->GetType() == OT_DUMMY) return OF_INVALID; - ScriptOrderFlags order_flags = AIOF_NONE; + ScriptOrderFlags order_flags = OF_NONE; order_flags |= (ScriptOrderFlags)order->GetNonStopType(); switch (order->GetType()) { case OT_GOTO_DEPOT: - if (order->GetDepotOrderType() & ODTFB_SERVICE) order_flags |= AIOF_SERVICE_IF_NEEDED; - if (order->GetDepotActionType() & ODATFB_HALT) order_flags |= AIOF_STOP_IN_DEPOT; - if (order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) order_flags |= AIOF_GOTO_NEAREST_DEPOT; + if (order->GetDepotOrderType() & ODTFB_SERVICE) order_flags |= OF_SERVICE_IF_NEEDED; + if (order->GetDepotActionType() & ODATFB_HALT) order_flags |= OF_STOP_IN_DEPOT; + if (order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) order_flags |= OF_GOTO_NEAREST_DEPOT; break; case OT_GOTO_STATION: @@ -458,14 +458,14 @@ static int ScriptOrderPositionToRealOrderPosition(VehicleID vehicle_id, ScriptOr EnforcePrecondition(false, AreOrderFlagsValid(destination, order_flags)); Order order; - OrderType ot = (order_flags & AIOF_GOTO_NEAREST_DEPOT) ? OT_GOTO_DEPOT : ::GetOrderTypeByTile(destination); + OrderType ot = (order_flags & OF_GOTO_NEAREST_DEPOT) ? OT_GOTO_DEPOT : ::GetOrderTypeByTile(destination); switch (ot) { case OT_GOTO_DEPOT: { - OrderDepotTypeFlags odtf = (OrderDepotTypeFlags)(ODTFB_PART_OF_ORDERS | ((order_flags & AIOF_SERVICE_IF_NEEDED) ? ODTFB_SERVICE : 0)); - OrderDepotActionFlags odaf = (OrderDepotActionFlags)(ODATF_SERVICE_ONLY | ((order_flags & AIOF_STOP_IN_DEPOT) ? ODATFB_HALT : 0)); - if (order_flags & AIOF_GOTO_NEAREST_DEPOT) odaf |= ODATFB_NEAREST_DEPOT; - OrderNonStopFlags onsf = (OrderNonStopFlags)((order_flags & AIOF_NON_STOP_INTERMEDIATE) ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE); - if (order_flags & AIOF_GOTO_NEAREST_DEPOT) { + OrderDepotTypeFlags odtf = (OrderDepotTypeFlags)(ODTFB_PART_OF_ORDERS | ((order_flags & OF_SERVICE_IF_NEEDED) ? ODTFB_SERVICE : 0)); + OrderDepotActionFlags odaf = (OrderDepotActionFlags)(ODATF_SERVICE_ONLY | ((order_flags & OF_STOP_IN_DEPOT) ? ODATFB_HALT : 0)); + if (order_flags & OF_GOTO_NEAREST_DEPOT) odaf |= ODATFB_NEAREST_DEPOT; + OrderNonStopFlags onsf = (OrderNonStopFlags)((order_flags & OF_NON_STOP_INTERMEDIATE) ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE); + if (order_flags & OF_GOTO_NEAREST_DEPOT) { order.MakeGoToDepot(0, odtf, onsf, odaf); } else { /* Check explicitly if the order is to a station (for aircraft) or @@ -576,28 +576,28 @@ static void _DoCommandReturnSetOrderFlags(class ScriptInstance *instance) ScriptOrderFlags current = GetOrderFlags(vehicle_id, order_position); - EnforcePrecondition(false, (order_flags & AIOF_GOTO_NEAREST_DEPOT) == (current & AIOF_GOTO_NEAREST_DEPOT)); + EnforcePrecondition(false, (order_flags & OF_GOTO_NEAREST_DEPOT) == (current & OF_GOTO_NEAREST_DEPOT)); - if ((current & AIOF_NON_STOP_FLAGS) != (order_flags & AIOF_NON_STOP_FLAGS)) { - return ScriptObject::DoCommand(0, vehicle_id | (order_pos << 20), (order_flags & AIOF_NON_STOP_FLAGS) << 4 | MOF_NON_STOP, CMD_MODIFY_ORDER, NULL, &::_DoCommandReturnSetOrderFlags); + if ((current & OF_NON_STOP_FLAGS) != (order_flags & OF_NON_STOP_FLAGS)) { + return ScriptObject::DoCommand(0, vehicle_id | (order_pos << 20), (order_flags & OF_NON_STOP_FLAGS) << 4 | MOF_NON_STOP, CMD_MODIFY_ORDER, NULL, &::_DoCommandReturnSetOrderFlags); } switch (order->GetType()) { case OT_GOTO_DEPOT: - if ((current & AIOF_DEPOT_FLAGS) != (order_flags & AIOF_DEPOT_FLAGS)) { + if ((current & OF_DEPOT_FLAGS) != (order_flags & OF_DEPOT_FLAGS)) { uint data = DA_ALWAYS_GO; - if (order_flags & AIOF_SERVICE_IF_NEEDED) data = DA_SERVICE; - if (order_flags & AIOF_STOP_IN_DEPOT) data = DA_STOP; + if (order_flags & OF_SERVICE_IF_NEEDED) data = DA_SERVICE; + if (order_flags & OF_STOP_IN_DEPOT) data = DA_STOP; return ScriptObject::DoCommand(0, vehicle_id | (order_pos << 20), (data << 4) | MOF_DEPOT_ACTION, CMD_MODIFY_ORDER, NULL, &::_DoCommandReturnSetOrderFlags); } break; case OT_GOTO_STATION: - if ((current & AIOF_UNLOAD_FLAGS) != (order_flags & AIOF_UNLOAD_FLAGS)) { - return ScriptObject::DoCommand(0, vehicle_id | (order_pos << 20), (order_flags & AIOF_UNLOAD_FLAGS) << 2 | MOF_UNLOAD, CMD_MODIFY_ORDER, NULL, &::_DoCommandReturnSetOrderFlags); + if ((current & OF_UNLOAD_FLAGS) != (order_flags & OF_UNLOAD_FLAGS)) { + return ScriptObject::DoCommand(0, vehicle_id | (order_pos << 20), (order_flags & OF_UNLOAD_FLAGS) << 2 | MOF_UNLOAD, CMD_MODIFY_ORDER, NULL, &::_DoCommandReturnSetOrderFlags); } - if ((current & AIOF_LOAD_FLAGS) != (order_flags & AIOF_LOAD_FLAGS)) { - return ScriptObject::DoCommand(0, vehicle_id | (order_pos << 20), (order_flags & AIOF_LOAD_FLAGS) >> 1 | MOF_LOAD, CMD_MODIFY_ORDER, NULL, &::_DoCommandReturnSetOrderFlags); + if ((current & OF_LOAD_FLAGS) != (order_flags & OF_LOAD_FLAGS)) { + return ScriptObject::DoCommand(0, vehicle_id | (order_pos << 20), (order_flags & OF_LOAD_FLAGS) >> 1 | MOF_LOAD, CMD_MODIFY_ORDER, NULL, &::_DoCommandReturnSetOrderFlags); } break; diff --git a/src/script/api/script_order.hpp b/src/script/api/script_order.hpp index eb301f50a..4a87c3748 100644 --- a/src/script/api/script_order.hpp +++ b/src/script/api/script_order.hpp @@ -43,45 +43,45 @@ public: */ enum ScriptOrderFlags { /** Just go to the station/depot, stop unload if possible and load if needed. */ - AIOF_NONE = 0, + OF_NONE = 0, /** Do not stop at the stations that are passed when going to the destination. Only for trains and road vehicles. */ - AIOF_NON_STOP_INTERMEDIATE = 1 << 0, + OF_NON_STOP_INTERMEDIATE = 1 << 0, /** Do not stop at the destionation station. Only for trains and road vehicles. */ - AIOF_NON_STOP_DESTINATION = 1 << 1, - - /** Always unload the vehicle; only for stations. Cannot be set when AIOF_TRANSFER or AIOF_NO_UNLOAD is set. */ - AIOF_UNLOAD = 1 << 2, - /** Transfer instead of deliver the goods; only for stations. Cannot be set when AIOF_UNLOAD or AIOF_NO_UNLOAD is set. */ - AIOF_TRANSFER = 1 << 3, - /** Never unload the vehicle; only for stations. Cannot be set when AIOF_UNLOAD, AIOF_TRANSFER or AIOF_NO_LOAD is set. */ - AIOF_NO_UNLOAD = 1 << 4, - - /** Wait till the vehicle is fully loaded; only for stations. Cannot be set when AIOF_NO_LOAD is set. */ - AIOF_FULL_LOAD = 2 << 5, - /** Wait till at least one cargo of the vehicle is fully loaded; only for stations. Cannot be set when AIOF_NO_LOAD is set. */ - AIOF_FULL_LOAD_ANY = 3 << 5, - /** Do not load any cargo; only for stations. Cannot be set when AIOF_NO_UNLOAD, AIOF_FULL_LOAD or AIOF_FULL_LOAD_ANY is set. */ - AIOF_NO_LOAD = 1 << 7, + OF_NON_STOP_DESTINATION = 1 << 1, + + /** Always unload the vehicle; only for stations. Cannot be set when OF_TRANSFER or OF_NO_UNLOAD is set. */ + OF_UNLOAD = 1 << 2, + /** Transfer instead of deliver the goods; only for stations. Cannot be set when OF_UNLOAD or OF_NO_UNLOAD is set. */ + OF_TRANSFER = 1 << 3, + /** 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. */ + 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. */ + 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, /** Service the vehicle when needed, otherwise skip this order; only for depots. */ - AIOF_SERVICE_IF_NEEDED = 1 << 2, + OF_SERVICE_IF_NEEDED = 1 << 2, /** Stop in the depot instead of only go there for servicing; only for depots. */ - AIOF_STOP_IN_DEPOT = 1 << 3, + OF_STOP_IN_DEPOT = 1 << 3, /** Go to nearest depot. */ - AIOF_GOTO_NEAREST_DEPOT = 1 << 8, + OF_GOTO_NEAREST_DEPOT = 1 << 8, /** All flags related to non-stop settings. */ - AIOF_NON_STOP_FLAGS = AIOF_NON_STOP_INTERMEDIATE | AIOF_NON_STOP_DESTINATION, + OF_NON_STOP_FLAGS = OF_NON_STOP_INTERMEDIATE | OF_NON_STOP_DESTINATION, /** All flags related to unloading. */ - AIOF_UNLOAD_FLAGS = AIOF_TRANSFER | AIOF_UNLOAD | AIOF_NO_UNLOAD, + OF_UNLOAD_FLAGS = OF_TRANSFER | OF_UNLOAD | OF_NO_UNLOAD, /** All flags related to loading. */ - AIOF_LOAD_FLAGS = AIOF_FULL_LOAD | AIOF_FULL_LOAD_ANY | AIOF_NO_LOAD, + OF_LOAD_FLAGS = OF_FULL_LOAD | OF_FULL_LOAD_ANY | OF_NO_LOAD, /** All flags related to depots. */ - AIOF_DEPOT_FLAGS = AIOF_SERVICE_IF_NEEDED | AIOF_STOP_IN_DEPOT | AIOF_GOTO_NEAREST_DEPOT, + OF_DEPOT_FLAGS = OF_SERVICE_IF_NEEDED | OF_STOP_IN_DEPOT | OF_GOTO_NEAREST_DEPOT, /** For marking invalid order flags */ - AIOF_INVALID = 0xFFFF, + OF_INVALID = 0xFFFF, }; /** |