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

Method SetSelection

src/vehicle_gui.cpp:907–925  ·  view source on GitHub ↗

* Select a row. * @param click_row Clicked row */

Source from the content-addressed store, hash-verified

905 * @param click_row Clicked row
906 */
907 void SetSelection(uint click_row)
908 {
909 uint row = 0;
910
911 for (const auto &pair : refit_list) {
912 for (const RefitOption &refit : pair.second) {
913 if (row == click_row) {
914 this->selected_refit = &refit;
915 return;
916 }
917 row++;
918 /* If this cargo type is not already selected then its subtypes are not visible, so skip the rest. */
919 if (this->selected_refit == nullptr || this->selected_refit->cargo != refit.cargo) break;
920 }
921 }
922
923 /* No selection made */
924 this->selected_refit = nullptr;
925 }
926
927 RefitWindow(WindowDesc &desc, const Vehicle *v, VehicleOrderID order, bool auto_refit) : Window(desc)
928 {

Callers 1

OnClickMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected