Codechange: use AdviceType over StringID to remove vehicle advice news

This commit is contained in:
Rubidium
2025-01-07 21:34:19 +01:00
committed by rubidium42
parent 0437701ebe
commit 08d84b2f4a
9 changed files with 48 additions and 34 deletions
+8 -8
View File
@@ -799,7 +799,7 @@ void Vehicle::HandlePathfindingResult(bool path_found)
SetWindowWidgetDirty(WC_VEHICLE_VIEW, this->index, WID_VV_START_STOP);
InvalidateWindowClassesData(GetWindowClassForVehicleType(this->type));
/* Delete the news item. */
DeleteVehicleNews(this->index, STR_NEWS_VEHICLE_IS_LOST);
DeleteVehicleNews(this->index, AdviceType::VehicleLost);
return;
}
@@ -818,7 +818,7 @@ void Vehicle::HandlePathfindingResult(bool path_found)
AI::NewEvent(this->owner, new ScriptEventVehicleLost(this->index));
if (_settings_client.gui.lost_vehicle_warn && this->owner == _local_company) {
SetDParam(0, this->index);
AddVehicleAdviceNewsItem(STR_NEWS_VEHICLE_IS_LOST, this->index);
AddVehicleAdviceNewsItem(AdviceType::VehicleLost, STR_NEWS_VEHICLE_IS_LOST, this->index);
}
}
@@ -909,7 +909,7 @@ Vehicle::~Vehicle()
UpdateVehicleTileHash(this, true);
UpdateVehicleViewportHash(this, INVALID_COORD, 0, this->sprite_cache.old_coord.left, this->sprite_cache.old_coord.top);
if (this->type != VEH_EFFECT) {
DeleteVehicleNews(this->index, INVALID_STRING_ID);
DeleteVehicleNews(this->index);
DeleteNewGRFInspectWindow(GetGrfSpecFeature(this->type), this->index);
}
}
@@ -1111,7 +1111,7 @@ void CallVehicleTicks()
SetDParam(0, v->index);
SetDParam(1, error_message);
AddVehicleAdviceNewsItem(message, v->index);
AddVehicleAdviceNewsItem(AdviceType::AutorenewFailed, message, v->index);
}
cur_company.Restore();
@@ -1478,7 +1478,7 @@ void AgeVehicle(Vehicle *v)
}
SetDParam(0, v->index);
AddVehicleAdviceNewsItem(str, v->index);
AddVehicleAdviceNewsItem(AdviceType::VehicleOld, str, v->index);
}
/**
@@ -1634,7 +1634,7 @@ void VehicleEnterDepot(Vehicle *v)
if (v->owner == _local_company) {
/* Notify the user that we stopped the vehicle */
SetDParam(0, v->index);
AddVehicleAdviceNewsItem(STR_NEWS_ORDER_REFIT_FAILED, v->index);
AddVehicleAdviceNewsItem(AdviceType::RefitFailed, STR_NEWS_ORDER_REFIT_FAILED, v->index);
}
} else if (cost.GetCost() != 0) {
v->profit_this_year -= cost.GetCost() << 8;
@@ -1664,7 +1664,7 @@ void VehicleEnterDepot(Vehicle *v)
/* Announce that the vehicle is waiting to players and AIs. */
if (v->owner == _local_company) {
SetDParam(0, v->index);
AddVehicleAdviceNewsItem(STR_NEWS_TRAIN_IS_WAITING + v->type, v->index);
AddVehicleAdviceNewsItem(AdviceType::VehicleWaiting, STR_NEWS_TRAIN_IS_WAITING + v->type, v->index);
}
AI::NewEvent(v->owner, new ScriptEventVehicleWaitingInDepot(v->index));
}
@@ -3027,7 +3027,7 @@ static IntervalTimer<TimerGameEconomy> _economy_vehicles_yearly({TimerGameEconom
if (_settings_client.gui.vehicle_income_warn && v->owner == _local_company) {
SetDParam(0, v->index);
SetDParam(1, profit);
AddVehicleAdviceNewsItem(
AddVehicleAdviceNewsItem(AdviceType::VehicleUnprofitable,
TimerGameEconomy::UsingWallclockUnits() ? STR_NEWS_VEHICLE_UNPROFITABLE_PERIOD : STR_NEWS_VEHICLE_UNPROFITABLE_YEAR,
v->index);
}