* A road vehicle arrives at a station. If it is the first time, create a news item. * @param v Road vehicle that arrived. * @param st Station where the road vehicle arrived. */
| 699 | * @param st Station where the road vehicle arrived. |
| 700 | */ |
| 701 | static void RoadVehArrivesAt(const RoadVehicle *v, Station *st) |
| 702 | { |
| 703 | if (v->IsBus()) { |
| 704 | /* Check if station was ever visited before */ |
| 705 | if (!(st->had_vehicle_of_type & HVOT_BUS)) { |
| 706 | st->had_vehicle_of_type |= HVOT_BUS; |
| 707 | AddVehicleNewsItem( |
| 708 | GetEncodedString(RoadTypeIsRoad(v->roadtype) ? STR_NEWS_FIRST_BUS_ARRIVAL : STR_NEWS_FIRST_PASSENGER_TRAM_ARRIVAL, st->index), |
| 709 | (v->owner == _local_company) ? NewsType::ArrivalCompany : NewsType::ArrivalOther, |
| 710 | v->index, |
| 711 | st->index |
| 712 | ); |
| 713 | AI::NewEvent(v->owner, new ScriptEventStationFirstVehicle(st->index, v->index)); |
| 714 | Game::NewEvent(new ScriptEventStationFirstVehicle(st->index, v->index)); |
| 715 | } |
| 716 | } else { |
| 717 | /* Check if station was ever visited before */ |
| 718 | if (!(st->had_vehicle_of_type & HVOT_TRUCK)) { |
| 719 | st->had_vehicle_of_type |= HVOT_TRUCK; |
| 720 | AddVehicleNewsItem( |
| 721 | GetEncodedString(RoadTypeIsRoad(v->roadtype) ? STR_NEWS_FIRST_TRUCK_ARRIVAL : STR_NEWS_FIRST_CARGO_TRAM_ARRIVAL, st->index), |
| 722 | (v->owner == _local_company) ? NewsType::ArrivalCompany : NewsType::ArrivalOther, |
| 723 | v->index, |
| 724 | st->index |
| 725 | ); |
| 726 | AI::NewEvent(v->owner, new ScriptEventStationFirstVehicle(st->index, v->index)); |
| 727 | Game::NewEvent(new ScriptEventStationFirstVehicle(st->index, v->index)); |
| 728 | } |
| 729 | } |
| 730 | } |
| 731 | |
| 732 | /** |
| 733 | * This function looks at the vehicle and updates its speed (cur_speed |
no test coverage detected