src/train_cmd.cpp
changeset 8763 81fadd257f67
parent 8712 be50475ea8fc
child 8781 c7bf8db7e611
equal deleted inserted replaced
8762:bbe195577e21 8763:81fadd257f67
    15 #include "articulated_vehicles.h"
    15 #include "articulated_vehicles.h"
    16 #include "command_func.h"
    16 #include "command_func.h"
    17 #include "pathfind.h"
    17 #include "pathfind.h"
    18 #include "npf.h"
    18 #include "npf.h"
    19 #include "station.h"
    19 #include "station.h"
    20 #include "news.h"
    20 #include "news_func.h"
    21 #include "engine.h"
    21 #include "engine.h"
    22 #include "player_func.h"
    22 #include "player_func.h"
    23 #include "player_base.h"
    23 #include "player_base.h"
    24 #include "depot.h"
    24 #include "depot.h"
    25 #include "waypoint.h"
    25 #include "waypoint.h"
  2493 			/* and notify user about the event */
  2493 			/* and notify user about the event */
  2494 			if (_patches.lost_train_warn && v->owner == _local_player) {
  2494 			if (_patches.lost_train_warn && v->owner == _local_player) {
  2495 				SetDParam(0, v->unitnumber);
  2495 				SetDParam(0, v->unitnumber);
  2496 				AddNewsItem(
  2496 				AddNewsItem(
  2497 					STR_TRAIN_IS_LOST,
  2497 					STR_TRAIN_IS_LOST,
  2498 					NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0),
  2498 					NM_SMALL, NF_VIEWPORT | NF_VEHICLE, NT_ADVICE, DNC_NONE,
  2499 					v->index,
  2499 					v->index,
  2500 					0);
  2500 					0);
  2501 			}
  2501 			}
  2502 		}
  2502 		}
  2503 	} else {
  2503 	} else {
  2763 	/* check if a train ever visited this station before */
  2763 	/* check if a train ever visited this station before */
  2764 	Station *st = GetStation(station);
  2764 	Station *st = GetStation(station);
  2765 	if (!(st->had_vehicle_of_type & HVOT_TRAIN)) {
  2765 	if (!(st->had_vehicle_of_type & HVOT_TRAIN)) {
  2766 		st->had_vehicle_of_type |= HVOT_TRAIN;
  2766 		st->had_vehicle_of_type |= HVOT_TRAIN;
  2767 		SetDParam(0, st->index);
  2767 		SetDParam(0, st->index);
  2768 		uint32 flags = v->owner == _local_player ?
       
  2769 			NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ARRIVAL_PLAYER, 0) :
       
  2770 			NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ARRIVAL_OTHER,  0);
       
  2771 		AddNewsItem(
  2768 		AddNewsItem(
  2772 			STR_8801_CITIZENS_CELEBRATE_FIRST,
  2769 			STR_8801_CITIZENS_CELEBRATE_FIRST,
  2773 			flags,
  2770 			NM_THIN, NF_VIEWPORT | NF_VEHICLE, v->owner == _local_player ? NT_ARRIVAL_PLAYER : NT_ARRIVAL_OTHER, DNC_NONE,
  2774 			v->index,
  2771 			v->index,
  2775 			0
  2772 			0
  2776 		);
  2773 		);
  2777 	}
  2774 	}
  2778 
  2775 
  3017 	/* any dead -> no crash */
  3014 	/* any dead -> no crash */
  3018 	if (tcc.num == 0) return;
  3015 	if (tcc.num == 0) return;
  3019 
  3016 
  3020 	SetDParam(0, tcc.num);
  3017 	SetDParam(0, tcc.num);
  3021 	AddNewsItem(STR_8868_TRAIN_CRASH_DIE_IN_FIREBALL,
  3018 	AddNewsItem(STR_8868_TRAIN_CRASH_DIE_IN_FIREBALL,
  3022 		NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, 0),
  3019 		NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, DNC_NONE,
  3023 		v->index,
  3020 		v->index,
  3024 		0
  3021 		0
  3025 	);
  3022 	);
  3026 
  3023 
  3027 	ModifyStationRatingAround(v->tile, v->owner, -160, 30);
  3024 	ModifyStationRatingAround(v->tile, v->owner, -160, 30);
  3737 			if (_patches.train_income_warn && v->owner == _local_player && v->age >= 730 && v->GetDisplayProfitThisYear() < 0) {
  3734 			if (_patches.train_income_warn && v->owner == _local_player && v->age >= 730 && v->GetDisplayProfitThisYear() < 0) {
  3738 				SetDParam(1, v->GetDisplayProfitThisYear());
  3735 				SetDParam(1, v->GetDisplayProfitThisYear());
  3739 				SetDParam(0, v->unitnumber);
  3736 				SetDParam(0, v->unitnumber);
  3740 				AddNewsItem(
  3737 				AddNewsItem(
  3741 					STR_TRAIN_IS_UNPROFITABLE,
  3738 					STR_TRAIN_IS_UNPROFITABLE,
  3742 					NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0),
  3739 					NM_SMALL, NF_VIEWPORT | NF_VEHICLE, NT_ADVICE, DNC_NONE,
  3743 					v->index,
  3740 					v->index,
  3744 					0);
  3741 					0);
  3745 			}
  3742 			}
  3746 
  3743 
  3747 			v->profit_last_year = v->profit_this_year;
  3744 			v->profit_last_year = v->profit_this_year;