1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-17 01:12:39 +01:00

Codechange: Use EncodedStrings for News messages. (#13654)

This commit is contained in:
Peter Nelson
2025-02-23 20:24:02 +00:00
committed by GitHub
parent 0afae7c546
commit 6e10584b91
30 changed files with 304 additions and 293 deletions

View File

@@ -3006,9 +3006,8 @@ static void TrainEnterStation(Train *v, StationID station)
Station *st = Station::Get(station);
if (!(st->had_vehicle_of_type & HVOT_TRAIN)) {
st->had_vehicle_of_type |= HVOT_TRAIN;
SetDParam(0, st->index);
AddVehicleNewsItem(
STR_NEWS_FIRST_TRAIN_ARRIVAL,
GetEncodedString(STR_NEWS_FIRST_TRAIN_ARRIVAL, st->index),
v->owner == _local_company ? NewsType::ArrivalCompany : NewsType::ArrivalOther,
v->index,
st->index
@@ -3243,8 +3242,7 @@ static bool CheckTrainCollision(Train *v)
/* any dead -> no crash */
if (tcc.num == 0) return false;
SetDParam(0, tcc.num);
AddTileNewsItem(STR_NEWS_TRAIN_CRASH, NewsType::Accident, v->tile);
AddTileNewsItem(GetEncodedString(STR_NEWS_TRAIN_CRASH, tcc.num), NewsType::Accident, v->tile);
ModifyStationRatingAround(v->tile, v->owner, -160, 30);
if (_settings_client.sound.disaster) SndPlayVehicleFx(SND_13_TRAIN_COLLISION, v);
@@ -4006,8 +4004,7 @@ static bool TrainLocoHandler(Train *v, bool mode)
if (HasBit(v->flags, VRF_TRAIN_STUCK) && v->wait_counter > 2 * _settings_game.pf.wait_for_pbs_path * Ticks::DAY_TICKS) {
/* Show message to player. */
if (_settings_client.gui.lost_vehicle_warn && v->owner == _local_company) {
SetDParam(0, v->index);
AddVehicleAdviceNewsItem(AdviceType::TrainStuck, STR_NEWS_TRAIN_IS_STUCK, v->index);
AddVehicleAdviceNewsItem(AdviceType::TrainStuck, GetEncodedString(STR_NEWS_TRAIN_IS_STUCK, v->index), v->index);
}
v->wait_counter = 0;
}