Mercurial > hg > openttd
changeset 13939:0a9f4129b777 draft
(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...
author | frosch <frosch@openttd.org> |
---|---|
date | Sat, 12 Dec 2009 22:15:14 +0000 |
parents | 4dce922c787f |
children | b76c3fa5c59d |
files | src/ai/api/ai_order.cpp src/ai/api/ai_vehicle.cpp |
diffstat | 2 files changed, 3 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ai/api/ai_order.cpp +++ b/src/ai/api/ai_order.cpp @@ -397,6 +397,8 @@ /* 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);
--- 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)