2450 STR_TRAIN_IS_LOST, |
2450 STR_TRAIN_IS_LOST, |
2451 NM_SMALL, NF_VIEWPORT | NF_VEHICLE, NT_ADVICE, DNC_NONE, |
2451 NM_SMALL, NF_VIEWPORT | NF_VEHICLE, NT_ADVICE, DNC_NONE, |
2452 v->index, |
2452 v->index, |
2453 0); |
2453 0); |
2454 } |
2454 } |
|
2455 AI_Event(v->owner, new AIEventVehicleLost(v->index)); |
2455 } |
2456 } |
2456 } else { |
2457 } else { |
2457 /* route found, is the train marked with "path not found" flag? */ |
2458 /* route found, is the train marked with "path not found" flag? */ |
2458 if (HasBit(v->u.rail.flags, VRF_NO_PATH_TO_DESTINATION)) { |
2459 if (HasBit(v->u.rail.flags, VRF_NO_PATH_TO_DESTINATION)) { |
2459 /* clear the flag as the PF's problem was solved */ |
2460 /* clear the flag as the PF's problem was solved */ |
3606 Vehicle *v; |
3607 Vehicle *v; |
3607 |
3608 |
3608 FOR_ALL_VEHICLES(v) { |
3609 FOR_ALL_VEHICLES(v) { |
3609 if (v->type == VEH_TRAIN && IsFrontEngine(v)) { |
3610 if (v->type == VEH_TRAIN && IsFrontEngine(v)) { |
3610 /* show warning if train is not generating enough income last 2 years (corresponds to a red icon in the vehicle list) */ |
3611 /* show warning if train is not generating enough income last 2 years (corresponds to a red icon in the vehicle list) */ |
3611 if (_patches.train_income_warn && v->owner == _local_player && v->age >= 730 && v->GetDisplayProfitThisYear() < 0) { |
3612 if (v->age >= 730 && v->GetDisplayProfitThisYear() < 0) { |
3612 SetDParam(1, v->GetDisplayProfitThisYear()); |
3613 if (_patches.train_income_warn && v->owner == _local_player) { |
3613 SetDParam(0, v->unitnumber); |
3614 SetDParam(1, v->GetDisplayProfitThisYear()); |
3614 AddNewsItem( |
3615 SetDParam(0, v->unitnumber); |
3615 STR_TRAIN_IS_UNPROFITABLE, |
3616 AddNewsItem( |
3616 NM_SMALL, NF_VIEWPORT | NF_VEHICLE, NT_ADVICE, DNC_NONE, |
3617 STR_TRAIN_IS_UNPROFITABLE, |
3617 v->index, |
3618 NM_SMALL, NF_VIEWPORT | NF_VEHICLE, NT_ADVICE, DNC_NONE, |
3618 0); |
3619 v->index, |
|
3620 0); |
|
3621 } |
|
3622 AI_Event(v->owner, new AIEventVehicleUnprofitable(v->index)); |
3619 } |
3623 } |
3620 |
3624 |
3621 v->profit_last_year = v->profit_this_year; |
3625 v->profit_last_year = v->profit_this_year; |
3622 v->profit_this_year = 0; |
3626 v->profit_this_year = 0; |
3623 InvalidateWindow(WC_VEHICLE_DETAILS, v->index); |
3627 InvalidateWindow(WC_VEHICLE_DETAILS, v->index); |