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 | |
parent | 26df0fb5938733000d01b0ac263449b4a3c1371b (diff) | |
download | openttd-e6a828def1b25671b4115903cb81d97c4e2348d6.tar.xz |
(svn r24006) -Fix [FS#5088]: AI used in names in API for GSOrder
-rw-r--r-- | bin/ai/compat_0.7.nut | 17 | ||||
-rw-r--r-- | bin/ai/compat_1.0.nut | 17 | ||||
-rw-r--r-- | bin/ai/compat_1.1.nut | 17 | ||||
-rw-r--r-- | bin/ai/regression/regression.nut | 22 | ||||
-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 |
9 files changed, 155 insertions, 103 deletions
diff --git a/bin/ai/compat_0.7.nut b/bin/ai/compat_0.7.nut index dca1849a0..a2c605ed2 100644 --- a/bin/ai/compat_0.7.nut +++ b/bin/ai/compat_0.7.nut @@ -350,3 +350,20 @@ AIEvent.AI_ET_ENGINE_AVAILABLE <- AIEvent.ET_ENGINE_AVAILABLE; AIEvent.AI_ET_STATION_FIRST_VEHICLE <- AIEvent.ET_STATION_FIRST_VEHICLE; AIEvent.AI_ET_DISASTER_ZEPPELINER_CRASHED <- AIEvent.ET_DISASTER_ZEPPELINER_CRASHED; AIEvent.AI_ET_DISASTER_ZEPPELINER_CLEARED <- AIEvent.ET_DISASTER_ZEPPELINER_CLEARED; +AIOrder.AIOF_NONE <- AIOrder.OF_NONE +AIOrder.AIOF_NON_STOP_INTERMEDIATE <- AIOrder.OF_NON_STOP_INTERMEDIATE +AIOrder.AIOF_NON_STOP_DESTINATION <- AIOrder.OF_NON_STOP_DESTINATION +AIOrder.AIOF_UNLOAD <- AIOrder.OF_UNLOAD +AIOrder.AIOF_TRANSFER <- AIOrder.OF_TRANSFER +AIOrder.AIOF_NO_UNLOAD <- AIOrder.OF_NO_UNLOAD +AIOrder.AIOF_FULL_LOAD <- AIOrder.OF_FULL_LOAD +AIOrder.AIOF_FULL_LOAD_ANY <- AIOrder.OF_FULL_LOAD_ANY +AIOrder.AIOF_NO_LOAD <- AIOrder.OF_NO_LOAD +AIOrder.AIOF_SERVICE_IF_NEEDED <- AIOrder.OF_SERVICE_IF_NEEDED +AIOrder.AIOF_STOP_IN_DEPOT <- AIOrder.OF_STOP_IN_DEPOT +AIOrder.AIOF_GOTO_NEAREST_DEPOT <- AIOrder.OF_GOTO_NEAREST_DEPOT +AIOrder.AIOF_NON_STOP_FLAGS <- AIOrder.OF_NON_STOP_FLAGS +AIOrder.AIOF_UNLOAD_FLAGS <- AIOrder.OF_UNLOAD_FLAGS +AIOrder.AIOF_LOAD_FLAGS <- AIOrder.OF_LOAD_FLAGS +AIOrder.AIOF_DEPOT_FLAGS <- AIOrder.OF_DEPOT_FLAGS +AIOrder.AIOF_INVALID <- AIOrder.OF_INVALID diff --git a/bin/ai/compat_1.0.nut b/bin/ai/compat_1.0.nut index c25967cbe..9d226cf89 100644 --- a/bin/ai/compat_1.0.nut +++ b/bin/ai/compat_1.0.nut @@ -102,3 +102,20 @@ AIEvent.AI_ET_ENGINE_AVAILABLE <- AIEvent.ET_ENGINE_AVAILABLE; AIEvent.AI_ET_STATION_FIRST_VEHICLE <- AIEvent.ET_STATION_FIRST_VEHICLE; AIEvent.AI_ET_DISASTER_ZEPPELINER_CRASHED <- AIEvent.ET_DISASTER_ZEPPELINER_CRASHED; AIEvent.AI_ET_DISASTER_ZEPPELINER_CLEARED <- AIEvent.ET_DISASTER_ZEPPELINER_CLEARED; +AIOrder.AIOF_NONE <- AIOrder.OF_NONE +AIOrder.AIOF_NON_STOP_INTERMEDIATE <- AIOrder.OF_NON_STOP_INTERMEDIATE +AIOrder.AIOF_NON_STOP_DESTINATION <- AIOrder.OF_NON_STOP_DESTINATION +AIOrder.AIOF_UNLOAD <- AIOrder.OF_UNLOAD +AIOrder.AIOF_TRANSFER <- AIOrder.OF_TRANSFER +AIOrder.AIOF_NO_UNLOAD <- AIOrder.OF_NO_UNLOAD +AIOrder.AIOF_FULL_LOAD <- AIOrder.OF_FULL_LOAD +AIOrder.AIOF_FULL_LOAD_ANY <- AIOrder.OF_FULL_LOAD_ANY +AIOrder.AIOF_NO_LOAD <- AIOrder.OF_NO_LOAD +AIOrder.AIOF_SERVICE_IF_NEEDED <- AIOrder.OF_SERVICE_IF_NEEDED +AIOrder.AIOF_STOP_IN_DEPOT <- AIOrder.OF_STOP_IN_DEPOT +AIOrder.AIOF_GOTO_NEAREST_DEPOT <- AIOrder.OF_GOTO_NEAREST_DEPOT +AIOrder.AIOF_NON_STOP_FLAGS <- AIOrder.OF_NON_STOP_FLAGS +AIOrder.AIOF_UNLOAD_FLAGS <- AIOrder.OF_UNLOAD_FLAGS +AIOrder.AIOF_LOAD_FLAGS <- AIOrder.OF_LOAD_FLAGS +AIOrder.AIOF_DEPOT_FLAGS <- AIOrder.OF_DEPOT_FLAGS +AIOrder.AIOF_INVALID <- AIOrder.OF_INVALID diff --git a/bin/ai/compat_1.1.nut b/bin/ai/compat_1.1.nut index 9bc3762ed..cb539a721 100644 --- a/bin/ai/compat_1.1.nut +++ b/bin/ai/compat_1.1.nut @@ -39,3 +39,20 @@ AIEvent.AI_ET_STATION_FIRST_VEHICLE <- AIEvent.ET_STATION_FIRST_VEHICLE; AIEvent.AI_ET_DISASTER_ZEPPELINER_CRASHED <- AIEvent.ET_DISASTER_ZEPPELINER_CRASHED; AIEvent.AI_ET_DISASTER_ZEPPELINER_CLEARED <- AIEvent.ET_DISASTER_ZEPPELINER_CLEARED; AIEvent.AI_ET_TOWN_FOUNDED <- AIEvent.ET_TOWN_FOUNDED; +AIOrder.AIOF_NONE <- AIOrder.OF_NONE +AIOrder.AIOF_NON_STOP_INTERMEDIATE <- AIOrder.OF_NON_STOP_INTERMEDIATE +AIOrder.AIOF_NON_STOP_DESTINATION <- AIOrder.OF_NON_STOP_DESTINATION +AIOrder.AIOF_UNLOAD <- AIOrder.OF_UNLOAD +AIOrder.AIOF_TRANSFER <- AIOrder.OF_TRANSFER +AIOrder.AIOF_NO_UNLOAD <- AIOrder.OF_NO_UNLOAD +AIOrder.AIOF_FULL_LOAD <- AIOrder.OF_FULL_LOAD +AIOrder.AIOF_FULL_LOAD_ANY <- AIOrder.OF_FULL_LOAD_ANY +AIOrder.AIOF_NO_LOAD <- AIOrder.OF_NO_LOAD +AIOrder.AIOF_SERVICE_IF_NEEDED <- AIOrder.OF_SERVICE_IF_NEEDED +AIOrder.AIOF_STOP_IN_DEPOT <- AIOrder.OF_STOP_IN_DEPOT +AIOrder.AIOF_GOTO_NEAREST_DEPOT <- AIOrder.OF_GOTO_NEAREST_DEPOT +AIOrder.AIOF_NON_STOP_FLAGS <- AIOrder.OF_NON_STOP_FLAGS +AIOrder.AIOF_UNLOAD_FLAGS <- AIOrder.OF_UNLOAD_FLAGS +AIOrder.AIOF_LOAD_FLAGS <- AIOrder.OF_LOAD_FLAGS +AIOrder.AIOF_DEPOT_FLAGS <- AIOrder.OF_DEPOT_FLAGS +AIOrder.AIOF_INVALID <- AIOrder.OF_INVALID diff --git a/bin/ai/regression/regression.nut b/bin/ai/regression/regression.nut index 107ff4949..5e8533a2e 100644 --- a/bin/ai/regression/regression.nut +++ b/bin/ai/regression/regression.nut @@ -923,12 +923,12 @@ function Regression::Order() print("--Order--"); print(" GetOrderCount(): " + AIOrder.GetOrderCount(12)); print(" GetOrderDestination(): " + AIOrder.GetOrderDestination(12, 1)); - print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(33416, AIOrder.AIOF_TRANSFER)); - print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(33416, AIOrder.AIOF_TRANSFER | AIOrder.AIOF_UNLOAD)); - print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(33416, AIOrder.AIOF_TRANSFER | AIOrder.AIOF_FULL_LOAD)); - print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(33417, AIOrder.AIOF_SERVICE_IF_NEEDED)); - print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(33417, AIOrder.AIOF_STOP_IN_DEPOT)); - print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(0, AIOrder.AIOF_SERVICE_IF_NEEDED | AIOrder.AIOF_GOTO_NEAREST_DEPOT)); + print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(33416, AIOrder.OF_TRANSFER)); + print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(33416, AIOrder.OF_TRANSFER | AIOrder.OF_UNLOAD)); + print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(33416, AIOrder.OF_TRANSFER | AIOrder.OF_FULL_LOAD)); + print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(33417, AIOrder.OF_SERVICE_IF_NEEDED)); + print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(33417, AIOrder.OF_STOP_IN_DEPOT)); + print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(0, AIOrder.OF_SERVICE_IF_NEEDED | AIOrder.OF_GOTO_NEAREST_DEPOT)); print(" IsValidConditionalOrder(): " + AIOrder.IsValidConditionalOrder(AIOrder.OC_LOAD_PERCENTAGE, AIOrder.CF_EQUALS)); print(" IsValidConditionalOrder(): " + AIOrder.IsValidConditionalOrder(AIOrder.OC_RELIABILITY, AIOrder.CF_IS_TRUE)); print(" IsValidConditionalOrder(): " + AIOrder.IsValidConditionalOrder(AIOrder.OC_REQUIRES_SERVICE, AIOrder.CF_IS_FALSE)); @@ -940,8 +940,8 @@ function Regression::Order() print(" IsConditionalOrder(): " + AIOrder.IsConditionalOrder(12, 1)); print(" IsCurrentOrderPartOfOrderList(): " + AIOrder.IsCurrentOrderPartOfOrderList(12)); print(" GetOrderFlags(): " + AIOrder.GetOrderFlags(12, 1)); - print(" AppendOrder(): " + AIOrder.AppendOrder(12, 33416, AIOrder.AIOF_TRANSFER)); - print(" InsertOrder(): " + AIOrder.InsertOrder(12, 0, 33416, AIOrder.AIOF_TRANSFER)); + print(" AppendOrder(): " + AIOrder.AppendOrder(12, 33416, AIOrder.OF_TRANSFER)); + print(" InsertOrder(): " + AIOrder.InsertOrder(12, 0, 33416, AIOrder.OF_TRANSFER)); print(" GetOrderCount(): " + AIOrder.GetOrderCount(12)); print(" IsValidVehicleOrder(): " + AIOrder.IsValidVehicleOrder(12, 1)); print(" IsGotoStationOrder(): " + AIOrder.IsGotoStationOrder(12, 1)); @@ -953,7 +953,7 @@ function Regression::Order() print(" GetOrderFlags(): " + AIOrder.GetOrderFlags(12, 1)); print(" GetOrderJumpTo(): " + AIOrder.GetOrderJumpTo(12, 1)); print(" RemoveOrder(): " + AIOrder.RemoveOrder(12, 0)); - print(" SetOrderFlags(): " + AIOrder.SetOrderFlags(12, 0, AIOrder.AIOF_FULL_LOAD)); + print(" SetOrderFlags(): " + AIOrder.SetOrderFlags(12, 0, AIOrder.OF_FULL_LOAD)); print(" GetOrderFlags(): " + AIOrder.GetOrderFlags(12, 0)); print(" GetOrderDestination(): " + AIOrder.GetOrderDestination(12, 0)); print(" CopyOrders(): " + AIOrder.CopyOrders(12, 1)); @@ -961,12 +961,12 @@ function Regression::Order() print(" ShareOrders(): " + AIOrder.ShareOrders(13, 1)); print(" ShareOrders(): " + AIOrder.ShareOrders(13, 12)); print(" UnshareOrders(): " + AIOrder.UnshareOrders(13)); - print(" AppendOrder(): " + AIOrder.AppendOrder(12, 33421, AIOrder.AIOF_NONE)); + print(" AppendOrder(): " + AIOrder.AppendOrder(12, 33421, AIOrder.OF_NONE)); print(" GetStopLocation(): " + AIOrder.GetStopLocation(13, 0)); print(" BuildVehicle(): " + AIVehicle.BuildVehicle(23596, 8)); print(" BuildRailStation(): " + AIRail.BuildRailStation(7958, AIRail.RAILTRACK_NE_SW, 1, 1, AIStation.STATION_NEW)); - print(" AppendOrder(): " + AIOrder.AppendOrder(20, 7958, AIOrder.AIOF_NONE)); + print(" AppendOrder(): " + AIOrder.AppendOrder(20, 7958, AIOrder.OF_NONE)); print(" GetOrderCount(): " + AIOrder.GetOrderCount(20)); print(" GetStopLocation(): " + AIOrder.GetStopLocation(20, 0)); print(" SetStopLocation(): " + AIOrder.SetStopLocation(20, 0, AIOrder.STOPLOCATION_MIDDLE)); 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, }; /** |