diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -220,7 +220,7 @@ class ReplaceVehicleWindow : public Wind { EngineID veh_from = this->sel_engine[0]; EngineID veh_to = this->sel_engine[1]; - Command::Post(0, (replace_when_old ? 1 : 0) | (this->sel_group << 16), veh_from + (veh_to << 16), {}); + Command::Post(this->sel_group, veh_from, veh_to, replace_when_old); } public: @@ -544,7 +544,7 @@ public: case WID_RV_TRAIN_WAGONREMOVE_TOGGLE: { const Group *g = Group::GetIfValid(this->sel_group); if (g != nullptr) { - Command::Post(0, this->sel_group | (GroupFlags::GF_REPLACE_WAGON_REMOVAL << 16), (HasBit(g->flags, GroupFlags::GF_REPLACE_WAGON_REMOVAL) ? 0 : 1) | (_ctrl_pressed << 1), {}); + Command::Post(this->sel_group, GroupFlags::GF_REPLACE_WAGON_REMOVAL, !HasBit(g->flags, GroupFlags::GF_REPLACE_WAGON_REMOVAL), _ctrl_pressed); } else { // toggle renew_keep_length Command::Post(0, 0, Company::Get(_local_company)->settings.renew_keep_length ? 0 : 1, "company.renew_keep_length"); @@ -565,7 +565,7 @@ public: case WID_RV_STOP_REPLACE: { // Stop replacing EngineID veh_from = this->sel_engine[0]; - Command::Post(0, this->sel_group << 16, veh_from + (INVALID_ENGINE << 16), {}); + Command::Post(this->sel_group, veh_from, INVALID_ENGINE, false); break; } @@ -587,7 +587,7 @@ public: if (click_side == 0 && _ctrl_pressed && e != INVALID_ENGINE && (GetGroupNumEngines(_local_company, sel_group, e) == 0 || GetGroupNumEngines(_local_company, ALL_GROUP, e) == 0)) { EngineID veh_from = e; - Command::Post(0, this->sel_group << 16, veh_from + (INVALID_ENGINE << 16), {}); + Command::Post(this->sel_group, veh_from, INVALID_ENGINE, false); break; }