Changeset - r19132:6e96c7e6f523
[Not reviewed]
master
0 9 0
rubidium - 13 years ago 2012-03-04 16:40:06
rubidium@openttd.org
(svn r24006) -Fix [FS#5088]: AI used in names in API for GSOrder
9 files changed with 153 insertions and 101 deletions:
0 comments (0 inline, 0 general)
bin/ai/compat_0.7.nut
Show inline comments
 
@@ -350,3 +350,20 @@ AIEvent.AI_ET_ENGINE_AVAILABLE <- AIEven
 
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
bin/ai/compat_1.0.nut
Show inline comments
 
@@ -102,3 +102,20 @@ AIEvent.AI_ET_ENGINE_AVAILABLE <- AIEven
 
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
bin/ai/compat_1.1.nut
Show inline comments
 
@@ -39,3 +39,20 @@ AIEvent.AI_ET_STATION_FIRST_VEHICLE <- A
 
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
bin/ai/regression/regression.nut
Show inline comments
 
@@ -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));
src/script/api/ai/ai_order.hpp.sq
Show inline comments
 
@@ -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");
src/script/api/ai_changelog.hpp
Show inline comments
 
@@ -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.
src/script/api/game/game_order.hpp.sq
Show inline comments
 
@@ -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");
src/script/api/script_order.cpp
Show inline comments
 
@@ -182,23 +182,23 @@ static int ScriptOrderPositionToRealOrde
 

	
 
/* 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 ScriptOrderPositionToRealOrde
 

	
 
/* 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 ScriptOrderPositionToRealOrde
 
	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 _DoCommandReturnSetOrderFlag
 

	
 
	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;
 

	
src/script/api/script_order.hpp
Show inline comments
 
@@ -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,
 
		OF_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,
 
		/** 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,
 

	
 
		/** 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,
 
		/** 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,
 
	};
 

	
 
	/**
0 comments (0 inline, 0 general)