* Trains enters a station, send out a news item if it is the first train, and start loading. * @param v Train that entered the station. * @param station Station visited. */
| 3034 | * @param station Station visited. |
| 3035 | */ |
| 3036 | static void TrainEnterStation(Train *v, StationID station) |
| 3037 | { |
| 3038 | v->last_station_visited = station; |
| 3039 | |
| 3040 | /* check if a train ever visited this station before */ |
| 3041 | Station *st = Station::Get(station); |
| 3042 | if (!(st->had_vehicle_of_type & HVOT_TRAIN)) { |
| 3043 | st->had_vehicle_of_type |= HVOT_TRAIN; |
| 3044 | AddVehicleNewsItem( |
| 3045 | GetEncodedString(STR_NEWS_FIRST_TRAIN_ARRIVAL, st->index), |
| 3046 | v->owner == _local_company ? NewsType::ArrivalCompany : NewsType::ArrivalOther, |
| 3047 | v->index, |
| 3048 | st->index |
| 3049 | ); |
| 3050 | AI::NewEvent(v->owner, new ScriptEventStationFirstVehicle(st->index, v->index)); |
| 3051 | Game::NewEvent(new ScriptEventStationFirstVehicle(st->index, v->index)); |
| 3052 | } |
| 3053 | |
| 3054 | v->force_proceed = TFP_NONE; |
| 3055 | SetWindowDirty(WC_VEHICLE_VIEW, v->index); |
| 3056 | |
| 3057 | v->BeginLoading(); |
| 3058 | |
| 3059 | TriggerStationRandomisation(st, v->tile, StationRandomTrigger::VehicleArrives); |
| 3060 | TriggerStationAnimation(st, v->tile, StationAnimationTrigger::VehicleArrives); |
| 3061 | } |
| 3062 | |
| 3063 | /* Check if the vehicle is compatible with the specified tile */ |
| 3064 | static inline bool CheckCompatibleRail(const Train *v, TileIndex tile) |
no test coverage detected