summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
authorJoan Josep <juanjo.ng.83@gmail.com>2019-02-17 00:15:58 +0100
committerPeterN <peter@fuzzle.org>2019-02-16 23:15:58 +0000
commit548ec05a48ba28b65e779fa27fa5985a4ee2901b (patch)
tree518372f8dba71cc9caf79f2d5974a917ceb2802f /src/window.cpp
parentebe84b9d4c747d516fd779c711788da5d4dcd1d0 (diff)
downloadopenttd-548ec05a48ba28b65e779fa27fa5985a4ee2901b.tar.xz
Add: News menu entry and shortcut for deleting all messages. (#7240)
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 3f4adf5e9..e8c4fe74d 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -39,6 +39,7 @@
#include "framerate_type.h"
#include "network/network_func.h"
#include "guitimer_func.h"
+#include "news_func.h"
#include "safeguards.h"
@@ -3371,6 +3372,17 @@ restart_search:
}
/**
+ * Delete all messages and their corresponding window (if any).
+ */
+void DeleteAllMessages()
+{
+ InitNewsItemStructs();
+ InvalidateWindowData(WC_STATUS_BAR, 0, SBI_NEWS_DELETED); // invalidate the statusbar
+ InvalidateWindowData(WC_MESSAGE_HISTORY, 0); // invalidate the message history
+ DeleteWindowById(WC_NEWS_WINDOW, 0); // close newspaper or general message window if shown
+}
+
+/**
* Delete all windows that are used for construction of vehicle etc.
* Once done with that invalidate the others to ensure they get refreshed too.
*/