author | rubidium |
Wed, 16 Aug 2006 11:39:55 +0000 | |
changeset 4293 | 2c24234a7aec |
parent 4285 | 72b3f7d6c891 |
child 4344 | 5d0e40cd67b9 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
0 | 3 |
#include "stdafx.h" |
1891
92a3b0aa0946
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1688
diff
changeset
|
4 |
#include "openttd.h" |
2163
637ec3c361f5
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2159
diff
changeset
|
5 |
#include "functions.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
|
6 |
#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
|
7 |
#include "table/sprites.h" |
507
8aa8100b0b22
(svn r815) Include strings.h only in the files which need it.
tron
parents:
497
diff
changeset
|
8 |
#include "table/strings.h" |
0 | 9 |
#include "window.h" |
3155
b2cd7bc9f90f
(svn r3778) - Fix crash when resizing news history window.
peter1138
parents:
3143
diff
changeset
|
10 |
#include "gui.h" |
0 | 11 |
#include "viewport.h" |
12 |
#include "gfx.h" |
|
13 |
#include "news.h" |
|
14 |
#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
|
15 |
#include "sound.h" |
2159
3b634157c3b2
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2150
diff
changeset
|
16 |
#include "variables.h" |
4261
2ec8f5a9747b
(svn r5887) -Cleanup: move date related functions, defines and variables to date.[ch]
rubidium
parents:
4171
diff
changeset
|
17 |
#include "date.h" |
0 | 18 |
|
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
19 |
/* News system |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
20 |
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
|
21 |
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
|
22 |
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
|
23 |
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
|
24 |
by the newest (_latest news). |
0 | 25 |
|
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
26 |
oldest current lastest |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
27 |
| | | |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
28 |
[O------------F-------------C---------L ] |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
29 |
| |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
30 |
forced |
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 |
|
427 | 33 |
#define MAX_NEWS 30 |
34 |
||
35 |
#define INVALID_NEWS 255 |
|
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
36 |
|
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
37 |
static NewsItem _news_items[MAX_NEWS]; |
427 | 38 |
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
|
39 |
static byte _oldest_news = 0; // points to first item in fifo queue |
427 | 40 |
static byte _latest_news = INVALID_NEWS; // points to last item in fifo queue |
41 |
/* if the message being shown was forced by the user, its index is stored in |
|
42 |
* _forced_news. forced_news is INVALID_NEWS otherwise. |
|
43 |
* (Users can force messages through history or "last message") */ |
|
44 |
static byte _forced_news = INVALID_NEWS; |
|
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
45 |
|
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
46 |
static byte _total_news = 0; // total news count |
0 | 47 |
|
48 |
void DrawNewsNewTrainAvail(Window *w); |
|
49 |
void DrawNewsNewRoadVehAvail(Window *w); |
|
50 |
void DrawNewsNewShipAvail(Window *w); |
|
51 |
void DrawNewsNewAircraftAvail(Window *w); |
|
52 |
void DrawNewsBankrupcy(Window *w); |
|
427 | 53 |
static void MoveToNexItem(void); |
0 | 54 |
|
2101
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
55 |
StringID GetNewsStringNewTrainAvail(const NewsItem *ni); |
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
56 |
StringID GetNewsStringNewRoadVehAvail(const NewsItem *ni); |
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
57 |
StringID GetNewsStringNewShipAvail(const NewsItem *ni); |
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
58 |
StringID GetNewsStringNewAircraftAvail(const NewsItem *ni); |
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
59 |
StringID GetNewsStringBankrupcy(const NewsItem *ni); |
0 | 60 |
|
61 |
static DrawNewsCallbackProc * const _draw_news_callback[] = { |
|
427 | 62 |
DrawNewsNewTrainAvail, /* DNC_TRAINAVAIL */ |
63 |
DrawNewsNewRoadVehAvail, /* DNC_ROADAVAIL */ |
|
64 |
DrawNewsNewShipAvail, /* DNC_SHIPAVAIL */ |
|
0 | 65 |
DrawNewsNewAircraftAvail, /* DNC_AIRCRAFTAVAIL */ |
427 | 66 |
DrawNewsBankrupcy, /* DNC_BANKRUPCY */ |
0 | 67 |
}; |
68 |
||
69 |
GetNewsStringCallbackProc * const _get_news_string_callback[] = { |
|
427 | 70 |
GetNewsStringNewTrainAvail, /* DNC_TRAINAVAIL */ |
71 |
GetNewsStringNewRoadVehAvail, /* DNC_ROADAVAIL */ |
|
72 |
GetNewsStringNewShipAvail, /* DNC_SHIPAVAIL */ |
|
0 | 73 |
GetNewsStringNewAircraftAvail, /* DNC_AIRCRAFTAVAIL */ |
427 | 74 |
GetNewsStringBankrupcy, /* DNC_BANKRUPCY */ |
0 | 75 |
}; |
76 |
||
427 | 77 |
void InitNewsItemStructs(void) |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
78 |
{ |
427 | 79 |
memset(_news_items, 0, sizeof(_news_items)); |
80 |
_current_news = INVALID_NEWS; |
|
89 | 81 |
_oldest_news = 0; |
427 | 82 |
_latest_news = INVALID_NEWS; |
83 |
_forced_news = INVALID_NEWS; |
|
89 | 84 |
_total_news = 0; |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
85 |
} |
0 | 86 |
|
427 | 87 |
void DrawNewsBorder(const Window *w) |
0 | 88 |
{ |
89 |
int left = 0; |
|
90 |
int right = w->width - 1; |
|
91 |
int top = 0; |
|
92 |
int bottom = w->height - 1; |
|
93 |
||
94 |
GfxFillRect(left, top, right, bottom, 0xF); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
95 |
|
0 | 96 |
GfxFillRect(left, top, left, bottom, 0xD7); |
97 |
GfxFillRect(right, top, right, bottom, 0xD7); |
|
98 |
GfxFillRect(left, top, right, top, 0xD7); |
|
99 |
GfxFillRect(left, bottom, right, bottom, 0xD7); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
100 |
|
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
101 |
DrawString(left + 2, top + 1, STR_00C6, 0); |
0 | 102 |
} |
103 |
||
104 |
static void NewsWindowProc(Window *w, WindowEvent *e) |
|
105 |
{ |
|
427 | 106 |
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
|
107 |
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
|
108 |
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
|
109 |
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
|
110 |
} break; |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1390
diff
changeset
|
111 |
|
0 | 112 |
case WE_PAINT: { |
427 | 113 |
const NewsItem *ni = WP(w, news_d).ni; |
0 | 114 |
ViewPort *vp; |
115 |
||
427 | 116 |
switch (ni->display_mode) { |
117 |
case NM_NORMAL: |
|
118 |
case NM_THIN: { |
|
119 |
DrawNewsBorder(w); |
|
0 | 120 |
|
427 | 121 |
DrawString(2, 1, STR_00C6, 0); |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
122 |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
123 |
SetDParam(0, ni->date); |
427 | 124 |
DrawStringRightAligned(428, 1, STR_01FF, 0); |
125 |
||
126 |
if (!(ni->flags & NF_VIEWPORT)) { |
|
127 |
COPY_IN_DPARAM(0, ni->params, lengthof(ni->params)); |
|
128 |
DrawStringMultiCenter(215, ni->display_mode == NM_NORMAL ? 76 : 56, |
|
129 |
ni->string_id, 426); |
|
130 |
} else { |
|
131 |
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
|
132 |
_display_opt &= ~DO_TRANS_BUILDINGS; |
427 | 133 |
DrawWindowViewport(w); |
134 |
_display_opt = bk; |
|
135 |
||
136 |
/* Shade the viewport into gray, or color*/ |
|
137 |
vp = w->viewport; |
|
138 |
GfxFillRect(vp->left - w->left, vp->top - w->top, |
|
139 |
vp->left - w->left + vp->width - 1, vp->top - w->top + vp->height - 1, |
|
2227
24f19bde1400
(svn r2747) -Fix: r2736 broke the newpaper display. Sorry.
celestar
parents:
2186
diff
changeset
|
140 |
(ni->flags & NF_INCOLOR ? 0x322 : 0x323) | USE_COLORTABLE |
427 | 141 |
); |
142 |
||
143 |
COPY_IN_DPARAM(0, ni->params, lengthof(ni->params)); |
|
144 |
DrawStringMultiCenter(w->width / 2, 20, ni->string_id, 428); |
|
145 |
} |
|
146 |
break; |
|
0 | 147 |
} |
427 | 148 |
|
149 |
case NM_CALLBACK: { |
|
150 |
_draw_news_callback[ni->callback](w); |
|
151 |
break; |
|
152 |
} |
|
153 |
||
154 |
default: { |
|
155 |
DrawWindowWidgets(w); |
|
156 |
if (!(ni->flags & NF_VIEWPORT)) { |
|
157 |
COPY_IN_DPARAM(0, ni->params, lengthof(ni->params)); |
|
158 |
DrawStringMultiCenter(140, 38, ni->string_id, 276); |
|
159 |
} else { |
|
160 |
DrawWindowViewport(w); |
|
161 |
COPY_IN_DPARAM(0, ni->params, lengthof(ni->params)); |
|
162 |
DrawStringMultiCenter(w->width / 2, w->height - 16, ni->string_id, 276); |
|
163 |
} |
|
164 |
break; |
|
0 | 165 |
} |
166 |
} |
|
167 |
} break; |
|
168 |
||
169 |
case WE_CLICK: { |
|
427 | 170 |
switch (e->click.widget) { |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
171 |
case 1: { |
427 | 172 |
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
|
173 |
DeleteWindow(w); |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
174 |
ni->duration = 0; |
427 | 175 |
_forced_news = INVALID_NEWS; |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
176 |
} break; |
0 | 177 |
case 0: { |
427 | 178 |
NewsItem *ni = WP(w, news_d).ni; |
0 | 179 |
if (ni->flags & NF_VEHICLE) { |
919
b0d6c7642f99
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
893
diff
changeset
|
180 |
Vehicle *v = GetVehicle(ni->data_a); |
0 | 181 |
ScrollMainWindowTo(v->x_pos, v->y_pos); |
182 |
} else if (ni->flags & NF_TILE) { |
|
183 |
if (!ScrollMainWindowToTile(ni->data_a) && ni->data_b != 0) |
|
184 |
ScrollMainWindowToTile(ni->data_b); |
|
185 |
} |
|
186 |
} break; |
|
187 |
} |
|
188 |
} break; |
|
189 |
||
190 |
case WE_KEYPRESS: |
|
191 |
if (e->keypress.keycode == WKC_SPACE) { |
|
192 |
// Don't continue. |
|
193 |
e->keypress.cont = false; |
|
194 |
DeleteWindow(w); |
|
195 |
} |
|
196 |
break; |
|
197 |
||
1648
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1390
diff
changeset
|
198 |
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
|
199 |
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
|
200 |
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
|
201 |
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
|
202 |
} |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1390
diff
changeset
|
203 |
break; |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1390
diff
changeset
|
204 |
|
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1390
diff
changeset
|
205 |
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
|
206 |
int diff; |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1390
diff
changeset
|
207 |
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
|
208 |
if (y == w->top) return; |
0 | 209 |
|
210 |
if (w->viewport != NULL) |
|
211 |
w->viewport->top += y - w->top; |
|
212 |
||
1648
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1390
diff
changeset
|
213 |
diff = abs(w->top - y); |
0 | 214 |
w->top = y; |
215 |
||
1648
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1390
diff
changeset
|
216 |
SetDirtyBlocks(w->left, w->top - diff, w->left + w->width, w->top + w->height); |
0 | 217 |
} break; |
218 |
} |
|
219 |
} |
|
220 |
||
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
221 |
// returns the correct index in the array |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
222 |
// (to deal with overflows) |
1095 | 223 |
static byte increaseIndex(byte i) |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
224 |
{ |
4000
bab1ebc37da0
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3155
diff
changeset
|
225 |
if (i == INVALID_NEWS) return 0; |
83
bd21afea96d8
(svn r84) Improved news system code a little to avoid potential memory leaks
dominik
parents:
80
diff
changeset
|
226 |
i++; |
4000
bab1ebc37da0
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3155
diff
changeset
|
227 |
if (i >= MAX_NEWS) i = i % MAX_NEWS; |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
228 |
return i; |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
229 |
} |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
230 |
|
0 | 231 |
void AddNewsItem(StringID string, uint32 flags, uint data_a, uint data_b) |
232 |
{ |
|
233 |
NewsItem *ni; |
|
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
234 |
Window *w; |
0 | 235 |
|
4000
bab1ebc37da0
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3155
diff
changeset
|
236 |
if (_game_mode == GM_MENU) return; |
0 | 237 |
|
102
1d277a07f1f1
(svn r103) Fix: rare newspaper crash with too many messages [ 1009976 ] (thx to blathij)s
dominik
parents:
94
diff
changeset
|
238 |
// check the rare case that the oldest (to be overwritten) news item is open |
935 | 239 |
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
|
240 |
MoveToNexItem(); |
1d277a07f1f1
(svn r103) Fix: rare newspaper crash with too many messages [ 1009976 ] (thx to blathij)s
dominik
parents:
94
diff
changeset
|
241 |
|
427 | 242 |
_forced_news = INVALID_NEWS; |
243 |
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
|
244 |
|
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
245 |
// 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
|
246 |
_latest_news = increaseIndex(_latest_news); |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
247 |
|
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
248 |
// overwrite oldest news entry |
427 | 249 |
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
|
250 |
_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
|
251 |
|
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
252 |
// add news to _latest_news |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
253 |
ni = &_news_items[_latest_news]; |
745
623f0d007a9e
(svn r1201) -Fix: I forgot to add a * in r1183 ;)
truelight
parents:
731
diff
changeset
|
254 |
memset(ni, 0, sizeof(*ni)); |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
255 |
|
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
256 |
ni->string_id = string; |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
257 |
ni->display_mode = (byte)flags; |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
258 |
ni->flags = (byte)(flags >> 8) | NF_NOEXPIRE; |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
259 |
|
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
260 |
// show this news message in color? |
4293
2c24234a7aec
(svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents:
4285
diff
changeset
|
261 |
if (_cur_year >= _patches.colored_news_year) |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
262 |
ni->flags |= NF_INCOLOR; |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
263 |
|
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
264 |
ni->type = (byte)(flags >> 16); |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
265 |
ni->callback = (byte)(flags >> 24); |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
266 |
ni->data_a = data_a; |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
267 |
ni->data_b = data_b; |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
268 |
ni->date = _date; |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
269 |
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
|
270 |
|
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
271 |
w = FindWindowById(WC_MESSAGE_HISTORY, 0); |
427 | 272 |
if (w == NULL) return; |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
273 |
SetWindowDirty(w); |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
274 |
w->vscroll.count = _total_news; |
0 | 275 |
} |
276 |
||
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
|
277 |
|
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
278 |
// don't show item if it's older than x days |
0 | 279 |
static const byte _news_items_age[] = {60, 60, 90, 60, 90, 30, 150, 30, 90, 180}; |
280 |
||
281 |
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
|
282 |
{ 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
|
283 |
{ 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
|
284 |
{ WIDGETS_END}, |
0 | 285 |
}; |
286 |
||
287 |
static WindowDesc _news_type13_desc = { |
|
288 |
WDP_CENTER, 476, 430, 170, |
|
427 | 289 |
WC_NEWS_WINDOW, 0, |
0 | 290 |
WDF_DEF_WIDGET, |
291 |
_news_type13_widgets, |
|
292 |
NewsWindowProc |
|
293 |
}; |
|
294 |
||
295 |
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
|
296 |
{ 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
|
297 |
{ 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
|
298 |
{ WIDGETS_END}, |
0 | 299 |
}; |
300 |
||
301 |
static WindowDesc _news_type2_desc = { |
|
302 |
WDP_CENTER, 476, 430, 130, |
|
427 | 303 |
WC_NEWS_WINDOW, 0, |
0 | 304 |
WDF_DEF_WIDGET, |
305 |
_news_type2_widgets, |
|
306 |
NewsWindowProc |
|
307 |
}; |
|
308 |
||
309 |
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
|
310 |
{ WWT_PANEL, RESIZE_NONE, 5, 0, 279, 14, 86, 0x0, STR_NULL}, |
2725
5c632bc5be28
(svn r3270) Correct all (mis)uses of WWT_CLOSEBOX / WWT_TEXTBTN to reflect their actual use, and add "Close Window" tooltip where missing.
peter1138
parents:
2639
diff
changeset
|
311 |
{ WWT_CLOSEBOX, RESIZE_NONE, 5, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
745
diff
changeset
|
312 |
{ 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
|
313 |
{ 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
|
314 |
{ WIDGETS_END}, |
0 | 315 |
}; |
316 |
||
317 |
static WindowDesc _news_type0_desc = { |
|
318 |
WDP_CENTER, 476, 280, 87, |
|
427 | 319 |
WC_NEWS_WINDOW, 0, |
0 | 320 |
WDF_DEF_WIDGET, |
321 |
_news_type0_widgets, |
|
322 |
NewsWindowProc |
|
323 |
}; |
|
324 |
||
427 | 325 |
static const SoundFx _news_sounds[] = { |
326 |
SND_1D_APPLAUSE, |
|
327 |
SND_1D_APPLAUSE, |
|
328 |
0, |
|
329 |
0, |
|
330 |
0, |
|
331 |
0, |
|
332 |
SND_1E_OOOOH, |
|
333 |
0, |
|
334 |
0, |
|
335 |
0 |
|
336 |
}; |
|
0 | 337 |
|
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
|
338 |
/** 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
|
339 |
* 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
|
340 |
* @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
|
341 |
* @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
|
342 |
*/ |
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 |
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
|
344 |
{ |
2549 | 345 |
assert(item < 10 && GB(_news_display_opt, item * 2, 2) <= 2); |
346 |
return GB(_news_display_opt, item * 2, 2); |
|
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
|
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 |
|
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 |
/** 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
|
350 |
* 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
|
351 |
* @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
|
352 |
* @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
|
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 |
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
|
355 |
{ |
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 |
assert(item < 10 && val <= 2); |
2549 | 357 |
SB(_news_display_opt, item * 2, 2, val); |
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
|
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 |
|
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
360 |
// 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
|
361 |
static void ShowNewspaper(NewsItem *ni) |
0 | 362 |
{ |
363 |
Window *w; |
|
2498
befad2fe53d2
(svn r3024) -Codechange: Another batch of replacements of int/uint/int16/byte/-1 with proper types and constants
tron
parents:
2227
diff
changeset
|
364 |
SoundFx sound; |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
365 |
int top; |
427 | 366 |
ni->flags &= ~(NF_NOEXPIRE | NF_FORCE_BIG); |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
367 |
ni->duration = 555; |
0 | 368 |
|
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
369 |
sound = _news_sounds[ni->type]; |
2639 | 370 |
if (sound != 0) SndPlayFx(sound); |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
371 |
|
1648
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1390
diff
changeset
|
372 |
top = _screen.height; |
427 | 373 |
switch (ni->display_mode) { |
374 |
case NM_NORMAL: |
|
375 |
case NM_CALLBACK: { |
|
376 |
_news_type13_desc.top = top; |
|
377 |
w = AllocateWindowDesc(&_news_type13_desc); |
|
378 |
if (ni->flags & NF_VIEWPORT) |
|
379 |
AssignWindowViewport(w, 2, 58, 0x1AA, 0x6E, |
|
380 |
ni->data_a | (ni->flags & NF_VEHICLE ? 0x80000000 : 0), 0); |
|
381 |
break; |
|
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
382 |
} |
427 | 383 |
|
384 |
case NM_THIN: { |
|
385 |
_news_type2_desc.top = top; |
|
386 |
w = AllocateWindowDesc(&_news_type2_desc); |
|
387 |
if (ni->flags & NF_VIEWPORT) |
|
388 |
AssignWindowViewport(w, 2, 58, 0x1AA, 0x46, |
|
389 |
ni->data_a | (ni->flags & NF_VEHICLE ? 0x80000000 : 0), 0); |
|
390 |
break; |
|
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
391 |
} |
427 | 392 |
|
393 |
default: { |
|
394 |
_news_type0_desc.top = top; |
|
395 |
w = AllocateWindowDesc(&_news_type0_desc); |
|
396 |
if (ni->flags & NF_VIEWPORT) |
|
397 |
AssignWindowViewport(w, 3, 17, 0x112, 0x2F, |
|
398 |
ni->data_a | (ni->flags & NF_VEHICLE ? 0x80000000 : 0), 0); |
|
399 |
break; |
|
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
400 |
} |
0 | 401 |
} |
427 | 402 |
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
|
403 |
w->flags4 |= WF_DISABLE_VP_SCROLL; |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
404 |
} |
0 | 405 |
|
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
406 |
// show news item in the ticker |
427 | 407 |
static void ShowTicker(const NewsItem *ni) |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
408 |
{ |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
409 |
Window *w; |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
410 |
|
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
|
411 |
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
|
412 |
|
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
413 |
_statusbar_news_item = *ni; |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
414 |
w = FindWindowById(WC_STATUS_BAR, 0); |
2639 | 415 |
if (w != NULL) WP(w, def_d).data_1 = 360; |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
416 |
} |
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 |
|
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
419 |
// Are we ready to show another news item? |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
420 |
// Only if nothing is in the newsticker and no newspaper is displayed |
427 | 421 |
static bool ReadyForNextItem(void) |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
422 |
{ |
427 | 423 |
const Window *w; |
424 |
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
|
425 |
NewsItem *ni; |
20b4c7536349
(svn r93) Fix: memory leak in news system (blathijs)
dominik
parents:
89
diff
changeset
|
426 |
|
427 | 427 |
if (item >= MAX_NEWS) return true; |
92
20b4c7536349
(svn r93) Fix: memory leak in news system (blathijs)
dominik
parents:
89
diff
changeset
|
428 |
ni = &_news_items[item]; |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
429 |
|
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
430 |
// Ticker message |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
431 |
// 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
|
432 |
w = FindWindowById(WC_STATUS_BAR, 0); |
2639 | 433 |
if (w != NULL && WP(w, const def_d).data_1 > -1280) return false; |
0 | 434 |
|
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
435 |
// Newspaper message |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
436 |
// Wait until duration reaches 0 |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
437 |
if (ni->duration != 0) { |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
438 |
ni->duration--; |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
439 |
return false; |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
440 |
} |
0 | 441 |
|
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
442 |
// neither newsticker nor newspaper are running |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
443 |
return true; |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
444 |
} |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
445 |
|
427 | 446 |
static void MoveToNexItem(void) |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
447 |
{ |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
448 |
DeleteWindowById(WC_NEWS_WINDOW, 0); |
427 | 449 |
_forced_news = INVALID_NEWS; |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
450 |
|
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
451 |
// if we're not at the last item, than move on |
427 | 452 |
if (_current_news != _latest_news) { |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
453 |
NewsItem *ni; |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
454 |
|
83
bd21afea96d8
(svn r84) Improved news system code a little to avoid potential memory leaks
dominik
parents:
80
diff
changeset
|
455 |
_current_news = increaseIndex(_current_news); |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
456 |
ni = &_news_items[_current_news]; |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
457 |
|
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
458 |
// check the date, don't show too old items |
2639 | 459 |
if (_date - _news_items_age[ni->type] > ni->date) return; |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
460 |
|
2639 | 461 |
switch (GetNewsDisplayValue(ni->type)) { |
462 |
case 0: { /* Off - show nothing only a small reminder in the status bar */ |
|
4171 | 463 |
Window *w = FindWindowById(WC_STATUS_BAR, 0); |
2639 | 464 |
|
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
|
465 |
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
|
466 |
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
|
467 |
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
|
468 |
} |
2639 | 469 |
break; |
470 |
} |
|
471 |
||
472 |
case 1: /* Summary - show ticker, but if forced big, cascade to full */ |
|
473 |
if (!(ni->flags & NF_FORCE_BIG)) { |
|
474 |
ShowTicker(ni); |
|
475 |
break; |
|
476 |
} |
|
477 |
/* Fallthrough */ |
|
478 |
||
479 |
case 2: /* Full - show newspaper*/ |
|
480 |
ShowNewspaper(ni); |
|
481 |
break; |
|
482 |
} |
|
0 | 483 |
} |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
484 |
} |
0 | 485 |
|
427 | 486 |
void NewsLoop(void) |
0 | 487 |
{ |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
488 |
// no news item yet |
427 | 489 |
if (_total_news == 0) return; |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
490 |
|
2639 | 491 |
if (ReadyForNextItem()) MoveToNexItem(); |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
492 |
} |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
493 |
|
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
494 |
/* Do a forced show of a specific message */ |
1095 | 495 |
static void ShowNewsMessage(byte i) |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
496 |
{ |
427 | 497 |
if (_total_news == 0) return; |
89 | 498 |
|
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
499 |
// Delete the news window |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
500 |
DeleteWindowById(WC_NEWS_WINDOW, 0); |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
501 |
|
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
502 |
// setup forced news item |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
503 |
_forced_news = i; |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
504 |
|
427 | 505 |
if (_forced_news != INVALID_NEWS) { |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
506 |
NewsItem *ni = &_news_items[_forced_news]; |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
507 |
ni->duration = 555; |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
508 |
ni->flags |= NF_NOEXPIRE | NF_FORCE_BIG; |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
509 |
DeleteWindowById(WC_NEWS_WINDOW, 0); |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
510 |
ShowNewspaper(ni); |
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
511 |
} |
0 | 512 |
} |
513 |
||
427 | 514 |
void ShowLastNewsMessage(void) |
0 | 515 |
{ |
2549 | 516 |
if (_forced_news == INVALID_NEWS) { |
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
517 |
ShowNewsMessage(_current_news); |
2549 | 518 |
} else if (_forced_news != 0) { |
427 | 519 |
ShowNewsMessage(_forced_news - 1); |
2549 | 520 |
} else { |
521 |
ShowNewsMessage(_total_news != MAX_NEWS ? _latest_news : MAX_NEWS - 1); |
|
83
bd21afea96d8
(svn r84) Improved news system code a little to avoid potential memory leaks
dominik
parents:
80
diff
changeset
|
522 |
} |
0 | 523 |
} |
524 |
||
79
15e3eef5f73d
(svn r80) New internal news system (implemented with fifo queue)
dominik
parents:
0
diff
changeset
|
525 |
|
89 | 526 |
/* return news by number, with 0 being the most |
427 | 527 |
recent news. Returns INVALID_NEWS if end of queue reached. */ |
89 | 528 |
static byte getNews(byte i) |
529 |
{ |
|
2639 | 530 |
if (i >= _total_news) return INVALID_NEWS; |
89 | 531 |
|
2639 | 532 |
if (_latest_news < i) { |
89 | 533 |
i = _latest_news + MAX_NEWS - i; |
2639 | 534 |
} else { |
89 | 535 |
i = _latest_news - i; |
2639 | 536 |
} |
89 | 537 |
|
427 | 538 |
i %= MAX_NEWS; |
89 | 539 |
return i; |
540 |
} |
|
541 |
||
2101
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
542 |
/** Draw an unformatted news message truncated to a maximum length. If |
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
543 |
* length exceeds maximum length it will be postfixed by '...' |
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
544 |
* @param x,y position of the string |
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
545 |
* @param color the color the string will be shown in |
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
546 |
* @param *ni NewsItem being printed |
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
547 |
* @param maxw maximum width of string in pixels |
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
548 |
*/ |
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
549 |
static void DrawNewsString(int x, int y, uint16 color, const NewsItem *ni, uint maxw) |
89 | 550 |
{ |
2101
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
551 |
char buffer[512], buffer2[512]; |
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
552 |
char *ptr, *dest; |
89 | 553 |
StringID str; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
554 |
|
89 | 555 |
if (ni->display_mode == 3) { |
556 |
str = _get_news_string_callback[ni->callback](ni); |
|
557 |
} else { |
|
558 |
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
|
559 |
str = ni->string_id; |
89 | 560 |
} |
561 |
||
2101
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
562 |
GetString(buffer, str); |
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
563 |
/* Copy the just gotten string to another buffer to remove any formatting |
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
564 |
* from it such as big fonts, etc. */ |
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
565 |
for (ptr = buffer, dest = buffer2; *ptr != '\0'; ptr++) { |
2150
010d923a81a9
(svn r2660) Get rid of some more shifting/anding/casting
tron
parents:
2101
diff
changeset
|
566 |
if (*ptr == '\r') { |
2101
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
567 |
dest[0] = dest[1] = dest[2] = dest[3] = ' '; |
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
568 |
dest += 4; |
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
569 |
} else if ((byte)*ptr >= ' ' && ((byte)*ptr < 0x88 || (byte)*ptr >= 0x99)) { |
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
570 |
*dest++ = *ptr; |
89 | 571 |
} |
572 |
} |
|
2101
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
573 |
|
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
574 |
*dest = '\0'; |
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
575 |
/* Truncate and show string; postfixed by '...' if neccessary */ |
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
576 |
DoDrawStringTruncated(buffer2, x, y, color, maxw); |
89 | 577 |
} |
578 |
||
579 |
||
580 |
static void MessageHistoryWndProc(Window *w, WindowEvent *e) |
|
581 |
{ |
|
427 | 582 |
switch (e->event) { |
89 | 583 |
case WE_PAINT: { |
427 | 584 |
int y = 19; |
89 | 585 |
byte p, show; |
586 |
||
3155
b2cd7bc9f90f
(svn r3778) - Fix crash when resizing news history window.
peter1138
parents:
3143
diff
changeset
|
587 |
SetVScrollCount(w, _total_news); |
89 | 588 |
DrawWindowWidgets(w); |
589 |
||
427 | 590 |
if (_total_news == 0) break; |
1097
653c846fb5d9
(svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents:
1095
diff
changeset
|
591 |
show = min(_total_news, w->vscroll.cap); |
89 | 592 |
|
427 | 593 |
for (p = w->vscroll.pos; p < w->vscroll.pos + show; p++) { |
89 | 594 |
// get news in correct order |
2101
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
595 |
const NewsItem *ni = &_news_items[getNews(p)]; |
89 | 596 |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
597 |
SetDParam(0, ni->date); |
2101
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
598 |
DrawString(4, y, STR_SHORT_DATE, 12); |
89 | 599 |
|
2101
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
1959
diff
changeset
|
600 |
DrawNewsString(82, y, 12, ni, w->width - 95); |
89 | 601 |
y += 12; |
602 |
} |
|
603 |
break; |
|
604 |
} |
|
605 |
||
606 |
case WE_CLICK: |
|
427 | 607 |
switch (e->click.widget) { |
1097
653c846fb5d9
(svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents:
1095
diff
changeset
|
608 |
case 3: { |
89 | 609 |
int y = (e->click.pt.y - 19) / 12; |
610 |
byte p, q; |
|
611 |
||
427 | 612 |
#if 0 // === DEBUG code only |
2549 | 613 |
for (p = 0; p < _total_news; p++) { |
89 | 614 |
NewsItem *ni; |
615 |
byte buffer[256]; |
|
427 | 616 |
ni = &_news_items[p]; |
89 | 617 |
GetNewsString(ni, buffer); |
618 |
printf("%i\t%i\t%s\n", p, ni->date, buffer); |
|
619 |
} |
|
620 |
printf("=========================\n"); |
|
427 | 621 |
#endif |
89 | 622 |
|
623 |
p = y + w->vscroll.pos; |
|
427 | 624 |
if (p > _total_news - 1) break; |
89 | 625 |
|
2639 | 626 |
if (_latest_news >= p) { |
427 | 627 |
q = _latest_news - p; |
2639 | 628 |
} else { |
427 | 629 |
q = _latest_news + MAX_NEWS - p; |
2639 | 630 |
} |
89 | 631 |
ShowNewsMessage(q); |
632 |
||
633 |
break; |
|
634 |
} |
|
635 |
} |
|
636 |
break; |
|
1097
653c846fb5d9
(svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents:
1095
diff
changeset
|
637 |
|
653c846fb5d9
(svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents:
1095
diff
changeset
|
638 |
case WE_RESIZE: |
653c846fb5d9
(svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents:
1095
diff
changeset
|
639 |
w->vscroll.cap += e->sizing.diff.y / 12; |
653c846fb5d9
(svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents:
1095
diff
changeset
|
640 |
break; |
89 | 641 |
} |
642 |
} |
|
643 |
||
644 |
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
|
645 |
{ 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
|
646 |
{ 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
|
647 |
{ 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
|
648 |
{ 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
|
649 |
{ 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
|
650 |
{ 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
|
651 |
{ WIDGETS_END}, |
89 | 652 |
}; |
653 |
||
654 |
static const WindowDesc _message_history_desc = { |
|
655 |
240, 22, 400, 140, |
|
427 | 656 |
WC_MESSAGE_HISTORY, 0, |
1097
653c846fb5d9
(svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents:
1095
diff
changeset
|
657 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, |
89 | 658 |
_message_history_widgets, |
659 |
MessageHistoryWndProc |
|
660 |
}; |
|
661 |
||
427 | 662 |
void ShowMessageHistory(void) |
89 | 663 |
{ |
664 |
Window *w; |
|
665 |
||
666 |
DeleteWindowById(WC_MESSAGE_HISTORY, 0); |
|
667 |
w = AllocateWindowDesc(&_message_history_desc); |
|
668 |
||
427 | 669 |
if (w != NULL) { |
89 | 670 |
w->vscroll.cap = 10; |
671 |
w->vscroll.count = _total_news; |
|
1097
653c846fb5d9
(svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents:
1095
diff
changeset
|
672 |
w->resize.step_height = 12; |
653c846fb5d9
(svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents:
1095
diff
changeset
|
673 |
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
|
674 |
w->resize.step_width = 1; |
653c846fb5d9
(svn r1598) Feature: Message history now is stickyable and resizeable
dominik
parents:
1095
diff
changeset
|
675 |
w->resize.width = 200; // can't make window any smaller than 200 pixel |
89 | 676 |
SetWindowDirty(w); |
677 |
} |
|
678 |
} |
|
679 |
||
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
|
680 |
/** 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
|
681 |
* 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
|
682 |
* 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
|
683 |
* 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
|
684 |
*/ |
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
|
685 |
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
|
686 |
{ |
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
|
687 |
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
|
688 |
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
|
689 |
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
|
690 |
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
|
691 |
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
|
692 |
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
|
693 |
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
|
694 |
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
|
695 |
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
|
696 |
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
|
697 |
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
|
698 |
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
|
699 |
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
|
700 |
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
|
701 |
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
|
702 |
} |
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
|
703 |
} |
0 | 704 |
|
705 |
static void MessageOptionsWndProc(Window *w, WindowEvent *e) |
|
706 |
{ |
|
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
|
707 |
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
|
708 |
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
|
709 |
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
|
710 |
(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
|
711 |
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
|
712 |
(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
|
713 |
}; |
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 |
|
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 |
/* 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
|
716 |
* WP(w, def_d).data_2 stores state of the ALL on/off/summary button */ |
427 | 717 |
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
|
718 |
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
|
719 |
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
|
720 |
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
|
721 |
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
|
722 |
|
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 |
// 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
|
724 |
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
|
725 |
} 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
|
726 |
|
0 | 727 |
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
|
728 |
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
|
729 |
int click_state = WP(w, def_d).data_1; |
0 | 730 |
int i, y; |
731 |
||
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
|
732 |
if (_news_ticker_sound) SETBIT(w->click_state, 25); |
0 | 733 |
DrawWindowWidgets(w); |
734 |
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
|
735 |
|
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
|
736 |
/* 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
|
737 |
* 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
|
738 |
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
|
739 |
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
|
740 |
|
1938
21bd6ef5f85e
(svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents:
1891
diff
changeset
|
741 |
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
|
742 |
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
|
743 |
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
|
744 |
} |
0 | 745 |
|
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
|
746 |
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
|
747 |
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
|
748 |
DrawString(103, y + 9 + 12, STR_MESSAGE_SOUND, 0); |
0 | 749 |
|
750 |
} 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
|
751 |
|
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 |
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
|
753 |
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
|
754 |
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
|
755 |
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
|
756 |
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
|
757 |
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
|
758 |
|
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
|
759 |
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
|
760 |
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
|
761 |
|
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 |
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
|
763 |
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
|
764 |
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
|
765 |
} |
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 |
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
|
767 |
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
|
768 |
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
|
769 |
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
|
770 |
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
|
771 |
_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
|
772 |
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
|
773 |
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
|
774 |
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
|
775 |
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
|
776 |
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
|
777 |
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
|
778 |
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
|
779 |
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
|
780 |
|
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 |
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
|
782 |
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
|
783 |
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
|
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 |
} 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
|
786 |
} 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
|
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 |
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
|
789 |
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
|
790 |
_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
|
791 |
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
|
792 |
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
|
793 |
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
|
794 |
|
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 |
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
|
796 |
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
|
797 |
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
|
798 |
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
|
799 |
|
0 | 800 |
} |
801 |
} |
|
802 |
||
803 |
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
|
804 |
{ 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
|
805 |
{ 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
|
806 |
{ WWT_PANEL, RESIZE_NONE, 13, 0, 409, 14, 184, STR_NULL, STR_NULL}, |
0 | 807 |
|
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
|
808 |
{ 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
|
809 |
{ 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
|
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 |
{ 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
|
812 |
{ 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
|
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 |
{ 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
|
815 |
{ 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
|
816 |
|
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 |
{ 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
|
818 |
{ 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
|
819 |
|
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 |
{ 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
|
821 |
{ 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
|
822 |
|
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 |
{ 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
|
824 |
{ 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
|
825 |
|
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
|
826 |
{ 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
|
827 |
{ 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
|
828 |
|
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
|
829 |
{ 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
|
830 |
{ 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
|
831 |
|
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_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
|
833 |
{ 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
|
834 |
|
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, 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
|
836 |
{ 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
|
837 |
|
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_PANEL, RESIZE_NONE, 3, 4, 86, 154, 165, STR_NULL, STR_NULL}, |
2725
5c632bc5be28
(svn r3270) Correct all (mis)uses of WWT_CLOSEBOX / WWT_TEXTBTN to reflect their actual use, and add "Close Window" tooltip where missing.
peter1138
parents:
2639
diff
changeset
|
839 |
{ WWT_TEXTBTN, RESIZE_NONE, 3, 87, 98, 154, 165, STR_0225, STR_NULL}, |
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
|
840 |
{ WWT_4, RESIZE_NONE, 3, 4, 98, 166, 177, STR_02DB_OFF, STR_NULL}, |
0 | 841 |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
102
diff
changeset
|
842 |
{ WIDGETS_END}, |
0 | 843 |
}; |
844 |
||
845 |
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
|
846 |
270, 22, 410, 185, |
427 | 847 |
WC_GAME_OPTIONS, 0, |
0 | 848 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
849 |
_message_options_widgets, |
|
850 |
MessageOptionsWndProc |
|
851 |
}; |
|
852 |
||
427 | 853 |
void ShowMessageOptions(void) |
0 | 854 |
{ |
855 |
DeleteWindowById(WC_GAME_OPTIONS, 0); |
|
856 |
AllocateWindowDesc(&_message_options_desc); |
|
857 |
} |
|
3139
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
858 |
|
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
859 |
|
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
860 |
void DeleteVehicleNews(VehicleID vid, StringID news) |
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
861 |
{ |
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
862 |
byte n; |
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
863 |
|
3143 | 864 |
for (n = _oldest_news; _latest_news != INVALID_NEWS && n != (_latest_news + 1) % MAX_NEWS; n = (n + 1) % MAX_NEWS) { |
3139
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
865 |
const NewsItem* ni = &_news_items[n]; |
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
866 |
|
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
867 |
if (ni->flags & NF_VEHICLE && |
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
868 |
ni->data_a == vid && |
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
869 |
(news == INVALID_STRING_ID || ni->string_id == news)) { |
4171 | 870 |
Window *w; |
3139
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
871 |
byte i; |
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
872 |
|
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
873 |
if (_forced_news == n) MoveToNexItem(); |
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
874 |
if (_current_news == n) MoveToNexItem(); |
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
875 |
|
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
876 |
// If this is the last news item, invalidate _latest_news |
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
877 |
if (_latest_news == _oldest_news) _latest_news = INVALID_NEWS; |
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
878 |
|
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
879 |
for (i = n; i != _oldest_news; i = (i + MAX_NEWS - 1) % MAX_NEWS) { |
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
880 |
_news_items[i] = _news_items[(i + MAX_NEWS - 1) % MAX_NEWS]; |
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
881 |
} |
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
882 |
_oldest_news = (_oldest_news + 1) % MAX_NEWS; |
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
883 |
_total_news--; |
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
884 |
|
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
885 |
w = FindWindowById(WC_MESSAGE_HISTORY, 0); |
3143 | 886 |
if (w != NULL) { |
887 |
SetWindowDirty(w); |
|
888 |
w->vscroll.count = _total_news; |
|
889 |
} |
|
3139
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
890 |
} |
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
891 |
} |
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2791
diff
changeset
|
892 |
} |