I've been doing further investigations...
The problem is the next: while an airplane is flying, AIVehicle.GetLocation ALWAYS RETURN 0 (see "src/aircraft.cpp", function "AirController", where literally states "If vehicle is in the air, use tile coordinate 0").
I've solved it by patching the game as follows:
Code: Select all
Index: src/ai/api/ai_vehicle.cpp
===================================================================
--- src/ai/api/ai_vehicle.cpp (revisión: 14276)
+++ src/ai/api/ai_vehicle.cpp (copia de trabajo)
@@ -153,7 +153,13 @@
{
if (!IsValidVehicle(vehicle_id)) return INVALID_TILE;
- return ::GetVehicle(vehicle_id)->tile;
+ if(::GetVehicle(vehicle_id)->tile!= 0)
+ return ::GetVehicle(vehicle_id)->tile;
+ else{
+ int32 x_pos= ::GetVehicle(vehicle_id)->x_pos/TILE_SIZE;
+ int32 y_pos= ::GetVehicle(vehicle_id)->y_pos/TILE_SIZE;
+ return TileXY(x_pos, y_pos);
+ }
I'd be very gratefull if this patch could be merged...
http://bugs.openttd.org/task/2280
Thank you!
Julio Pedreira.