news_gui.c
author tron
Mon, 20 Jun 2005 20:09:46 +0000
changeset 1959 fc150d5a23cf
parent 1938 21bd6ef5f85e
child 2101 763d0d48f39c
permissions -rw-r--r--
(svn r2465) Remove some unreachable code
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     1
#include "stdafx.h"
1891
92a3b0aa0946 (svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents: 1688
diff changeset
     2
#include "openttd.h"
1309
dab90d4cbf2d (svn r1813) Declare functions implemented in strings.c in their own shiny new header (though i think some of these function don't belong into strings.c)
tron
parents: 1097
diff changeset
     3
#include "strings.h"
1688
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
     4
#include "table/sprites.h"
507
8aa8100b0b22 (svn r815) Include strings.h only in the files which need it.
tron
parents: 497
diff changeset
     5
#include "table/strings.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     6
#include "window.h"
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     7
#include "gui.h"
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     8
#include "viewport.h"
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     9
#include "gfx.h"
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    10
#include "news.h"
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    11
#include "vehicle.h"
337
66647f97e7c0 (svn r513) Merge revisions 402, 416, 417, 478, 479, 511, 512 from map to trunk
tron
parents: 193
diff changeset
    12
#include "sound.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    13
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
    14
/* News system
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
    15
News system is realized as a FIFO queue (in an array)
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
    16
The positions in the queue can't be rearranged, we only access
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
    17
the array elements through pointers to the elements. Once the
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 176
diff changeset
    18
array is full, the oldest entry (_oldest_news) is being overwritten
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
    19
by the newest (_latest news).
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    20
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
    21
oldest                   current   lastest
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
    22
 |                          |         |
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
    23
[O------------F-------------C---------L           ]
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
    24
              |
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
    25
           forced
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
    26
*/
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
    27
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
    28
#define MAX_NEWS 30
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
    29
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
    30
#define INVALID_NEWS 255
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
    31
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
    32
static NewsItem _news_items[MAX_NEWS];
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
    33
static byte _current_news = INVALID_NEWS; // points to news item that should be shown next
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
    34
static byte _oldest_news = 0;    // points to first item in fifo queue
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
    35
static byte _latest_news = INVALID_NEWS;  // points to last item in fifo queue
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
    36
/* if the message being shown was forced by the user, its index is stored in
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
    37
 * _forced_news. forced_news is INVALID_NEWS otherwise.
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
    38
 * (Users can force messages through history or "last message") */
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
    39
static byte _forced_news = INVALID_NEWS;
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
    40
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
    41
static byte _total_news = 0; // total news count
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    42
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    43
void DrawNewsNewTrainAvail(Window *w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    44
void DrawNewsNewRoadVehAvail(Window *w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    45
void DrawNewsNewShipAvail(Window *w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    46
void DrawNewsNewAircraftAvail(Window *w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    47
void DrawNewsBankrupcy(Window *w);
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
    48
static void MoveToNexItem(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    49
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    50
StringID GetNewsStringNewTrainAvail(NewsItem *ni);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    51
StringID GetNewsStringNewRoadVehAvail(NewsItem *ni);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    52
StringID GetNewsStringNewShipAvail(NewsItem *ni);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    53
StringID GetNewsStringNewAircraftAvail(NewsItem *ni);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    54
StringID GetNewsStringBankrupcy(NewsItem *ni);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    55
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    56
static DrawNewsCallbackProc * const _draw_news_callback[] = {
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
    57
	DrawNewsNewTrainAvail,    /* DNC_TRAINAVAIL */
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
    58
	DrawNewsNewRoadVehAvail,  /* DNC_ROADAVAIL */
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
    59
	DrawNewsNewShipAvail,     /* DNC_SHIPAVAIL */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    60
	DrawNewsNewAircraftAvail, /* DNC_AIRCRAFTAVAIL */
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
    61
	DrawNewsBankrupcy,        /* DNC_BANKRUPCY */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    62
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    63
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    64
GetNewsStringCallbackProc * const _get_news_string_callback[] = {
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
    65
	GetNewsStringNewTrainAvail,    /* DNC_TRAINAVAIL */
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
    66
	GetNewsStringNewRoadVehAvail,  /* DNC_ROADAVAIL */
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
    67
	GetNewsStringNewShipAvail,     /* DNC_SHIPAVAIL */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    68
	GetNewsStringNewAircraftAvail, /* DNC_AIRCRAFTAVAIL */
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
    69
	GetNewsStringBankrupcy,        /* DNC_BANKRUPCY */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    70
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    71
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
    72
void InitNewsItemStructs(void)
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
    73
{
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
    74
	memset(_news_items, 0, sizeof(_news_items));
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
    75
	_current_news = INVALID_NEWS;
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
    76
	_oldest_news = 0;
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
    77
	_latest_news = INVALID_NEWS;
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
    78
	_forced_news = INVALID_NEWS;
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
    79
	_total_news = 0;
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
    80
}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    81
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
    82
void DrawNewsBorder(const Window *w)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    83
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    84
	int left = 0;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    85
	int right = w->width - 1;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    86
	int top = 0;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    87
	int bottom = w->height - 1;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    88
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    89
	GfxFillRect(left, top, right, bottom, 0xF);
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 176
diff changeset
    90
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    91
	GfxFillRect(left, top, left, bottom, 0xD7);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    92
	GfxFillRect(right, top, right, bottom, 0xD7);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    93
	GfxFillRect(left, top, right, top, 0xD7);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    94
	GfxFillRect(left, bottom, right, bottom, 0xD7);
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 176
diff changeset
    95
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 176
diff changeset
    96
	DrawString(left + 2, top + 1, STR_00C6, 0);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    97
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    98
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    99
static void NewsWindowProc(Window *w, WindowEvent *e)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   100
{
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   101
	switch (e->event) {
1648
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1390
diff changeset
   102
	case WE_CREATE: { /* If chatbar is open at creation time, we need to go above it */
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1390
diff changeset
   103
		const Window *w1 = FindWindowById(WC_SEND_NETWORK_MSG, 0);
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1390
diff changeset
   104
		w->message.msg = (w1 != NULL) ? w1->height : 0;
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1390
diff changeset
   105
	} break;
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1390
diff changeset
   106
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   107
	case WE_PAINT: {
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   108
		const NewsItem *ni = WP(w, news_d).ni;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   109
		ViewPort *vp;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   110
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   111
		switch (ni->display_mode) {
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   112
			case NM_NORMAL:
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   113
			case NM_THIN: {
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   114
				DrawNewsBorder(w);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   115
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   116
				DrawString(2, 1, STR_00C6, 0);
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   117
534
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   118
				SetDParam(0, ni->date);
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   119
				DrawStringRightAligned(428, 1, STR_01FF, 0);
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   120
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   121
				if (!(ni->flags & NF_VIEWPORT)) {
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   122
					COPY_IN_DPARAM(0, ni->params, lengthof(ni->params));
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   123
					DrawStringMultiCenter(215, ni->display_mode == NM_NORMAL ? 76 : 56,
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   124
						ni->string_id, 426);
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   125
				} else {
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   126
					byte bk = _display_opt;
497
2d6d31173813 (svn r787) Invert the sense of the DO_TRANS_BUILDINGS flag to be consistent with its own name and all other DO_* flags.
tron
parents: 427
diff changeset
   127
					_display_opt &= ~DO_TRANS_BUILDINGS;
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   128
					DrawWindowViewport(w);
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   129
					_display_opt = bk;
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   130
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   131
					/* Shade the viewport into gray, or color*/
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   132
					vp = w->viewport;
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   133
					GfxFillRect(vp->left - w->left, vp->top - w->top,
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   134
						vp->left - w->left + vp->width - 1, vp->top - w->top + vp->height - 1,
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   135
						ni->flags & NF_INCOLOR ? 0x4322 : 0x4323
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   136
					);
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   137
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   138
					COPY_IN_DPARAM(0, ni->params, lengthof(ni->params));
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   139
					DrawStringMultiCenter(w->width / 2, 20, ni->string_id, 428);
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   140
				}
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   141
				break;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   142
			}
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   143
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   144
			case NM_CALLBACK: {
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   145
				_draw_news_callback[ni->callback](w);
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   146
				break;
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   147
			}
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   148
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   149
			default: {
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   150
				DrawWindowWidgets(w);
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   151
				if (!(ni->flags & NF_VIEWPORT)) {
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   152
					COPY_IN_DPARAM(0, ni->params, lengthof(ni->params));
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   153
					DrawStringMultiCenter(140, 38, ni->string_id, 276);
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   154
				} else {
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   155
					DrawWindowViewport(w);
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   156
					COPY_IN_DPARAM(0, ni->params, lengthof(ni->params));
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   157
					DrawStringMultiCenter(w->width / 2, w->height - 16, ni->string_id, 276);
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   158
				}
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   159
				break;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   160
			}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   161
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   162
	} break;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   163
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   164
	case WE_CLICK: {
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   165
		switch (e->click.widget) {
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   166
		case 1: {
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   167
			NewsItem *ni = WP(w, news_d).ni;
80
405a85ce732a (svn r81) -Fix: news_gui.c contained a MSVC compile error
truelight
parents: 79
diff changeset
   168
			DeleteWindow(w);
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   169
			ni->duration = 0;
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   170
			_forced_news = INVALID_NEWS;
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   171
		} break;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   172
		case 0: {
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   173
			NewsItem *ni = WP(w, news_d).ni;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   174
			if (ni->flags & NF_VEHICLE) {
919
b0d6c7642f99 (svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents: 893
diff changeset
   175
				Vehicle *v = GetVehicle(ni->data_a);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   176
				ScrollMainWindowTo(v->x_pos, v->y_pos);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   177
			} else if (ni->flags & NF_TILE) {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   178
				if (!ScrollMainWindowToTile(ni->data_a) && ni->data_b != 0)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   179
					ScrollMainWindowToTile(ni->data_b);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   180
			}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   181
		} break;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   182
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   183
	} break;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   184
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   185
	case WE_KEYPRESS:
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   186
		if (e->keypress.keycode == WKC_SPACE) {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   187
			// Don't continue.
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   188
			e->keypress.cont = false;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   189
			DeleteWindow(w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   190
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   191
		break;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   192
1648
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1390
diff changeset
   193
	case WE_MESSAGE: /* The chatbar has notified us that is was either created or closed */
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1390
diff changeset
   194
		switch (e->message.msg) {
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1390
diff changeset
   195
			case WE_CREATE: w->message.msg = e->message.wparam; break;
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1390
diff changeset
   196
			case WE_DESTROY: w->message.msg = 0; break;
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1390
diff changeset
   197
		}
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1390
diff changeset
   198
		break;
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1390
diff changeset
   199
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1390
diff changeset
   200
	case WE_TICK: { /* Scroll up newsmessages from the bottom in steps of 4 pixels */
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1390
diff changeset
   201
		int diff;
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1390
diff changeset
   202
		int y = max(w->top - 4, _screen.height - w->height - 12 - w->message.msg);
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1390
diff changeset
   203
		if (y == w->top) return;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   204
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   205
		if (w->viewport != NULL)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   206
			w->viewport->top += y - w->top;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   207
1648
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1390
diff changeset
   208
		diff = abs(w->top - y);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   209
		w->top = y;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   210
1648
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1390
diff changeset
   211
		SetDirtyBlocks(w->left, w->top - diff, w->left + w->width, w->top + w->height);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   212
	} break;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   213
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   214
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   215
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   216
// returns the correct index in the array
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   217
// (to deal with overflows)
1095
90220990fd7c (svn r1596) Add some more statics
tron
parents: 935
diff changeset
   218
static byte increaseIndex(byte i)
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   219
{
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   220
	if (i == INVALID_NEWS)
83
bd21afea96d8 (svn r84) Improved news system code a little to avoid potential memory leaks
dominik
parents: 80
diff changeset
   221
		return 0;
bd21afea96d8 (svn r84) Improved news system code a little to avoid potential memory leaks
dominik
parents: 80
diff changeset
   222
	i++;
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   223
	if (i >= MAX_NEWS)
83
bd21afea96d8 (svn r84) Improved news system code a little to avoid potential memory leaks
dominik
parents: 80
diff changeset
   224
		i = i % MAX_NEWS;
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   225
	return i;
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   226
}
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   227
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   228
void AddNewsItem(StringID string, uint32 flags, uint data_a, uint data_b)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   229
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   230
	NewsItem *ni;
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   231
	Window *w;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   232
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   233
	if (_game_mode == GM_MENU)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   234
		return;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   235
102
1d277a07f1f1 (svn r103) Fix: rare newspaper crash with too many messages [ 1009976 ] (thx to blathij)s
dominik
parents: 94
diff changeset
   236
	// check the rare case that the oldest (to be overwritten) news item is open
935
c04b8d95865a (svn r1423) Fix: [ 1084074 ] Delayed news messages
dominik
parents: 919
diff changeset
   237
	if (_total_news==MAX_NEWS && (_oldest_news == _current_news || _oldest_news == _forced_news))
102
1d277a07f1f1 (svn r103) Fix: rare newspaper crash with too many messages [ 1009976 ] (thx to blathij)s
dominik
parents: 94
diff changeset
   238
		MoveToNexItem();
1d277a07f1f1 (svn r103) Fix: rare newspaper crash with too many messages [ 1009976 ] (thx to blathij)s
dominik
parents: 94
diff changeset
   239
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   240
	_forced_news = INVALID_NEWS;
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   241
	if (_total_news < MAX_NEWS) _total_news++;
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 176
diff changeset
   242
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   243
	// make sure our pointer isn't overflowing
83
bd21afea96d8 (svn r84) Improved news system code a little to avoid potential memory leaks
dominik
parents: 80
diff changeset
   244
	_latest_news = increaseIndex(_latest_news);
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   245
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   246
	// overwrite oldest news entry
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   247
	if (_oldest_news == _latest_news && _news_items[_oldest_news].string_id != 0)
83
bd21afea96d8 (svn r84) Improved news system code a little to avoid potential memory leaks
dominik
parents: 80
diff changeset
   248
		_oldest_news = increaseIndex(_oldest_news); // but make sure we're not overflowing here
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   249
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   250
	// add news to _latest_news
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   251
	ni = &_news_items[_latest_news];
745
623f0d007a9e (svn r1201) -Fix: I forgot to add a * in r1183 ;)
truelight
parents: 731
diff changeset
   252
	memset(ni, 0, sizeof(*ni));
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   253
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   254
	ni->string_id = string;
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   255
	ni->display_mode = (byte)flags;
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   256
	ni->flags = (byte)(flags >> 8) | NF_NOEXPIRE;
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   257
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   258
	// show this news message in color?
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   259
	if (_date >= ConvertIntDate(_patches.colored_news_date))
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   260
		ni->flags |= NF_INCOLOR;
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   261
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   262
	ni->type = (byte)(flags >> 16);
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   263
	ni->callback = (byte)(flags >> 24);
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   264
	ni->data_a = data_a;
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   265
	ni->data_b = data_b;
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   266
	ni->date = _date;
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   267
	COPY_OUT_DPARAM(ni->params, 0, lengthof(ni->params));
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   268
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   269
	w = FindWindowById(WC_MESSAGE_HISTORY, 0);
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   270
	if (w == NULL) return;
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   271
	SetWindowDirty(w);
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   272
	w->vscroll.count = _total_news;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   273
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   274
715
83805642c830 (svn r1167) Feature: Added the possibility to add validation functions to NewsItems. This is now done for "Train in depot" messages. Before displaying such a message, it checks if the train really still is in the depot. Can be applied to other news items as well.
dominik
parents: 541
diff changeset
   275
/* To add a news item with an attached validation function. This validation function
83805642c830 (svn r1167) Feature: Added the possibility to add validation functions to NewsItems. This is now done for "Train in depot" messages. Before displaying such a message, it checks if the train really still is in the depot. Can be applied to other news items as well.
dominik
parents: 541
diff changeset
   276
 * makes sure that the news item is not outdated when the newspaper pops up. */
718
d0a11ca42ba4 (svn r1170) Fix: news_gui.c should compile everywhere without warnings now.
dominik
parents: 715
diff changeset
   277
void AddValidatedNewsItem(StringID string, uint32 flags, uint data_a, uint data_b, ValidationProc *validation)
715
83805642c830 (svn r1167) Feature: Added the possibility to add validation functions to NewsItems. This is now done for "Train in depot" messages. Before displaying such a message, it checks if the train really still is in the depot. Can be applied to other news items as well.
dominik
parents: 541
diff changeset
   278
{
83805642c830 (svn r1167) Feature: Added the possibility to add validation functions to NewsItems. This is now done for "Train in depot" messages. Before displaying such a message, it checks if the train really still is in the depot. Can be applied to other news items as well.
dominik
parents: 541
diff changeset
   279
	AddNewsItem(string, flags, data_a, data_b);
83805642c830 (svn r1167) Feature: Added the possibility to add validation functions to NewsItems. This is now done for "Train in depot" messages. Before displaying such a message, it checks if the train really still is in the depot. Can be applied to other news items as well.
dominik
parents: 541
diff changeset
   280
	_news_items[_latest_news].isValid = validation;
83805642c830 (svn r1167) Feature: Added the possibility to add validation functions to NewsItems. This is now done for "Train in depot" messages. Before displaying such a message, it checks if the train really still is in the depot. Can be applied to other news items as well.
dominik
parents: 541
diff changeset
   281
}
83805642c830 (svn r1167) Feature: Added the possibility to add validation functions to NewsItems. This is now done for "Train in depot" messages. Before displaying such a message, it checks if the train really still is in the depot. Can be applied to other news items as well.
dominik
parents: 541
diff changeset
   282
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   283
// don't show item if it's older than x days
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   284
static const byte _news_items_age[] = {60, 60, 90, 60, 90, 30, 150, 30, 90, 180};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   285
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   286
static const Widget _news_type13_widgets[] = {
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 745
diff changeset
   287
{      WWT_PANEL,   RESIZE_NONE,    15,     0,   429,     0,   169, 0x0, STR_NULL},
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 745
diff changeset
   288
{      WWT_PANEL,   RESIZE_NONE,    15,     0,    10,     0,    11, 0x0, STR_NULL},
176
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 102
diff changeset
   289
{   WIDGETS_END},
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   290
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   291
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   292
static WindowDesc _news_type13_desc = {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   293
	WDP_CENTER, 476, 430, 170,
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   294
	WC_NEWS_WINDOW, 0,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   295
	WDF_DEF_WIDGET,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   296
	_news_type13_widgets,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   297
	NewsWindowProc
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   298
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   299
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   300
static const Widget _news_type2_widgets[] = {
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 745
diff changeset
   301
{      WWT_PANEL,   RESIZE_NONE,    15,     0,   429,     0,   129, 0x0, STR_NULL},
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 745
diff changeset
   302
{      WWT_PANEL,   RESIZE_NONE,    15,     0,    10,     0,    11, 0x0, STR_NULL},
176
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 102
diff changeset
   303
{   WIDGETS_END},
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   304
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   305
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   306
static WindowDesc _news_type2_desc = {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   307
	WDP_CENTER, 476, 430, 130,
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   308
	WC_NEWS_WINDOW, 0,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   309
	WDF_DEF_WIDGET,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   310
	_news_type2_widgets,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   311
	NewsWindowProc
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   312
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   313
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   314
static const Widget _news_type0_widgets[] = {
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 745
diff changeset
   315
{      WWT_PANEL,   RESIZE_NONE,     5,     0,   279,    14,    86, 0x0,								STR_NULL},
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 745
diff changeset
   316
{   WWT_CLOSEBOX,   RESIZE_NONE,     5,     0,    10,     0,    13, STR_00C5,					STR_NULL},
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 745
diff changeset
   317
{    WWT_CAPTION,   RESIZE_NONE,     5,    11,   279,     0,    13, STR_012C_MESSAGE,	STR_NULL},
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 745
diff changeset
   318
{          WWT_6,   RESIZE_NONE,     5,     2,   277,    16,    64, 0x0,								STR_NULL},
176
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 102
diff changeset
   319
{   WIDGETS_END},
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   320
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   321
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   322
static WindowDesc _news_type0_desc = {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   323
	WDP_CENTER, 476, 280, 87,
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   324
	WC_NEWS_WINDOW, 0,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   325
	WDF_DEF_WIDGET,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   326
	_news_type0_widgets,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   327
	NewsWindowProc
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   328
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   329
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   330
static const SoundFx _news_sounds[] = {
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   331
	SND_1D_APPLAUSE,
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   332
	SND_1D_APPLAUSE,
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   333
	0,
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   334
	0,
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   335
	0,
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   336
	0,
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   337
	SND_1E_OOOOH,
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   338
	0,
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   339
	0,
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   340
	0
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   341
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   342
1688
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   343
/** Get the value of an item of the news-display settings. This is
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   344
 * a little tricky since on/off/summary must use 2 bits to store the value
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   345
 * @param item the item whose value is requested
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   346
 * @return return the found value which is between 0-2
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   347
 */
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   348
static inline byte GetNewsDisplayValue(byte item)
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   349
{
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   350
	assert(item < 10 && ((_news_display_opt >> (item * 2)) & 0x3) <= 2);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   351
	return (_news_display_opt >> (item * 2)) & 0x3;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   352
}
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   353
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   354
/** Set the value of an item in the news-display settings. This is
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   355
 * a little tricky since on/off/summary must use 2 bits to store the value
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   356
 * @param item the item whose value is being set
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   357
 * @param val new value
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   358
 */
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   359
static inline void SetNewsDisplayValue(byte item, byte val)
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   360
{
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   361
	assert(item < 10 && val <= 2);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   362
	item *= 2;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   363
	CLRBIT(_news_display_opt, item);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   364
	CLRBIT(_news_display_opt, item + 1);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   365
	_news_display_opt |= val << item;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   366
}
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   367
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   368
// open up an own newspaper window for the news item
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   369
static void ShowNewspaper(NewsItem *ni)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   370
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   371
	Window *w;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   372
	int sound;
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   373
	int top;
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   374
	ni->flags &= ~(NF_NOEXPIRE | NF_FORCE_BIG);
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   375
	ni->duration = 555;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   376
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   377
	sound = _news_sounds[ni->type];
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   378
	if (sound != 0)
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   379
		SndPlayFx(sound);
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   380
1648
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1390
diff changeset
   381
	top = _screen.height;
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   382
	switch (ni->display_mode) {
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   383
		case NM_NORMAL:
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   384
		case NM_CALLBACK: {
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   385
			_news_type13_desc.top = top;
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   386
			w = AllocateWindowDesc(&_news_type13_desc);
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   387
			if (ni->flags & NF_VIEWPORT)
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   388
				AssignWindowViewport(w, 2, 58, 0x1AA, 0x6E,
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   389
					ni->data_a | (ni->flags & NF_VEHICLE ? 0x80000000 : 0), 0);
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   390
			break;
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   391
		}
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   392
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   393
		case NM_THIN: {
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   394
			_news_type2_desc.top = top;
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   395
			w = AllocateWindowDesc(&_news_type2_desc);
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   396
			if (ni->flags & NF_VIEWPORT)
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   397
				AssignWindowViewport(w, 2, 58, 0x1AA, 0x46,
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   398
					ni->data_a | (ni->flags & NF_VEHICLE ? 0x80000000 : 0), 0);
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   399
			break;
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   400
		}
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   401
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   402
		default: {
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   403
			_news_type0_desc.top = top;
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   404
			w = AllocateWindowDesc(&_news_type0_desc);
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   405
			if (ni->flags & NF_VIEWPORT)
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   406
				AssignWindowViewport(w, 3, 17, 0x112, 0x2F,
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   407
					ni->data_a | (ni->flags & NF_VEHICLE ? 0x80000000 : 0), 0);
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   408
			break;
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   409
		}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   410
	}
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   411
	WP(w, news_d).ni = &_news_items[_forced_news == INVALID_NEWS ? _current_news : _forced_news];
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   412
	w->flags4 |= WF_DISABLE_VP_SCROLL;
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   413
}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   414
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   415
// show news item in the ticker
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   416
static void ShowTicker(const NewsItem *ni)
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   417
{
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   418
	Window *w;
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   419
1688
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   420
	if (_news_ticker_sound) SndPlayFx(SND_16_MORSE);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   421
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   422
	_statusbar_news_item = *ni;
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   423
	w = FindWindowById(WC_STATUS_BAR, 0);
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   424
	if (w != NULL)
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   425
		WP(w, def_d).data_1 = 360;
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   426
}
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   427
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   428
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   429
// Are we ready to show another news item?
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   430
// Only if nothing is in the newsticker and no newspaper is displayed
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   431
static bool ReadyForNextItem(void)
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   432
{
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   433
	const Window *w;
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   434
	byte item = _forced_news == INVALID_NEWS ? _current_news : _forced_news;
92
20b4c7536349 (svn r93) Fix: memory leak in news system (blathijs)
dominik
parents: 89
diff changeset
   435
	NewsItem *ni;
20b4c7536349 (svn r93) Fix: memory leak in news system (blathijs)
dominik
parents: 89
diff changeset
   436
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   437
	if (item >= MAX_NEWS) return true;
92
20b4c7536349 (svn r93) Fix: memory leak in news system (blathijs)
dominik
parents: 89
diff changeset
   438
	ni = &_news_items[item];
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   439
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   440
	// Ticker message
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   441
	// Check if the status bar message is still being displayed?
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   442
	w = FindWindowById(WC_STATUS_BAR, 0);
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   443
	if (w != NULL && WP(w, def_d).data_1 > -1280)
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   444
		return false;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   445
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   446
	// Newspaper message
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   447
	// Wait until duration reaches 0
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   448
	if (ni->duration != 0) {
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   449
		ni->duration--;
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   450
		return false;
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   451
	}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   452
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   453
	// neither newsticker nor newspaper are running
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   454
	return true;
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   455
}
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   456
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   457
static void MoveToNexItem(void)
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   458
{
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   459
	DeleteWindowById(WC_NEWS_WINDOW, 0);
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   460
	_forced_news = INVALID_NEWS;
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   461
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   462
	// if we're not at the last item, than move on
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   463
	if (_current_news != _latest_news) {
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   464
		NewsItem *ni;
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   465
83
bd21afea96d8 (svn r84) Improved news system code a little to avoid potential memory leaks
dominik
parents: 80
diff changeset
   466
		_current_news = increaseIndex(_current_news);
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   467
		ni = &_news_items[_current_news];
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   468
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   469
		// check the date, don't show too old items
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   470
		if (_date - _news_items_age[ni->type] > ni->date)
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   471
			return;
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   472
715
83805642c830 (svn r1167) Feature: Added the possibility to add validation functions to NewsItems. This is now done for "Train in depot" messages. Before displaying such a message, it checks if the train really still is in the depot. Can be applied to other news items as well.
dominik
parents: 541
diff changeset
   473
		// execute the validation function to see if this item is still valid
83805642c830 (svn r1167) Feature: Added the possibility to add validation functions to NewsItems. This is now done for "Train in depot" messages. Before displaying such a message, it checks if the train really still is in the depot. Can be applied to other news items as well.
dominik
parents: 541
diff changeset
   474
		if ( ni->isValid != NULL && !ni->isValid(ni->data_a, ni->data_b) )
83805642c830 (svn r1167) Feature: Added the possibility to add validation functions to NewsItems. This is now done for "Train in depot" messages. Before displaying such a message, it checks if the train really still is in the depot. Can be applied to other news items as well.
dominik
parents: 541
diff changeset
   475
			return;
83805642c830 (svn r1167) Feature: Added the possibility to add validation functions to NewsItems. This is now done for "Train in depot" messages. Before displaying such a message, it checks if the train really still is in the depot. Can be applied to other news items as well.
dominik
parents: 541
diff changeset
   476
1688
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   477
  	switch (GetNewsDisplayValue(ni->type)) {
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   478
  	case 0: { /* Off - show nothing only a small reminder in the status bar */
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   479
  		Window *w = FindWindowById(WC_STATUS_BAR, 0);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   480
			if (w != NULL) {
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   481
				WP(w, def_d).data_2 = 91;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   482
				SetWindowDirty(w);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   483
			}
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   484
  	} break;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   485
  	case 1: /* Summary - show ticker, but if forced big, cascade to full */
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   486
  		if (!(ni->flags & NF_FORCE_BIG)) {
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   487
  			ShowTicker(ni);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   488
  			break;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   489
  		}
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   490
  		/* Fallthrough */
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   491
  	case 2: /* Full - show newspaper*/
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   492
  		ShowNewspaper(ni);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   493
  		break;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   494
  	}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   495
	}
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   496
}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   497
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   498
void NewsLoop(void)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   499
{
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   500
	// no news item yet
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   501
	if (_total_news == 0) return;
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   502
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   503
	if (ReadyForNextItem())
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   504
		MoveToNexItem();
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   505
}
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   506
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   507
/* Do a forced show of a specific message */
1095
90220990fd7c (svn r1596) Add some more statics
tron
parents: 935
diff changeset
   508
static void ShowNewsMessage(byte i)
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   509
{
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   510
	if (_total_news == 0) return;
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   511
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   512
	// Delete the news window
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   513
	DeleteWindowById(WC_NEWS_WINDOW, 0);
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   514
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   515
	// setup forced news item
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   516
	_forced_news = i;
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   517
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   518
	if (_forced_news != INVALID_NEWS) {
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   519
		NewsItem *ni = &_news_items[_forced_news];
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   520
		ni->duration = 555;
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   521
		ni->flags |= NF_NOEXPIRE | NF_FORCE_BIG;
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   522
		DeleteWindowById(WC_NEWS_WINDOW, 0);
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   523
		ShowNewspaper(ni);
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   524
	}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   525
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   526
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   527
void ShowLastNewsMessage(void)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   528
{
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   529
	if (_forced_news == INVALID_NEWS)
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   530
		ShowNewsMessage(_current_news);
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   531
	else if (_forced_news != 0)
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   532
		ShowNewsMessage(_forced_news - 1);
83
bd21afea96d8 (svn r84) Improved news system code a little to avoid potential memory leaks
dominik
parents: 80
diff changeset
   533
	else {
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   534
		if (_total_news != MAX_NEWS)
83
bd21afea96d8 (svn r84) Improved news system code a little to avoid potential memory leaks
dominik
parents: 80
diff changeset
   535
			ShowNewsMessage(_latest_news);
bd21afea96d8 (svn r84) Improved news system code a little to avoid potential memory leaks
dominik
parents: 80
diff changeset
   536
		else
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   537
			ShowNewsMessage(MAX_NEWS - 1);
83
bd21afea96d8 (svn r84) Improved news system code a little to avoid potential memory leaks
dominik
parents: 80
diff changeset
   538
	}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   539
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   540
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   541
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   542
/* return news by number, with 0 being the most
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   543
recent news. Returns INVALID_NEWS if end of queue reached. */
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   544
static byte getNews(byte i)
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   545
{
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   546
	if (i >= _total_news)
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   547
		return INVALID_NEWS;
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   548
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   549
	if (_latest_news < i)
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   550
		i = _latest_news + MAX_NEWS - i;
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   551
	else
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   552
		i = _latest_news - i;
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   553
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   554
	i %= MAX_NEWS;
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   555
	return i;
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   556
}
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   557
1097
653c846fb5d9 (svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents: 1095
diff changeset
   558
// cut string after len pixels
1329
a8a0d60b0a8e (svn r1833) byte -> char transition: the rest
tron
parents: 1309
diff changeset
   559
static void GetNewsString(NewsItem *ni, char *buffer, uint max)
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   560
{
1336
c9e6b766bf21 (svn r1840) Repel str_buffr and use local buffers where possible
tron
parents: 1329
diff changeset
   561
	char buf[512];
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   562
	StringID str;
1329
a8a0d60b0a8e (svn r1833) byte -> char transition: the rest
tron
parents: 1309
diff changeset
   563
	const char *s;
a8a0d60b0a8e (svn r1833) byte -> char transition: the rest
tron
parents: 1309
diff changeset
   564
	char *d;
1097
653c846fb5d9 (svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents: 1095
diff changeset
   565
	uint len = 0;
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 176
diff changeset
   566
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   567
	if (ni->display_mode == 3) {
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   568
		str = _get_news_string_callback[ni->callback](ni);
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   569
	} else {
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   570
		COPY_IN_DPARAM(0, ni->params, lengthof(ni->params));
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 176
diff changeset
   571
		str = ni->string_id;
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   572
	}
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   573
1336
c9e6b766bf21 (svn r1840) Repel str_buffr and use local buffers where possible
tron
parents: 1329
diff changeset
   574
	GetString(buf, str);
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 176
diff changeset
   575
1336
c9e6b766bf21 (svn r1840) Repel str_buffr and use local buffers where possible
tron
parents: 1329
diff changeset
   576
	s = buf;
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   577
	d = buffer;
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   578
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   579
	for (;; s++) {
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   580
		// cut strings that are too long
1097
653c846fb5d9 (svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents: 1095
diff changeset
   581
		if (len >= max-24) { // add 3x "." at the end
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   582
			d[0] = d[1] = d[2] = '.';
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   583
			d += 3;
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   584
			*d = '\0';
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   585
			break;
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   586
		}
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   587
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   588
		if (*s == '\0') {
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   589
			*d = '\0';
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   590
			break;
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   591
		} else if (*s == '\r') {
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   592
			d[0] = d[1] = d[2] = d[3] = ' ';
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   593
			d += 4;
1329
a8a0d60b0a8e (svn r1833) byte -> char transition: the rest
tron
parents: 1309
diff changeset
   594
		} else if ((byte)*s >= ' ' && ((byte)*s < 0x88 || (byte)*s >= 0x99)) {
1390
53a5713cf3f9 (svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents: 1336
diff changeset
   595
			len += GetCharacterWidth((byte)*s);
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   596
			*d++ = *s;
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   597
		}
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   598
	}
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   599
}
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   600
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   601
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   602
static void MessageHistoryWndProc(Window *w, WindowEvent *e)
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   603
{
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   604
	switch (e->event) {
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   605
	case WE_PAINT: {
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   606
		int y = 19;
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   607
		byte p, show;
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   608
		NewsItem *ni;
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   609
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   610
		DrawWindowWidgets(w);
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   611
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   612
		if (_total_news == 0) break;
1097
653c846fb5d9 (svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents: 1095
diff changeset
   613
		show = min(_total_news, w->vscroll.cap);
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   614
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   615
		for (p = w->vscroll.pos; p < w->vscroll.pos + show; p++) {
1329
a8a0d60b0a8e (svn r1833) byte -> char transition: the rest
tron
parents: 1309
diff changeset
   616
			char buffer[256];
a8a0d60b0a8e (svn r1833) byte -> char transition: the rest
tron
parents: 1309
diff changeset
   617
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   618
			// get news in correct order
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   619
			ni = &_news_items[getNews(p)];
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   620
534
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   621
			SetDParam(0, ni->date);
1097
653c846fb5d9 (svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents: 1095
diff changeset
   622
			DrawString(4, y, STR_SHORT_DATE, 16);
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   623
1097
653c846fb5d9 (svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents: 1095
diff changeset
   624
			GetNewsString(ni, buffer, w->width-90);
653c846fb5d9 (svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents: 1095
diff changeset
   625
			DoDrawString(buffer, 82, y, 16);
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   626
			y += 12;
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   627
		}
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   628
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   629
		break;
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   630
	}
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   631
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   632
	case WE_CLICK:
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   633
		switch (e->click.widget) {
1097
653c846fb5d9 (svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents: 1095
diff changeset
   634
		case 3: {
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   635
			int y = (e->click.pt.y - 19) / 12;
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   636
			byte p, q;
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   637
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   638
			#if 0 // === DEBUG code only
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   639
			for (p = 0; p < _total_news; p++)
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   640
			{
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   641
				NewsItem *ni;
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   642
				byte buffer[256];
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   643
				ni = &_news_items[p];
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   644
				GetNewsString(ni, buffer);
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   645
				printf("%i\t%i\t%s\n", p, ni->date, buffer);
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   646
			}
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   647
			printf("=========================\n");
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   648
			#endif
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   649
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   650
			p = y + w->vscroll.pos;
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   651
			if (p > _total_news - 1) break;
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   652
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   653
			if (_latest_news >= p)
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   654
				q = _latest_news - p;
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   655
			else
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   656
				q = _latest_news + MAX_NEWS - p;
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   657
			ShowNewsMessage(q);
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   658
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   659
			break;
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   660
		}
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   661
		}
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   662
		break;
1097
653c846fb5d9 (svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents: 1095
diff changeset
   663
653c846fb5d9 (svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents: 1095
diff changeset
   664
	case WE_RESIZE:
653c846fb5d9 (svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents: 1095
diff changeset
   665
		w->vscroll.cap += e->sizing.diff.y / 12;
653c846fb5d9 (svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents: 1095
diff changeset
   666
		break;
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   667
	}
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   668
}
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   669
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   670
static const Widget _message_history_widgets[] = {
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 745
diff changeset
   671
{   WWT_CLOSEBOX,   RESIZE_NONE,    13,     0,    10,     0,    13, STR_00C5,			STR_018B_CLOSE_WINDOW},
1097
653c846fb5d9 (svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents: 1095
diff changeset
   672
{    WWT_CAPTION,  RESIZE_RIGHT,    13,    11,   387,     0,    13, STR_MESSAGE_HISTORY,	STR_018C_WINDOW_TITLE_DRAG_THIS},
653c846fb5d9 (svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents: 1095
diff changeset
   673
{  WWT_STICKYBOX,     RESIZE_LR,    13,   388,   399,     0,    13, 0x0,										STR_STICKY_BUTTON},
653c846fb5d9 (svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents: 1095
diff changeset
   674
{     WWT_IMGBTN,     RESIZE_RB,    13,     0,   387,    14,   139, 0x0, STR_MESSAGE_HISTORY_TIP},
653c846fb5d9 (svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents: 1095
diff changeset
   675
{  WWT_SCROLLBAR,    RESIZE_LRB,    13,   388,   399,    14,   127, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
653c846fb5d9 (svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents: 1095
diff changeset
   676
{  WWT_RESIZEBOX,   RESIZE_LRTB,    13,   388,   399,   128,   139, 0x0, STR_RESIZE_BUTTON},
176
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 102
diff changeset
   677
{   WIDGETS_END},
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   678
};
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   679
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   680
static const WindowDesc _message_history_desc = {
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   681
	240, 22, 400, 140,
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   682
	WC_MESSAGE_HISTORY, 0,
1097
653c846fb5d9 (svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents: 1095
diff changeset
   683
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   684
	_message_history_widgets,
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   685
	MessageHistoryWndProc
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   686
};
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   687
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   688
void ShowMessageHistory(void)
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   689
{
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   690
	Window *w;
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   691
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   692
	DeleteWindowById(WC_MESSAGE_HISTORY, 0);
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   693
	w = AllocateWindowDesc(&_message_history_desc);
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   694
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   695
	if (w != NULL) {
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   696
		w->vscroll.cap = 10;
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   697
		w->vscroll.count = _total_news;
1097
653c846fb5d9 (svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents: 1095
diff changeset
   698
		w->resize.step_height = 12;
653c846fb5d9 (svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents: 1095
diff changeset
   699
		w->resize.height = w->height - 12 * 6; // minimum of 4 items in the list, each item 12 high
653c846fb5d9 (svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents: 1095
diff changeset
   700
		w->resize.step_width = 1;
653c846fb5d9 (svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents: 1095
diff changeset
   701
		w->resize.width = 200; // can't make window any smaller than 200 pixel
89
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   702
		SetWindowDirty(w);
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   703
	}
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   704
}
b4a7784217ab (svn r90) Fix: Some news system bugfixes
dominik
parents: 83
diff changeset
   705
1688
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   706
/** Setup the disabled/enabled buttons in the message window
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   707
 * If the value is 'off' disable the [<] widget, and enable the [>] one
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   708
 * Same-wise for all the others. Starting value of 3 is the first widget
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   709
 * group. These are grouped as [<][>] .. [<][>], etc.
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   710
 */
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   711
static void SetMessageButtonStates(Window *w, byte value, int element)
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   712
{
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   713
	element *= 2;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   714
	switch (value) {
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   715
	case 0: /* Off */
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   716
		SETBIT(w->disabled_state, element + 3);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   717
		CLRBIT(w->disabled_state, element + 3 + 1);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   718
		break;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   719
	case 1: /* Summary */
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   720
		CLRBIT(w->disabled_state, element + 3);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   721
		CLRBIT(w->disabled_state, element + 3 + 1);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   722
		break;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   723
	case 2: /* Full */
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   724
		SETBIT(w->disabled_state, element + 3 + 1);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   725
		CLRBIT(w->disabled_state, element + 3);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   726
		break;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   727
	default: NOT_REACHED();
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   728
	}
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   729
}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   730
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   731
static void MessageOptionsWndProc(Window *w, WindowEvent *e)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   732
{
1688
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   733
	static const StringID message_opt[] = {STR_OFF, STR_SUMMARY, STR_FULL, INVALID_STRING_ID};
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   734
	static const uint32 message_val[] = {0x0, 0x55555555, 0xAAAAAAAA}; // 0x555.. = 01010101010101010101 (all summary), 286.. 1010... (full)
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   735
	static const uint32 message_dis[] = {
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   736
		(1 << 3) | (1 << 5) | (1 << 7) | (1 << 9)  | (1 << 11) | (1 << 13) | (1 << 15) | (1 << 17) | (1 << 19) | (1 << 21),
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   737
		0,
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   738
		(1 << 4) | (1 << 6) | (1 << 8) | (1 << 10) | (1 << 12) | (1 << 14) | (1 << 16) | (1 << 18) | (1 << 20) | (1 << 22),
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   739
	};
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   740
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   741
	/* WP(w, def_d).data_1 are stores the clicked state of the fake widgets
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   742
	 * WP(w, def_d).data_2 stores state of the ALL on/off/summary button */
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   743
	switch (e->event) {
1688
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   744
	case WE_CREATE: {
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   745
		uint32 val = _news_display_opt;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   746
		int i;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   747
		WP(w, def_d).data_1 = WP(w, def_d).data_2 = 0;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   748
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   749
		// Set up the initial disabled buttons in the case of 'off' or 'full'
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   750
		for (i = 0; i != 10; i++, val >>= 2) SetMessageButtonStates(w, val & 0x3, i);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   751
	} break;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   752
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   753
	case WE_PAINT: {
1688
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   754
		uint32 val = _news_display_opt;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   755
		int click_state = WP(w, def_d).data_1;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   756
		int i, y;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   757
1688
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   758
		if (_news_ticker_sound) SETBIT(w->click_state, 25);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   759
		DrawWindowWidgets(w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   760
		DrawStringCentered(185, 15, STR_0205_MESSAGE_TYPES, 0);
79
15e3eef5f73d (svn r80) New internal news system (implemented with fifo queue)
dominik
parents: 0
diff changeset
   761
1688
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   762
		/* XXX - Draw the fake widgets-buttons. Can't add these to the widget-desc since
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   763
		 * openttd currently can only handle 32 widgets. So hack it *g* */
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   764
		for (i = 0, y = 26; i != 10; i++, y += 12, click_state >>= 1, val >>= 2) {
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   765
			bool clicked = !!(click_state & 1);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   766
1938
21bd6ef5f85e (svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents: 1891
diff changeset
   767
			DrawFrameRect(13, y, 89, 11 + y, 3, (clicked) ? FR_LOWERED : 0);
1688
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   768
			DrawStringCentered(((13 + 89 + 1) >> 1) + clicked, ((y + 11 + y + 1) >> 1) - 5 + clicked, message_opt[val & 0x3], 0x10);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   769
			DrawString(103, y + 1, i + STR_0206_ARRIVAL_OF_FIRST_VEHICLE, 0);
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 176
diff changeset
   770
		}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   771
1688
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   772
		DrawString(  8, y + 9, message_opt[WP(w, def_d).data_2], 0x10);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   773
		DrawString(103, y + 9, STR_MESSAGES_ALL, 0);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   774
		DrawString(103, y + 9 + 12, STR_MESSAGE_SOUND, 0);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   775
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   776
	} break;
1688
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   777
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   778
	case WE_CLICK:
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   779
		switch (e->click.widget) {
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   780
		case 2: /* Clicked on any of the fake widgets */
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   781
			if (e->click.pt.x > 13 && e->click.pt.x < 89 && e->click.pt.y > 26 && e->click.pt.y < 146) {
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   782
				int element = (e->click.pt.y - 26) / 12;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   783
				byte val = (GetNewsDisplayValue(element) + 1) % 3;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   784
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   785
				SetMessageButtonStates(w, val, element);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   786
				SetNewsDisplayValue(element, val);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   787
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   788
				WP(w, def_d).data_1 |= (1 << element);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   789
				w->flags4 |= 5 << WF_TIMEOUT_SHL; // XXX - setup unclick (fake widget)
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   790
				SetWindowDirty(w);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   791
			}
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   792
			break;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   793
		case 23: case 24: /* Dropdown menu for all settings */
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   794
			ShowDropDownMenu(w, message_opt, WP(w, def_d).data_2, 24, 0, 0);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   795
			break;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   796
		case 25: /* Change ticker sound on/off */
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   797
			_news_ticker_sound ^= 1;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   798
			TOGGLEBIT(w->click_state, e->click.widget);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   799
			InvalidateWidget(w, e->click.widget);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   800
			break;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   801
		default: { /* Clicked on the [<] .. [>] widgets */
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   802
			int wid = e->click.widget;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   803
			if (wid > 2 && wid < 23) {
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   804
				int element = (wid - 3) / 2;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   805
				byte val = (GetNewsDisplayValue(element) + ((wid & 1) ? -1 : 1)) % 3;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   806
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   807
				SetMessageButtonStates(w, val, element);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   808
				SetNewsDisplayValue(element, val);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   809
				SetWindowDirty(w);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   810
			}
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   811
		} break;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   812
		} break;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   813
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   814
	case WE_DROPDOWN_SELECT: /* Select all settings for newsmessages */
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   815
		WP(w, def_d).data_2 = e->dropdown.index;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   816
		_news_display_opt = message_val[WP(w, def_d).data_2];
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   817
		w->disabled_state = message_dis[WP(w, def_d).data_2];
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   818
		SetWindowDirty(w);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   819
		break;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   820
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   821
	case WE_TIMEOUT: /* XXX - Hack to animate 'fake' buttons */
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   822
		WP(w, def_d).data_1 = 0;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   823
		SetWindowDirty(w);
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   824
		break;
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   825
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   826
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   827
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   828
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   829
static const Widget _message_options_widgets[] = {
1688
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   830
{   WWT_CLOSEBOX,   RESIZE_NONE,    13,     0,   10,     0,    13, STR_00C5,             STR_018B_CLOSE_WINDOW},
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   831
{    WWT_CAPTION,   RESIZE_NONE,    13,    11,  409,     0,    13, STR_0204_MESSAGE_OPTIONS, STR_018C_WINDOW_TITLE_DRAG_THIS},
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   832
{      WWT_PANEL,   RESIZE_NONE,    13,     0,  409,    14,   184, STR_NULL,             STR_NULL},
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   833
1688
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   834
{ WWT_PUSHIMGBTN,   RESIZE_NONE,     3,     4,   12,    26,    37, SPR_ARROW_LEFT,       STR_HSCROLL_BAR_SCROLLS_LIST},
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   835
{ WWT_PUSHIMGBTN,   RESIZE_NONE,     3,    90,   98,    26,    37, SPR_ARROW_RIGHT,      STR_HSCROLL_BAR_SCROLLS_LIST},
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   836
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   837
{ WWT_PUSHIMGBTN,   RESIZE_NONE,     3,     4,   12,    38,    49, SPR_ARROW_LEFT,       STR_HSCROLL_BAR_SCROLLS_LIST},
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   838
{ WWT_PUSHIMGBTN,   RESIZE_NONE,     3,    90,   98,    38,    49, SPR_ARROW_RIGHT,      STR_HSCROLL_BAR_SCROLLS_LIST},
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   839
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   840
{ WWT_PUSHIMGBTN,   RESIZE_NONE,     3,     4,   12,    50,    61, SPR_ARROW_LEFT,       STR_HSCROLL_BAR_SCROLLS_LIST},
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   841
{ WWT_PUSHIMGBTN,   RESIZE_NONE,     3,    90,   98,    50,    61, SPR_ARROW_RIGHT,      STR_HSCROLL_BAR_SCROLLS_LIST},
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   842
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   843
{ WWT_PUSHIMGBTN,   RESIZE_NONE,     3,     4,   12,    62,    73, SPR_ARROW_LEFT,       STR_HSCROLL_BAR_SCROLLS_LIST},
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   844
{ WWT_PUSHIMGBTN,   RESIZE_NONE,     3,    90,   98,    62,    73, SPR_ARROW_RIGHT,      STR_HSCROLL_BAR_SCROLLS_LIST},
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   845
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   846
{ WWT_PUSHIMGBTN,   RESIZE_NONE,     3,     4,   12,    74,    85, SPR_ARROW_LEFT,       STR_HSCROLL_BAR_SCROLLS_LIST},
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   847
{ WWT_PUSHIMGBTN,   RESIZE_NONE,     3,    90,   98,    74,    85, SPR_ARROW_RIGHT,      STR_HSCROLL_BAR_SCROLLS_LIST},
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   848
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   849
{ WWT_PUSHIMGBTN,   RESIZE_NONE,     3,     4,   12,    86,    97, SPR_ARROW_LEFT,       STR_HSCROLL_BAR_SCROLLS_LIST},
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   850
{ WWT_PUSHIMGBTN,   RESIZE_NONE,     3,    90,   98,    86,    97, SPR_ARROW_RIGHT,      STR_HSCROLL_BAR_SCROLLS_LIST},
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   851
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   852
{ WWT_PUSHIMGBTN,   RESIZE_NONE,     3,     4,   12,    98,   109, SPR_ARROW_LEFT,       STR_HSCROLL_BAR_SCROLLS_LIST},
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   853
{ WWT_PUSHIMGBTN,   RESIZE_NONE,     3,    90,   98,    98,   109, SPR_ARROW_RIGHT,      STR_HSCROLL_BAR_SCROLLS_LIST},
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   854
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   855
{ WWT_PUSHIMGBTN,   RESIZE_NONE,     3,     4,   12,   110,   121, SPR_ARROW_LEFT,       STR_HSCROLL_BAR_SCROLLS_LIST},
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   856
{ WWT_PUSHIMGBTN,   RESIZE_NONE,     3,    90,   98,   110,   121, SPR_ARROW_RIGHT,      STR_HSCROLL_BAR_SCROLLS_LIST},
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   857
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   858
{ WWT_PUSHIMGBTN,   RESIZE_NONE,     3,     4,   12,   122,   133, SPR_ARROW_LEFT,       STR_HSCROLL_BAR_SCROLLS_LIST},
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   859
{ WWT_PUSHIMGBTN,   RESIZE_NONE,     3,    90,   98,   122,   133, SPR_ARROW_RIGHT,      STR_HSCROLL_BAR_SCROLLS_LIST},
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   860
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   861
{ WWT_PUSHIMGBTN,   RESIZE_NONE,     3,     4,   12,   134,   145, SPR_ARROW_LEFT,       STR_HSCROLL_BAR_SCROLLS_LIST},
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   862
{ WWT_PUSHIMGBTN,   RESIZE_NONE,     3,    90,   98,   134,   145, SPR_ARROW_RIGHT,      STR_HSCROLL_BAR_SCROLLS_LIST},
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   863
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   864
{      WWT_PANEL,   RESIZE_NONE,     3,     4,   86,   154,   165, STR_NULL,             STR_NULL},
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   865
{   WWT_CLOSEBOX,   RESIZE_NONE,     3,    87,   98,   154,   165, STR_0225,             STR_NULL},
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   866
{          WWT_4,   RESIZE_NONE,     3,     4,   98,   166,   177, STR_02DB_OFF,         STR_NULL},
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   867
176
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 102
diff changeset
   868
{   WIDGETS_END},
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   869
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   870
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   871
static const WindowDesc _message_options_desc = {
1688
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1648
diff changeset
   872
	270, 22, 410, 185,
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   873
	WC_GAME_OPTIONS, 0,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   874
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   875
	_message_options_widgets,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   876
	MessageOptionsWndProc
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   877
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   878
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 337
diff changeset
   879
void ShowMessageOptions(void)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   880
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   881
	DeleteWindowById(WC_GAME_OPTIONS, 0);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   882
	AllocateWindowDesc(&_message_options_desc);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   883
}