6 |
| 6 | local days_in_transit = WrightAI.GetEngineDaysInTransit(engine_id, fakedist);
|
---|
7 | local days_in_transit = 0;
| 7 | local income = capacity * AICargo.GetCargoIncome(cargo, fakedist, days_in_transit) - running_cost * days_in_transit / 365;
|
---|
8 | local best_income = -100000000;
| 8 | return income;
|
---|
9 | local best_distance = 0;
| 9 | }
|
---|
10 | local breakdowns = AIGameSettings.GetValue("vehicle_breakdowns");
| 10 |
|
---|
11 | for (local days = days_int * 3; days <= (breakdowns ? 130 / breakdowns : 185); days++) {
| 11 | /* Somewhere else */
|
---|
12 | local income = capacity * AICargo.GetCargoIncome(cargo, distance * days / 1000, days) - running_cost * days / 365;
| 12 | (...)
|
---|
13 | // local income_per_year = capacity * AICargo.GetCargoIncome(cargo, distance * days / 1000, days) * 365 / days - running_cost;
| 13 | engine_list.Valuate(WrightAI.GetEngineRouteIncome, this.cargoId, dist);
|
---|
14 | if (income > 1000 && income > best_income) {
| 14 | (...) |
---|
15 | // if (income_per_year > 10000 && income_per_year > best_income) {
| | |
---|
16 | best_income = income;
| | |
---|
17 | // best_income = income_per_year;
| | |
---|
18 | best_distance = distance * days / 1000;
| | |
---|
19 | days_in_transit = days;
| | |
---|
20 | }
| | |
---|
21 | }
| | |
---|
22 | // AILog.Info("days_in_transit = " + days_in_transit + " ; best_distance = " + best_distance + " ; best_income = " + best_income + " ; fakedist = " + GetEngineOptimalRealFakeDist(engine_id, days_in_transit));
| | |
---|
23 | // AILog.Info("engine = " + AIEngine.GetName(engine_id) + " ; max speed = " + AIEngine.GetMaxSpeed(engine_id) + " ; capacity = " + capacity + " ; running cost = " + running_cost);
| | |
---|
24 | if (valuator) {
| | |
---|
25 | return best_income;
| | |
---|
26 | } else {
| | |
---|
27 | return [days_in_transit, best_income, best_distance];
| | |
---|
28 | }
| | |
---|
29 | } | | |
---|