mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Cargo filters no longer take an index. (#11582)
Update naming of functions to reflect that parameter is now a cargoid.pull/11584/head
parent
d6515d6c98
commit
12bb750128
|
@ -953,7 +953,7 @@ public:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_GL_FILTER_BY_CARGO: // Select a cargo filter criteria
|
case WID_GL_FILTER_BY_CARGO: // Select a cargo filter criteria
|
||||||
this->SetCargoFilterIndex(index);
|
this->SetCargoFilter(index);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_GL_MANAGE_VEHICLES_DROPDOWN:
|
case WID_GL_MANAGE_VEHICLES_DROPDOWN:
|
||||||
|
|
|
@ -1332,13 +1332,13 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set cargo filter list item index.
|
* Set produced cargo filter for the industry list.
|
||||||
* @param index The index of the cargo to be set
|
* @param cid The cargo to be set
|
||||||
*/
|
*/
|
||||||
void SetProducedCargoFilterIndex(byte index)
|
void SetProducedCargoFilter(CargoID cid)
|
||||||
{
|
{
|
||||||
if (this->produced_cargo_filter_criteria != index) {
|
if (this->produced_cargo_filter_criteria != cid) {
|
||||||
this->produced_cargo_filter_criteria = index;
|
this->produced_cargo_filter_criteria = cid;
|
||||||
/* deactivate filter if criteria is 'Show All', activate it otherwise */
|
/* deactivate filter if criteria is 'Show All', activate it otherwise */
|
||||||
bool is_filtering_necessary = this->produced_cargo_filter_criteria != CF_ANY || this->accepted_cargo_filter_criteria != CF_ANY;
|
bool is_filtering_necessary = this->produced_cargo_filter_criteria != CF_ANY || this->accepted_cargo_filter_criteria != CF_ANY;
|
||||||
|
|
||||||
|
@ -1349,13 +1349,13 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set cargo filter list item index.
|
* Set accepted cargo filter for the industry list.
|
||||||
* @param index The index of the cargo to be set
|
* @param index The cargo to be set
|
||||||
*/
|
*/
|
||||||
void SetAcceptedCargoFilterIndex(byte index)
|
void SetAcceptedCargoFilter(CargoID cid)
|
||||||
{
|
{
|
||||||
if (this->accepted_cargo_filter_criteria != index) {
|
if (this->accepted_cargo_filter_criteria != cid) {
|
||||||
this->accepted_cargo_filter_criteria = index;
|
this->accepted_cargo_filter_criteria = cid;
|
||||||
/* deactivate filter if criteria is 'Show All', activate it otherwise */
|
/* deactivate filter if criteria is 'Show All', activate it otherwise */
|
||||||
bool is_filtering_necessary = this->produced_cargo_filter_criteria != CF_ANY || this->accepted_cargo_filter_criteria != CF_ANY;
|
bool is_filtering_necessary = this->produced_cargo_filter_criteria != CF_ANY || this->accepted_cargo_filter_criteria != CF_ANY;
|
||||||
|
|
||||||
|
@ -1803,13 +1803,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
case WID_ID_FILTER_BY_ACC_CARGO: {
|
case WID_ID_FILTER_BY_ACC_CARGO: {
|
||||||
this->SetAcceptedCargoFilterIndex(index);
|
this->SetAcceptedCargoFilter(index);
|
||||||
this->BuildSortIndustriesList();
|
this->BuildSortIndustriesList();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WID_ID_FILTER_BY_PROD_CARGO: {
|
case WID_ID_FILTER_BY_PROD_CARGO: {
|
||||||
this->SetProducedCargoFilterIndex(index);
|
this->SetProducedCargoFilter(index);
|
||||||
this->BuildSortIndustriesList();
|
this->BuildSortIndustriesList();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,13 +300,13 @@ static GUIVehicleGroupList::FilterFunction * const _filter_funcs[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set cargo filter list item index.
|
* Set cargo filter for the vehicle group list.
|
||||||
* @param index The index to be set
|
* @param cid The cargo to be set.
|
||||||
*/
|
*/
|
||||||
void BaseVehicleListWindow::SetCargoFilterIndex(byte index)
|
void BaseVehicleListWindow::SetCargoFilter(CargoID cid)
|
||||||
{
|
{
|
||||||
if (this->cargo_filter_criteria != index) {
|
if (this->cargo_filter_criteria != cid) {
|
||||||
this->cargo_filter_criteria = index;
|
this->cargo_filter_criteria = cid;
|
||||||
/* Deactivate filter if criteria is 'Show All', activate it otherwise. */
|
/* Deactivate filter if criteria is 'Show All', activate it otherwise. */
|
||||||
this->vehgroups.SetFilterState(this->cargo_filter_criteria != CF_ANY);
|
this->vehgroups.SetFilterState(this->cargo_filter_criteria != CF_ANY);
|
||||||
this->vehgroups.SetFilterType(0);
|
this->vehgroups.SetFilterType(0);
|
||||||
|
@ -2093,7 +2093,7 @@ public:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_VL_FILTER_BY_CARGO:
|
case WID_VL_FILTER_BY_CARGO:
|
||||||
this->SetCargoFilterIndex(index);
|
this->SetCargoFilter(index);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_VL_MANAGE_VEHICLES_DROPDOWN:
|
case WID_VL_MANAGE_VEHICLES_DROPDOWN:
|
||||||
|
|
|
@ -121,7 +121,7 @@ struct BaseVehicleListWindow : public Window {
|
||||||
void UpdateVehicleGroupBy(GroupBy group_by);
|
void UpdateVehicleGroupBy(GroupBy group_by);
|
||||||
void SortVehicleList();
|
void SortVehicleList();
|
||||||
void BuildVehicleList();
|
void BuildVehicleList();
|
||||||
void SetCargoFilterIndex(byte index);
|
void SetCargoFilter(byte index);
|
||||||
void SetCargoFilterArray();
|
void SetCargoFilterArray();
|
||||||
void FilterVehicleList();
|
void FilterVehicleList();
|
||||||
StringID GetCargoFilterLabel(CargoID cid) const;
|
StringID GetCargoFilterLabel(CargoID cid) const;
|
||||||
|
|
Loading…
Reference in New Issue