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