(svn r7304) -Codechange: Reinstate caching of sorted purchase list. Dropping from 9m to 1.5m cycles for a redraw of a full list is not frivolous.
This commit is contained in:
		@@ -447,7 +447,6 @@ static void DrawTrainBuildWindow(Window *w)
 | 
				
			|||||||
	uint16 scrollcount = 0;
 | 
						uint16 scrollcount = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	SetWindowWidgetDisabledState(w, BUILD_TRAIN_WIDGET_BUILD, w->window_number == 0); // Disable unless we got a depot to build in
 | 
						SetWindowWidgetDisabledState(w, BUILD_TRAIN_WIDGET_BUILD, w->window_number == 0); // Disable unless we got a depot to build in
 | 
				
			||||||
	GenerateBuildList(w);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Make sure that the selected engine is still in the list*/
 | 
						/* Make sure that the selected engine is still in the list*/
 | 
				
			||||||
	if (bv->sel_engine != INVALID_ENGINE) {
 | 
						if (bv->sel_engine != INVALID_ENGINE) {
 | 
				
			||||||
@@ -493,9 +492,11 @@ static void NewRailVehicleWndProc(Window *w, WindowEvent *e)
 | 
				
			|||||||
			bv->sel_engine            = INVALID_ENGINE;
 | 
								bv->sel_engine            = INVALID_ENGINE;
 | 
				
			||||||
			bv->sort_criteria         = _last_sort_criteria;
 | 
								bv->sort_criteria         = _last_sort_criteria;
 | 
				
			||||||
			bv->descending_sort_order = _last_sort_order;
 | 
								bv->descending_sort_order = _last_sort_order;
 | 
				
			||||||
 | 
								GenerateBuildList(w);
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		case WE_INVALIDATE_DATA:
 | 
							case WE_INVALIDATE_DATA:
 | 
				
			||||||
 | 
								GenerateBuildList(w);
 | 
				
			||||||
			SetWindowDirty(w);
 | 
								SetWindowDirty(w);
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -511,6 +512,7 @@ static void NewRailVehicleWndProc(Window *w, WindowEvent *e)
 | 
				
			|||||||
			switch (e->we.click.widget) {
 | 
								switch (e->we.click.widget) {
 | 
				
			||||||
				case BUILD_TRAIN_WIDGET_SORT_ASCENDING_DESCENDING:
 | 
									case BUILD_TRAIN_WIDGET_SORT_ASCENDING_DESCENDING:
 | 
				
			||||||
					_last_sort_order = bv->descending_sort_order = !bv->descending_sort_order;
 | 
										_last_sort_order = bv->descending_sort_order = !bv->descending_sort_order;
 | 
				
			||||||
 | 
										GenerateBuildList(w);
 | 
				
			||||||
					SetWindowDirty(w);
 | 
										SetWindowDirty(w);
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -557,8 +559,9 @@ static void NewRailVehicleWndProc(Window *w, WindowEvent *e)
 | 
				
			|||||||
			if (bv->sort_criteria != e->we.dropdown.index) {
 | 
								if (bv->sort_criteria != e->we.dropdown.index) {
 | 
				
			||||||
				bv->sort_criteria = e->we.dropdown.index;
 | 
									bv->sort_criteria = e->we.dropdown.index;
 | 
				
			||||||
				_last_sort_criteria = e->we.dropdown.index;
 | 
									_last_sort_criteria = e->we.dropdown.index;
 | 
				
			||||||
 | 
									GenerateBuildList(w);
 | 
				
			||||||
 | 
									SetWindowDirty(w);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			SetWindowDirty(w);
 | 
					 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		case WE_RESIZE: {
 | 
							case WE_RESIZE: {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user