function WrightAI::GetEngineDaysInTransit(engine_id, fakedist)
{
local days_in_transit = (fakedist * 256 * 16) / (2 * 74 * AIEngine.GetMaxSpeed(engine_id));
return days_in_transit;
}
function WrightAI::GetEngineRouteIncome(engine_id, cargo, fakedist) {
local running_cost = AIEngine.GetRunningCost(engine_id);
local capacity = AIEngine.GetCapacity(engine_id);
local days_in_transit = WrightAI.GetEngineDaysInTransit(engine_id, fakedist);
local income = capacity * AICargo.GetCargoIncome(cargo, fakedist, days_in_transit) - running_cost * days_in_transit / 365;
return income;
}
/* Somewhere else */
(...)
engine_list.Valuate(WrightAI.GetEngineRouteIncome, this.cargoId, dist);
(...)