summaryrefslogtreecommitdiff
path: root/src/error_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-05-14 21:04:49 +0000
committerfrosch <frosch@openttd.org>2012-05-14 21:04:49 +0000
commitc6ed8c01b3d729b546af8de5b37cac1814074a0c (patch)
treea10a8954331585441161553efca25e639aa23317 /src/error_gui.cpp
parent1ba36d07cf16c8501883f205e1ffb6a094a604c7 (diff)
downloadopenttd-c6ed8c01b3d729b546af8de5b37cac1814074a0c.tar.xz
(svn r24250) -Fix [FS#5154]: Do not immediately display error messages from parsing the cfg file, but schedule them for displaying after the GUI is prepared for it.
Diffstat (limited to 'src/error_gui.cpp')
-rw-r--r--src/error_gui.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/error_gui.cpp b/src/error_gui.cpp
index b6f1d02a2..b054f8834 100644
--- a/src/error_gui.cpp
+++ b/src/error_gui.cpp
@@ -136,6 +136,27 @@ void ErrorMessageData::CopyOutDParams()
}
}
+/**
+ * Set a error string parameter.
+ * @param n Parameter index
+ * @param v Parameter value
+ */
+void ErrorMessageData::SetDParam(uint n, uint64 v)
+{
+ this->decode_params[n] = v;
+}
+
+/**
+ * Set a rawstring parameter.
+ * @param n Parameter index
+ * @param str Raw string
+ */
+void ErrorMessageData::SetDParamStr(uint n, const char *str)
+{
+ free(this->strings[n]);
+ this->strings[n] = strdup(str);
+}
+
/** Define a queue with errors. */
typedef std::list<ErrorMessageData> ErrorList;
/** The actual queue with errors. */
@@ -386,3 +407,13 @@ void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel
new ErrmsgWindow(data);
}
}
+
+/**
+ * Schedule a list of errors.
+ * Note: This does not try to display the error now. This is useful if the window system is not yet running.
+ * @param data Error message datas; cleared afterwards
+ */
+void ScheduleErrorMessage(ErrorList &datas)
+{
+ _error_list.splice(_error_list.end(), datas);
+}