summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-08-21 12:50:13 +0000
committerrubidium <rubidium@openttd.org>2011-08-21 12:50:13 +0000
commit2cc2d0264311ee0228fadaab0b1e80d2b49d1ffa (patch)
treef99810e2ce5998ec77cd65df829321dcf7f7d255
parentd7593d881564183ceed5a99fc73154e89c3aa7e3 (diff)
downloadopenttd-2cc2d0264311ee0228fadaab0b1e80d2b49d1ffa.tar.xz
(svn r22791) -Codechange: use callback for scanning from the NewGRF window
-rw-r--r--src/newgrf_gui.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index 9978a2f15..faadf4dcb 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -511,7 +511,7 @@ enum ShowNewGRFStateWidgets {
/**
* Window for showing NewGRF files
*/
-struct NewGRFWindow : public QueryStringBaseWindow {
+struct NewGRFWindow : public QueryStringBaseWindow, NewGRFScanCallback {
typedef GUIList<const GRFConfig *> GUIGRFConfigList;
static const uint EDITBOX_MAX_SIZE = 50;
@@ -985,15 +985,19 @@ struct NewGRFWindow : public QueryStringBaseWindow {
case SNGRFS_RESCAN_FILES:
case SNGRFS_RESCAN_FILES2:
TarScanner::DoScan();
- ScanNewGRFFiles();
- this->avail_sel = NULL;
- this->avail_pos = -1;
- this->avails.ForceRebuild();
- this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window
+ ScanNewGRFFiles(this);
break;
}
}
+ virtual void OnNewGRFsScanned()
+ {
+ this->avail_sel = NULL;
+ this->avail_pos = -1;
+ this->avails.ForceRebuild();
+ this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window
+ }
+
virtual void OnDropdownSelect(int widget, int index)
{
if (!this->editable) return;