Changeset - r28409:ddd9f9f09a4d
[Not reviewed]
master
0 1 0
Peter Nelson - 11 months ago 2024-01-05 21:50:37
peter1138@openttd.org
Codechange: Use CompanyMask to pass Companies to PopupMainCompanyToolbMenu().

It's like the type was designed for it.
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/toolbar_gui.cpp
Show inline comments
 
@@ -142,15 +142,15 @@ static const int CTMN_SPECTATE    = -2; 
 
static const int CTMN_SPECTATOR   = -3; ///< Show a company window as spectator
 

	
 
/**
 
 * Pop up a generic company list menu.
 
 * @param w The toolbar window.
 
 * @param widget The button widget id.
 
 * @param grey A bitbask of which items to mark as disabled.
 
 * @param grey A bitmask of which companies to mark as disabled.
 
 */
 
static void PopupMainCompanyToolbMenu(Window *w, WidgetID widget, int grey = 0)
 
static void PopupMainCompanyToolbMenu(Window *w, WidgetID widget, CompanyMask grey = 0)
 
{
 
	DropDownList list;
 

	
 
	switch (widget) {
 
		case WID_TN_COMPANIES:
 
			if (!_networking) break;
 
@@ -725,13 +725,13 @@ static CallBackFunction MenuClickIndustr
 
}
 

	
 
/* --- Trains button menu + 1 helper function for all vehicles. --- */
 

	
 
static void ToolbarVehicleClick(Window *w, VehicleType veh)
 
{
 
	int dis = 0;
 
	CompanyMask dis = 0;
 

	
 
	for (const Company *c : Company::Iterate()) {
 
		if (c->group_all[veh].num_vehicle == 0) SetBit(dis, c->index);
 
	}
 
	PopupMainCompanyToolbMenu(w, WID_TN_VEHICLE_START + veh, dis);
 
}
0 comments (0 inline, 0 general)