(svn r6559) -Codechange: [vehicle list windows] moved creation and drawing code into two new functions to make it easier to see what goes on where
This commit is contained in:
		@@ -1200,25 +1200,19 @@ void ChangeVehicleViewWindow(const Vehicle *from_v, const Vehicle *to_v)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Start of functions regarding vehicle list windows
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum {
 | 
					enum {
 | 
				
			||||||
	PLY_WND_PRC__OFFSET_TOP_WIDGET = 26,
 | 
						PLY_WND_PRC__OFFSET_TOP_WIDGET = 26,
 | 
				
			||||||
	PLY_WND_PRC__SIZE_OF_ROW_SMALL = 26,
 | 
						PLY_WND_PRC__SIZE_OF_ROW_SMALL = 26,
 | 
				
			||||||
	PLY_WND_PRC__SIZE_OF_ROW_BIG   = 36,
 | 
						PLY_WND_PRC__SIZE_OF_ROW_BIG   = 36,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					static void CreateVehicleListWindow(Window *w)
 | 
				
			||||||
 * bitmask for w->window_number
 | 
					 | 
				
			||||||
 * 0-7 PlayerID (owner)
 | 
					 | 
				
			||||||
 * 8-10 window type (use flags in vehicle_gui.h)
 | 
					 | 
				
			||||||
 * 11-15 vehicle type (using VEH_, but can be compressed to fewer bytes if needed)
 | 
					 | 
				
			||||||
 * 16-31 StationID or OrderID depending on window type (bit 8-10)
 | 
					 | 
				
			||||||
 **/
 | 
					 | 
				
			||||||
void PlayerVehWndProc(Window *w, WindowEvent *e)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	vehiclelist_d *vl = &WP(w, vehiclelist_d);
 | 
						vehiclelist_d *vl = &WP(w, vehiclelist_d);
 | 
				
			||||||
 | 
					 | 
				
			||||||
	switch (e->event) {
 | 
					 | 
				
			||||||
		case WE_CREATE: {
 | 
					 | 
				
			||||||
	uint16 window_type = w->window_number & VLW_MASK;
 | 
						uint16 window_type = w->window_number & VLW_MASK;
 | 
				
			||||||
	vl->vehicle_type = GB(w->window_number, 11, 5);
 | 
						vl->vehicle_type = GB(w->window_number, 11, 5);
 | 
				
			||||||
	w->caption_color = GB(w->window_number, 0, 8); // PlayerID
 | 
						w->caption_color = GB(w->window_number, 0, 8); // PlayerID
 | 
				
			||||||
@@ -1277,9 +1271,12 @@ void PlayerVehWndProc(Window *w, WindowEvent *e)
 | 
				
			|||||||
	vl->l.sort_type = vl->_sorting->criteria;
 | 
						vl->l.sort_type = vl->_sorting->criteria;
 | 
				
			||||||
	vl->sort_list = NULL;
 | 
						vl->sort_list = NULL;
 | 
				
			||||||
	vl->l.resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS;	// Set up resort timer
 | 
						vl->l.resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS;	// Set up resort timer
 | 
				
			||||||
		} break;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		case WE_PAINT: {
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void DrawVehicleListWindow(Window *w)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						vehiclelist_d *vl = &WP(w, vehiclelist_d);
 | 
				
			||||||
	int x = 2;
 | 
						int x = 2;
 | 
				
			||||||
	int y = PLY_WND_PRC__OFFSET_TOP_WIDGET;
 | 
						int y = PLY_WND_PRC__OFFSET_TOP_WIDGET;
 | 
				
			||||||
	int max;
 | 
						int max;
 | 
				
			||||||
@@ -1390,7 +1387,27 @@ void PlayerVehWndProc(Window *w, WindowEvent *e)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		y += w->resize.step_height;
 | 
							y += w->resize.step_height;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
		}	break;
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * bitmask for w->window_number
 | 
				
			||||||
 | 
					 * 0-7 PlayerID (owner)
 | 
				
			||||||
 | 
					 * 8-10 window type (use flags in vehicle_gui.h)
 | 
				
			||||||
 | 
					 * 11-15 vehicle type (using VEH_, but can be compressed to fewer bytes if needed)
 | 
				
			||||||
 | 
					 * 16-31 StationID or OrderID depending on window type (bit 8-10)
 | 
				
			||||||
 | 
					 **/
 | 
				
			||||||
 | 
					void PlayerVehWndProc(Window *w, WindowEvent *e)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						vehiclelist_d *vl = &WP(w, vehiclelist_d);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						switch (e->event) {
 | 
				
			||||||
 | 
							case WE_CREATE:
 | 
				
			||||||
 | 
								CreateVehicleListWindow(w);
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							case WE_PAINT:
 | 
				
			||||||
 | 
								DrawVehicleListWindow(w);
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		case WE_CLICK: {
 | 
							case WE_CLICK: {
 | 
				
			||||||
			switch (e->we.click.widget) {
 | 
								switch (e->we.click.widget) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user