Codechange: make WindowClass a scoped enum

This commit is contained in:
Rubidium
2026-05-20 21:39:04 +02:00
committed by rubidium42
parent a9a2965131
commit bcda4a72ee
134 changed files with 1361 additions and 1249 deletions
+14 -14
View File
@@ -377,7 +377,7 @@ std::tuple<CommandCost, GroupID> CmdCreateGroup(DoCommandFlags flags, VehicleTyp
}
InvalidateWindowData(GetWindowClassForVehicleType(vt), VehicleListIdentifier(VL_GROUP_LIST, vt, _current_company).ToWindowNumber());
InvalidateWindowData(WC_COMPANY_COLOUR, g->owner, g->vehicle_type);
InvalidateWindowData(WindowClass::CompanyLivery, g->owner, g->vehicle_type);
return { CommandCost(), g->index };
}
@@ -429,11 +429,11 @@ CommandCost CmdDeleteGroup(DoCommandFlags flags, GroupID group_id)
VehicleType vt = g->vehicle_type;
/* Delete the Replace Vehicle Windows */
CloseWindowById(WC_REPLACE_VEHICLE, g->vehicle_type);
CloseWindowById(WindowClass::ReplaceVehicle, g->vehicle_type);
delete g;
InvalidateWindowData(GetWindowClassForVehicleType(vt), VehicleListIdentifier(VL_GROUP_LIST, vt, _current_company).ToWindowNumber());
InvalidateWindowData(WC_COMPANY_COLOUR, _current_company, vt);
InvalidateWindowData(WindowClass::CompanyLivery, _current_company, vt);
}
return CommandCost();
@@ -507,11 +507,11 @@ CommandCost CmdAlterGroup(DoCommandFlags flags, AlterGroupMode mode, GroupID gro
}
if (flags.Test(DoCommandFlag::Execute)) {
InvalidateWindowData(WC_REPLACE_VEHICLE, g->vehicle_type, 1);
InvalidateWindowData(WindowClass::ReplaceVehicle, g->vehicle_type, 1);
InvalidateWindowData(GetWindowClassForVehicleType(g->vehicle_type), VehicleListIdentifier(VL_GROUP_LIST, g->vehicle_type, _current_company).ToWindowNumber());
InvalidateWindowData(WC_COMPANY_COLOUR, g->owner, g->vehicle_type);
InvalidateWindowClassesData(WC_VEHICLE_VIEW);
InvalidateWindowClassesData(WC_VEHICLE_DETAILS);
InvalidateWindowData(WindowClass::CompanyLivery, g->owner, g->vehicle_type);
InvalidateWindowClassesData(WindowClass::VehicleView);
InvalidateWindowClassesData(WindowClass::VehicleDetails);
}
return CommandCost();
@@ -546,8 +546,8 @@ static void AddVehicleToGroup(Vehicle *v, GroupID new_g)
break;
}
InvalidateWindowData(WC_VEHICLE_VIEW, v->index);
InvalidateWindowData(WC_VEHICLE_DETAILS, v->index);
InvalidateWindowData(WindowClass::VehicleView, v->index);
InvalidateWindowData(WindowClass::VehicleDetails, v->index);
GroupStatistics::CountVehicle(v, 1);
}
@@ -606,13 +606,13 @@ std::tuple<CommandCost, GroupID> CmdAddVehicleGroup(DoCommandFlags flags, GroupI
}
}
SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
SetWindowDirty(WindowClass::VehicleDepot, v->tile);
}
GroupStatistics::UpdateAutoreplace(_current_company);
/* Update the Replace Vehicle Windows */
SetWindowDirty(WC_REPLACE_VEHICLE, vtype);
SetWindowDirty(WindowClass::ReplaceVehicle, vtype);
InvalidateWindowData(GetWindowClassForVehicleType(vtype), VehicleListIdentifier(VL_GROUP_LIST, vtype, _current_company).ToWindowNumber());
}
@@ -756,7 +756,7 @@ CommandCost CmdSetGroupFlag(DoCommandFlags flags, GroupID group_id, GroupFlag fl
SetGroupFlag(g, flag, value, recursive);
SetWindowDirty(GetWindowClassForVehicleType(g->vehicle_type), VehicleListIdentifier(VL_GROUP_LIST, g->vehicle_type, _current_company).ToWindowNumber());
InvalidateWindowData(WC_REPLACE_VEHICLE, g->vehicle_type);
InvalidateWindowData(WindowClass::ReplaceVehicle, g->vehicle_type);
}
return CommandCost();
@@ -785,7 +785,7 @@ void SetTrainGroupID(Train *v, GroupID new_g)
/* Update the Replace Vehicle Windows */
GroupStatistics::UpdateAutoreplace(v->owner);
SetWindowDirty(WC_REPLACE_VEHICLE, VehicleType::Train);
SetWindowDirty(WindowClass::ReplaceVehicle, VehicleType::Train);
}
@@ -811,7 +811,7 @@ void UpdateTrainGroupID(Train *v)
/* Update the Replace Vehicle Windows */
GroupStatistics::UpdateAutoreplace(v->owner);
SetWindowDirty(WC_REPLACE_VEHICLE, VehicleType::Train);
SetWindowDirty(WindowClass::ReplaceVehicle, VehicleType::Train);
}
/**