summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-11-30 18:23:25 +0000
committerpeter1138 <peter1138@openttd.org>2006-11-30 18:23:25 +0000
commit8a91f18058d8c903cfd13beb8669c03a2c8bdb03 (patch)
tree0489c5dff0ab6c5e74d059f1cef3067d88f6f4c1
parent058af8eb305075ff5e53b2d62185b76d01009b3c (diff)
downloadopenttd-8a91f18058d8c903cfd13beb8669c03a2c8bdb03.tar.xz
(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.
-rw-r--r--train_gui.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/train_gui.c b/train_gui.c
index e03c77743..1e610c7e7 100644
--- a/train_gui.c
+++ b/train_gui.c
@@ -447,7 +447,6 @@ static void DrawTrainBuildWindow(Window *w)
uint16 scrollcount = 0;
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*/
if (bv->sel_engine != INVALID_ENGINE) {
@@ -493,9 +492,11 @@ static void NewRailVehicleWndProc(Window *w, WindowEvent *e)
bv->sel_engine = INVALID_ENGINE;
bv->sort_criteria = _last_sort_criteria;
bv->descending_sort_order = _last_sort_order;
+ GenerateBuildList(w);
break;
case WE_INVALIDATE_DATA:
+ GenerateBuildList(w);
SetWindowDirty(w);
break;
@@ -511,6 +512,7 @@ static void NewRailVehicleWndProc(Window *w, WindowEvent *e)
switch (e->we.click.widget) {
case BUILD_TRAIN_WIDGET_SORT_ASCENDING_DESCENDING:
_last_sort_order = bv->descending_sort_order = !bv->descending_sort_order;
+ GenerateBuildList(w);
SetWindowDirty(w);
break;
@@ -557,8 +559,9 @@ static void NewRailVehicleWndProc(Window *w, WindowEvent *e)
if (bv->sort_criteria != e->we.dropdown.index) {
bv->sort_criteria = e->we.dropdown.index;
_last_sort_criteria = e->we.dropdown.index;
+ GenerateBuildList(w);
+ SetWindowDirty(w);
}
- SetWindowDirty(w);
break;
case WE_RESIZE: {