Changeset - r23111:522dfd1b1275
[Not reviewed]
master
0 8 0
Eddi-z - 5 years ago 2019-01-05 21:10:37
43699911+Eddi-z@users.noreply.github.com
Add: Conditional order for max. reliability (patch by Cirdan, #6360) (#7017)
8 files changed with 8 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -3854,6 +3854,7 @@ STR_ORDER_CONDITIONAL_VARIABLE_TOOLTIP  
 
# Conditional order variables, must follow order of OrderConditionVariable enum
 
STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE                           :Load percentage
 
STR_ORDER_CONDITIONAL_RELIABILITY                               :Reliability
 
STR_ORDER_CONDITIONAL_MAX_RELIABILITY                           :Maximum reliability
 
STR_ORDER_CONDITIONAL_MAX_SPEED                                 :Maximum speed
 
STR_ORDER_CONDITIONAL_AGE                                       :Age (years)
 
STR_ORDER_CONDITIONAL_REQUIRES_SERVICE                          :Requires service
src/order_cmd.cpp
Show inline comments
 
@@ -2017,6 +2017,7 @@ VehicleOrderID ProcessConditionalOrder(c
 
	switch (order->GetConditionVariable()) {
 
		case OCV_LOAD_PERCENTAGE:    skip_order = OrderConditionCompare(occ, CalcPercentVehicleFilled(v, NULL), value); break;
 
		case OCV_RELIABILITY:        skip_order = OrderConditionCompare(occ, ToPercent16(v->reliability),       value); break;
 
		case OCV_MAX_RELIABILITY:    skip_order = OrderConditionCompare(occ, ToPercent16(v->GetEngine()->reliability),   value); break;
 
		case OCV_MAX_SPEED:          skip_order = OrderConditionCompare(occ, v->GetDisplayMaxSpeed() * 10 / 16, value); break;
 
		case OCV_AGE:                skip_order = OrderConditionCompare(occ, v->age / DAYS_IN_LEAP_YEAR,        value); break;
 
		case OCV_REQUIRES_SERVICE:   skip_order = OrderConditionCompare(occ, v->NeedsServicing(),               value); break;
src/order_gui.cpp
Show inline comments
 
@@ -152,6 +152,7 @@ static const StringID _order_goto_dropdo
 
static const OrderConditionVariable _order_conditional_variable[] = {
 
	OCV_LOAD_PERCENTAGE,
 
	OCV_RELIABILITY,
 
	OCV_MAX_RELIABILITY,
 
	OCV_MAX_SPEED,
 
	OCV_AGE,
 
	OCV_REMAINING_LIFETIME,
src/order_type.h
Show inline comments
 
@@ -118,6 +118,7 @@ DECLARE_ENUM_AS_BIT_SET(OrderDepotAction
 
enum OrderConditionVariable {
 
	OCV_LOAD_PERCENTAGE,    ///< Skip based on the amount of load
 
	OCV_RELIABILITY,        ///< Skip based on the reliability
 
	OCV_MAX_RELIABILITY,    ///< Skip based on the maximum reliability
 
	OCV_MAX_SPEED,          ///< Skip based on the maximum speed
 
	OCV_AGE,                ///< Skip based on the age
 
	OCV_REQUIRES_SERVICE,   ///< Skip when the vehicle requires service
src/script/api/ai/ai_order.hpp.sq
Show inline comments
 
@@ -44,6 +44,7 @@ void SQAIOrder_Register(Squirrel *engine
 
	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_RELIABILITY,                               "OC_MAX_RELIABILITY");
 
	SQAIOrder.DefSQConst(engine, ScriptOrder::OC_MAX_SPEED,                                     "OC_MAX_SPEED");
 
	SQAIOrder.DefSQConst(engine, ScriptOrder::OC_AGE,                                           "OC_AGE");
 
	SQAIOrder.DefSQConst(engine, ScriptOrder::OC_REQUIRES_SERVICE,                              "OC_REQUIRES_SERVICE");
src/script/api/game/game_order.hpp.sq
Show inline comments
 
@@ -44,6 +44,7 @@ void SQGSOrder_Register(Squirrel *engine
 
	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_RELIABILITY,                               "OC_MAX_RELIABILITY");
 
	SQGSOrder.DefSQConst(engine, ScriptOrder::OC_MAX_SPEED,                                     "OC_MAX_SPEED");
 
	SQGSOrder.DefSQConst(engine, ScriptOrder::OC_AGE,                                           "OC_AGE");
 
	SQGSOrder.DefSQConst(engine, ScriptOrder::OC_REQUIRES_SERVICE,                              "OC_REQUIRES_SERVICE");
src/script/api/script_order.cpp
Show inline comments
 
@@ -214,6 +214,7 @@ static int ScriptOrderPositionToRealOrde
 
	switch (condition) {
 
		case OC_LOAD_PERCENTAGE:
 
		case OC_RELIABILITY:
 
		case OC_MAX_RELIABILITY:
 
		case OC_MAX_SPEED:
 
		case OC_AGE:
 
		case OC_REMAINING_LIFETIME:
src/script/api/script_order.hpp
Show inline comments
 
@@ -91,6 +91,7 @@ public:
 
		/* Note: these values represent part of the in-game OrderConditionVariable enum */
 
		OC_LOAD_PERCENTAGE     = ::OCV_LOAD_PERCENTAGE,    ///< Skip based on the amount of load, value is in tons.
 
		OC_RELIABILITY         = ::OCV_RELIABILITY,        ///< Skip based on the reliability, value is percent (0..100).
 
		OC_MAX_RELIABILITY     = ::OCV_MAX_RELIABILITY,    ///< Skip based on the maximum reliability.  Value in percent
 
		OC_MAX_SPEED           = ::OCV_MAX_SPEED,          ///< Skip based on the maximum speed, value is in OpenTTD's internal speed unit, see ScriptEngine::GetMaxSpeed.
 
		OC_AGE                 = ::OCV_AGE,                ///< Skip based on the age, value is in years.
 
		OC_REQUIRES_SERVICE    = ::OCV_REQUIRES_SERVICE,   ///< Skip when the vehicle requires service, no value.
0 comments (0 inline, 0 general)