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

Method SetCargoFilter

src/vehicle_gui.cpp:417–426  ·  view source on GitHub ↗

* Set cargo filter for the vehicle group list. * @param cargo_type The cargo to be set. */

Source from the content-addressed store, hash-verified

415 * @param cargo_type The cargo to be set.
416 */
417void BaseVehicleListWindow::SetCargoFilter(CargoType cargo_type)
418{
419 if (this->cargo_filter_criteria != cargo_type) {
420 this->cargo_filter_criteria = cargo_type;
421 /* Deactivate filter if criteria is 'Show All', activate it otherwise. */
422 this->vehgroups.SetFilterState(this->cargo_filter_criteria != CargoFilterCriteria::CF_ANY);
423 this->vehgroups.SetFilterType(0);
424 this->vehgroups.ForceRebuild();
425 }
426}
427
428/**
429 *Populate the filter list and set the cargo filter criteria.

Callers 2

OnDropdownSelectMethod · 0.80
OnDropdownSelectMethod · 0.80

Calls 3

SetFilterStateMethod · 0.80
SetFilterTypeMethod · 0.80
ForceRebuildMethod · 0.80

Tested by

no test coverage detected