MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / SetBuyVehicleText

Method SetBuyVehicleText

src/build_vehicle_gui.cpp:1181–1193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1179 BadgeFilterChoices badge_filter_choices{};
1180
1181 void SetBuyVehicleText()
1182 {
1183 NWidgetCore *widget = this->GetWidget<NWidgetCore>(WID_BV_BUILD);
1184
1185 bool refit = this->sel_engine != EngineID::Invalid() && this->cargo_filter_criteria != CargoFilterCriteria::CF_ANY && this->cargo_filter_criteria != CargoFilterCriteria::CF_NONE && this->cargo_filter_criteria != CargoFilterCriteria::CF_ENGINES;
1186 if (refit) refit = Engine::Get(this->sel_engine)->GetDefaultCargoType() != this->cargo_filter_criteria;
1187
1188 if (refit) {
1189 widget->SetStringTip(STR_BUY_VEHICLE_TRAIN_BUY_REFIT_VEHICLE_BUTTON + this->vehicle_type, STR_BUY_VEHICLE_TRAIN_BUY_REFIT_VEHICLE_TOOLTIP + this->vehicle_type);
1190 } else {
1191 widget->SetStringTip(STR_BUY_VEHICLE_TRAIN_BUY_VEHICLE_BUTTON + this->vehicle_type, STR_BUY_VEHICLE_TRAIN_BUY_VEHICLE_TOOLTIP + this->vehicle_type);
1192 }
1193 }
1194
1195 BuildVehicleWindow(WindowDesc &desc, TileIndex tile, VehicleType type) : Window(desc), vehicle_editbox(MAX_LENGTH_VEHICLE_NAME_CHARS * MAX_CHAR_LENGTH, MAX_LENGTH_VEHICLE_NAME_CHARS)
1196 {

Callers 1

SelectEngineMethod · 0.95

Calls 3

InvalidFunction · 0.85
GetDefaultCargoTypeMethod · 0.80
SetStringTipMethod · 0.80

Tested by

no test coverage detected