summaryrefslogtreecommitdiff
path: root/src/ai
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-12-12 22:15:14 +0000
committerfrosch <frosch@openttd.org>2009-12-12 22:15:14 +0000
commit9c75ffb8c5b2226d2a66ad49552a82d5d7b6b15b (patch)
treeb97f6226268da77e3d786b36b365226ed613d85c /src/ai
parent9be2c8c6bd235ad59af8e88c1674a6c379d32e54 (diff)
downloadopenttd-9c75ffb8c5b2226d2a66ad49552a82d5d7b6b15b.tar.xz
(svn r18471) -Codechange/Fix: [NoAI] Deduplicate code betweeen AIVehicle::SkipToVehicleOrder and AIOrder::SkipToOrder. They are the same. Also ORDER_CURRENT was not allowed for the latter, but well...
Diffstat (limited to 'src/ai')
-rw-r--r--src/ai/api/ai_order.cpp2
-rw-r--r--src/ai/api/ai_vehicle.cpp6
2 files changed, 3 insertions, 5 deletions
diff --git a/src/ai/api/ai_order.cpp b/src/ai/api/ai_order.cpp
index 5ecdb27a6..fba80ec59 100644
--- a/src/ai/api/ai_order.cpp
+++ b/src/ai/api/ai_order.cpp
@@ -397,6 +397,8 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
/* static */ bool AIOrder::SkipToOrder(VehicleID vehicle_id, OrderPosition next_order)
{
+ next_order = AIOrder::ResolveOrderPosition(vehicle_id, next_order);
+
EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, next_order));
return AIObject::DoCommand(0, vehicle_id, next_order, CMD_SKIP_TO_ORDER);
diff --git a/src/ai/api/ai_vehicle.cpp b/src/ai/api/ai_vehicle.cpp
index acf1a3bd8..91c3cf547 100644
--- a/src/ai/api/ai_vehicle.cpp
+++ b/src/ai/api/ai_vehicle.cpp
@@ -195,11 +195,7 @@
/* static */ bool AIVehicle::SkipToVehicleOrder(VehicleID vehicle_id, AIOrder::OrderPosition order_position)
{
- order_position = AIOrder::ResolveOrderPosition(vehicle_id, order_position);
-
- EnforcePrecondition(false, AIOrder::IsValidVehicleOrder(vehicle_id, order_position));
-
- return AIObject::DoCommand(0, vehicle_id, order_position, CMD_SKIP_TO_ORDER);
+ return AIOrder::SkipToOrder(vehicle_id, order_position);
}
/* static */ bool AIVehicle::ReverseVehicle(VehicleID vehicle_id)