mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-07-24 12:06:41 +00:00
Codechange: enum-class-ify Commands
This commit is contained in:
+13
-13
@@ -722,7 +722,7 @@ public:
|
||||
if (confirmed) {
|
||||
VehicleGroupWindow *w = (VehicleGroupWindow*)win;
|
||||
w->vli.SetIndex(ALL_GROUP);
|
||||
Command<CMD_DELETE_GROUP>::Post(STR_ERROR_GROUP_CAN_T_DELETE, w->group_confirm);
|
||||
Command<Commands::DeleteGroup>::Post(STR_ERROR_GROUP_CAN_T_DELETE, w->group_confirm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -865,7 +865,7 @@ public:
|
||||
}
|
||||
|
||||
case WID_GL_CREATE_GROUP: { // Create a new group
|
||||
Command<CMD_CREATE_GROUP>::Post(STR_ERROR_GROUP_CAN_T_CREATE, CcCreateGroup, this->vli.vtype, this->vli.ToGroupID());
|
||||
Command<Commands::CreateGroup>::Post(STR_ERROR_GROUP_CAN_T_CREATE, CcCreateGroup, this->vli.vtype, this->vli.ToGroupID());
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -897,14 +897,14 @@ public:
|
||||
|
||||
case WID_GL_START_ALL:
|
||||
case WID_GL_STOP_ALL: { // Start/stop all vehicles of the list
|
||||
Command<CMD_MASS_START_STOP>::Post(TileIndex{}, widget == WID_GL_START_ALL, true, this->vli);
|
||||
Command<Commands::MassStartStop>::Post(TileIndex{}, widget == WID_GL_START_ALL, true, this->vli);
|
||||
break;
|
||||
}
|
||||
|
||||
case WID_GL_REPLACE_PROTECTION: {
|
||||
const Group *g = Group::GetIfValid(this->vli.ToGroupID());
|
||||
if (g != nullptr) {
|
||||
Command<CMD_SET_GROUP_FLAG>::Post(this->vli.ToGroupID(), GroupFlag::ReplaceProtection, !g->flags.Test(GroupFlag::ReplaceProtection), _ctrl_pressed);
|
||||
Command<Commands::SetGroupFlag>::Post(this->vli.ToGroupID(), GroupFlag::ReplaceProtection, !g->flags.Test(GroupFlag::ReplaceProtection), _ctrl_pressed);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -919,7 +919,7 @@ public:
|
||||
case WID_GL_ALL_VEHICLES: // All vehicles
|
||||
case WID_GL_DEFAULT_VEHICLES: // Ungrouped vehicles
|
||||
if (g->parent != GroupID::Invalid()) {
|
||||
Command<CMD_ALTER_GROUP>::Post(STR_ERROR_GROUP_CAN_T_SET_PARENT, AlterGroupMode::SetParent, this->group_sel, GroupID::Invalid(), {});
|
||||
Command<Commands::AlterGroup>::Post(STR_ERROR_GROUP_CAN_T_SET_PARENT, AlterGroupMode::SetParent, this->group_sel, GroupID::Invalid(), {});
|
||||
}
|
||||
|
||||
this->group_sel = GroupID::Invalid();
|
||||
@@ -932,7 +932,7 @@ public:
|
||||
GroupID new_g = it == this->groups.end() ? GroupID::Invalid() : it->group->index;
|
||||
|
||||
if (this->group_sel != new_g && g->parent != new_g) {
|
||||
Command<CMD_ALTER_GROUP>::Post(STR_ERROR_GROUP_CAN_T_SET_PARENT, AlterGroupMode::SetParent, this->group_sel, new_g, {});
|
||||
Command<Commands::AlterGroup>::Post(STR_ERROR_GROUP_CAN_T_SET_PARENT, AlterGroupMode::SetParent, this->group_sel, new_g, {});
|
||||
}
|
||||
|
||||
this->group_sel = GroupID::Invalid();
|
||||
@@ -947,7 +947,7 @@ public:
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_GL_DEFAULT_VEHICLES: // Ungrouped vehicles
|
||||
Command<CMD_ADD_VEHICLE_GROUP>::Post(STR_ERROR_GROUP_CAN_T_ADD_VEHICLE, DEFAULT_GROUP, this->vehicle_sel, _ctrl_pressed || this->grouping == GB_SHARED_ORDERS, VehicleListIdentifier{});
|
||||
Command<Commands::AddVehicleToGroup>::Post(STR_ERROR_GROUP_CAN_T_ADD_VEHICLE, DEFAULT_GROUP, this->vehicle_sel, _ctrl_pressed || this->grouping == GB_SHARED_ORDERS, VehicleListIdentifier{});
|
||||
|
||||
this->vehicle_sel = VehicleID::Invalid();
|
||||
this->group_over = GroupID::Invalid();
|
||||
@@ -964,7 +964,7 @@ public:
|
||||
auto it = this->group_sb->GetScrolledItemFromWidget(this->groups, pt.y, this, WID_GL_LIST_GROUP);
|
||||
GroupID new_g = it == this->groups.end() ? NEW_GROUP : it->group->index;
|
||||
|
||||
Command<CMD_ADD_VEHICLE_GROUP>::Post(STR_ERROR_GROUP_CAN_T_ADD_VEHICLE, new_g == NEW_GROUP ? CcAddVehicleNewGroup : nullptr, new_g, vindex, _ctrl_pressed || this->grouping == GB_SHARED_ORDERS, VehicleListIdentifier{});
|
||||
Command<Commands::AddVehicleToGroup>::Post(STR_ERROR_GROUP_CAN_T_ADD_VEHICLE, new_g == NEW_GROUP ? CcAddVehicleNewGroup : nullptr, new_g, vindex, _ctrl_pressed || this->grouping == GB_SHARED_ORDERS, VehicleListIdentifier{});
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1019,7 +1019,7 @@ public:
|
||||
|
||||
void OnQueryTextFinished(std::optional<std::string> str) override
|
||||
{
|
||||
if (str.has_value()) Command<CMD_ALTER_GROUP>::Post(STR_ERROR_GROUP_CAN_T_RENAME, AlterGroupMode::Rename, this->group_rename, GroupID::Invalid(), *str);
|
||||
if (str.has_value()) Command<Commands::AlterGroup>::Post(STR_ERROR_GROUP_CAN_T_RENAME, AlterGroupMode::Rename, this->group_rename, GroupID::Invalid(), *str);
|
||||
this->group_rename = GroupID::Invalid();
|
||||
}
|
||||
|
||||
@@ -1054,23 +1054,23 @@ public:
|
||||
break;
|
||||
case ADI_SERVICE: // Send for servicing
|
||||
case ADI_DEPOT: { // Send to Depots
|
||||
Command<CMD_SEND_VEHICLE_TO_DEPOT>::Post(GetCmdSendToDepotMsg(this->vli.vtype), VehicleID::Invalid(), (index == ADI_SERVICE ? DepotCommandFlag::Service : DepotCommandFlags{}) | DepotCommandFlag::MassSend, this->vli);
|
||||
Command<Commands::SendVehicleToDepot>::Post(GetCmdSendToDepotMsg(this->vli.vtype), VehicleID::Invalid(), (index == ADI_SERVICE ? DepotCommandFlag::Service : DepotCommandFlags{}) | DepotCommandFlag::MassSend, this->vli);
|
||||
break;
|
||||
}
|
||||
|
||||
case ADI_CREATE_GROUP: // Create group
|
||||
Command<CMD_ADD_VEHICLE_GROUP>::Post(CcAddVehicleNewGroup, NEW_GROUP, VehicleID::Invalid(), false, this->vli);
|
||||
Command<Commands::AddVehicleToGroup>::Post(CcAddVehicleNewGroup, NEW_GROUP, VehicleID::Invalid(), false, this->vli);
|
||||
break;
|
||||
|
||||
case ADI_ADD_SHARED: // Add shared Vehicles
|
||||
assert(Group::IsValidID(this->vli.ToGroupID()));
|
||||
|
||||
Command<CMD_ADD_SHARED_VEHICLE_GROUP>::Post(STR_ERROR_GROUP_CAN_T_ADD_SHARED_VEHICLE, this->vli.ToGroupID(), this->vli.vtype);
|
||||
Command<Commands::AddSharedVehiclesToGroup>::Post(STR_ERROR_GROUP_CAN_T_ADD_SHARED_VEHICLE, this->vli.ToGroupID(), this->vli.vtype);
|
||||
break;
|
||||
case ADI_REMOVE_ALL: // Remove all Vehicles from the selected group
|
||||
assert(Group::IsValidID(this->vli.ToGroupID()));
|
||||
|
||||
Command<CMD_REMOVE_ALL_VEHICLES_GROUP>::Post(STR_ERROR_GROUP_CAN_T_REMOVE_ALL_VEHICLES, this->vli.ToGroupID());
|
||||
Command<Commands::RemoveAllVehiclesGroup>::Post(STR_ERROR_GROUP_CAN_T_REMOVE_ALL_VEHICLES, this->vli.ToGroupID());
|
||||
break;
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user