From ec9a9bea3a4d570dab232016b1643570509c4eff Mon Sep 17 00:00:00 2001 From: yexo Date: Wed, 31 Aug 2011 22:41:10 +0000 Subject: (svn r22861) -Add: [NoAI] support the new conditional order introduced in r22858 (Zuu) --- src/ai/api/ai_order.cpp | 1 + src/ai/api/ai_order.hpp | 15 ++++++++------- src/ai/api/ai_order.hpp.sq | 1 + 3 files changed, 10 insertions(+), 7 deletions(-) (limited to 'src/ai') diff --git a/src/ai/api/ai_order.cpp b/src/ai/api/ai_order.cpp index e784101ee..0d6a1a3df 100644 --- a/src/ai/api/ai_order.cpp +++ b/src/ai/api/ai_order.cpp @@ -176,6 +176,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or case OC_RELIABILITY: case OC_MAX_SPEED: case OC_AGE: + case OC_REMAINING_LIFETIME: return compare >= CF_EQUALS && compare <= CF_MORE_EQUALS; case OC_REQUIRES_SERVICE: diff --git a/src/ai/api/ai_order.hpp b/src/ai/api/ai_order.hpp index 14f07e6de..0c4c91287 100644 --- a/src/ai/api/ai_order.hpp +++ b/src/ai/api/ai_order.hpp @@ -87,13 +87,14 @@ public: */ enum OrderCondition { /* Order _is_ important, as it's based on OrderConditionVariable in order_type.h. */ - OC_LOAD_PERCENTAGE, ///< Skip based on the amount of load, value is in tons. - OC_RELIABILITY, ///< Skip based on the reliability, value is percent (0..100). - OC_MAX_SPEED, ///< Skip based on the maximum speed, value is in OpenTTD's internal speed unit, see AIEngine::GetMaxSpeed. - OC_AGE, ///< Skip based on the age, value is in years. - OC_REQUIRES_SERVICE, ///< Skip when the vehicle requires service, no value. - OC_UNCONDITIONALLY, ///< Always skip, no compare function, no value. - OC_INVALID = -1, ///< An invalid condition, do not use. + OC_LOAD_PERCENTAGE, ///< Skip based on the amount of load, value is in tons. + OC_RELIABILITY, ///< Skip based on the reliability, value is percent (0..100). + OC_MAX_SPEED, ///< Skip based on the maximum speed, value is in OpenTTD's internal speed unit, see AIEngine::GetMaxSpeed. + OC_AGE, ///< Skip based on the age, value is in years. + OC_REQUIRES_SERVICE, ///< Skip when the vehicle requires service, no value. + OC_UNCONDITIONALLY, ///< Always skip, no compare function, no value. + OC_REMAINING_LIFETIME, ///< Skip based on the remaining lifetime + OC_INVALID = -1, ///< An invalid condition, do not use. }; /** diff --git a/src/ai/api/ai_order.hpp.sq b/src/ai/api/ai_order.hpp.sq index dff9d889f..12655e1ca 100644 --- a/src/ai/api/ai_order.hpp.sq +++ b/src/ai/api/ai_order.hpp.sq @@ -66,6 +66,7 @@ void SQAIOrder_Register(Squirrel *engine) SQAIOrder.DefSQConst(engine, AIOrder::OC_AGE, "OC_AGE"); SQAIOrder.DefSQConst(engine, AIOrder::OC_REQUIRES_SERVICE, "OC_REQUIRES_SERVICE"); SQAIOrder.DefSQConst(engine, AIOrder::OC_UNCONDITIONALLY, "OC_UNCONDITIONALLY"); + SQAIOrder.DefSQConst(engine, AIOrder::OC_REMAINING_LIFETIME, "OC_REMAINING_LIFETIME"); SQAIOrder.DefSQConst(engine, AIOrder::OC_INVALID, "OC_INVALID"); SQAIOrder.DefSQConst(engine, AIOrder::CF_EQUALS, "CF_EQUALS"); SQAIOrder.DefSQConst(engine, AIOrder::CF_NOT_EQUALS, "CF_NOT_EQUALS"); -- cgit v1.2.3-70-g09d2