summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2019-01-28 23:51:34 +0100
committerCharles Pigott <charlespigott@googlemail.com>2019-01-28 23:43:18 +0000
commitb22fbfbe3ddb1b965efdc948fe47cf9002cd3c71 (patch)
tree7d86a58709d1860f570c8fcdeeeff4a72a132424
parent310fa1af8863d84f9ebbe6b5ea36c21f3c4a43cf (diff)
downloadopenttd-b22fbfbe3ddb1b965efdc948fe47cf9002cd3c71.tar.xz
Add: allow opening of one TextfileWindow per type
-rw-r--r--src/ai/ai_gui.cpp2
-rw-r--r--src/network/network_content_gui.cpp2
-rw-r--r--src/newgrf_gui.cpp2
-rw-r--r--src/settings_gui.cpp2
-rw-r--r--src/textfile_gui.cpp2
5 files changed, 5 insertions, 5 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp
index 8dad16fab..aa56b3d83 100644
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -660,7 +660,7 @@ struct ScriptTextfileWindow : public TextfileWindow {
*/
void ShowScriptTextfileWindow(TextfileType file_type, CompanyID slot)
{
- DeleteWindowByClass(WC_TEXTFILE);
+ DeleteWindowById(WC_TEXTFILE, file_type);
new ScriptTextfileWindow(file_type, slot);
}
diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp
index 1df2fc82c..877dea978 100644
--- a/src/network/network_content_gui.cpp
+++ b/src/network/network_content_gui.cpp
@@ -76,7 +76,7 @@ struct ContentTextfileWindow : public TextfileWindow {
void ShowContentTextfileWindow(TextfileType file_type, const ContentInfo *ci)
{
- DeleteWindowByClass(WC_TEXTFILE);
+ DeleteWindowById(WC_TEXTFILE, file_type);
new ContentTextfileWindow(file_type, ci);
}
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index 140e29657..868fad968 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -561,7 +561,7 @@ struct NewGRFTextfileWindow : public TextfileWindow {
void ShowNewGRFTextfileWindow(TextfileType file_type, const GRFConfig *c)
{
- DeleteWindowByClass(WC_TEXTFILE);
+ DeleteWindowById(WC_TEXTFILE, file_type);
new NewGRFTextfileWindow(file_type, c);
}
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 134b1f58f..e94f96bc4 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -162,7 +162,7 @@ struct BaseSetTextfileWindow : public TextfileWindow {
template <class TBaseSet>
void ShowBaseSetTextfileWindow(TextfileType file_type, const TBaseSet* baseset, StringID content_type)
{
- DeleteWindowByClass(WC_TEXTFILE);
+ DeleteWindowById(WC_TEXTFILE, file_type);
new BaseSetTextfileWindow<TBaseSet>(file_type, baseset, content_type);
}
diff --git a/src/textfile_gui.cpp b/src/textfile_gui.cpp
index b0f9b1125..ff5226c2b 100644
--- a/src/textfile_gui.cpp
+++ b/src/textfile_gui.cpp
@@ -65,7 +65,7 @@ TextfileWindow::TextfileWindow(TextfileType file_type) : Window(&_textfile_desc)
this->CreateNestedTree();
this->vscroll = this->GetScrollbar(WID_TF_VSCROLLBAR);
this->hscroll = this->GetScrollbar(WID_TF_HSCROLLBAR);
- this->FinishInitNested();
+ this->FinishInitNested(file_type);
this->GetWidget<NWidgetCore>(WID_TF_CAPTION)->SetDataTip(STR_TEXTFILE_README_CAPTION + file_type, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS);
this->hscroll->SetStepSize(10); // Speed up horizontal scrollbar