233 * @param flags various control bits that will show various news-types. See macro NEWS_FLAGS() |
233 * @param flags various control bits that will show various news-types. See macro NEWS_FLAGS() |
234 * @param data_a news-specific value based on news type |
234 * @param data_a news-specific value based on news type |
235 * @param data_b news-specific value based on news type |
235 * @param data_b news-specific value based on news type |
236 * @note flags exists of 4 byte-sized extra parameters.<br/> |
236 * @note flags exists of 4 byte-sized extra parameters.<br/> |
237 * 1. 0 - 7 display_mode, any of the NewsMode enums (NM_)<br/> |
237 * 1. 0 - 7 display_mode, any of the NewsMode enums (NM_)<br/> |
238 * 2. 8 - 15 news flags, any of the NewsFlags enums (NF_) NF_NOEXPIRE and |
238 * 2. 8 - 15 news flags, any of the NewsFlags enums (NF_) NF_INCOLOR are set automatically if needed<br/> |
239 * NF_INCOLOR are set automatically if needed<br/> |
|
240 * 3. 16 - 23 news category, any of the NewsType enums (NT_)<br/> |
239 * 3. 16 - 23 news category, any of the NewsType enums (NT_)<br/> |
241 * 4. 24 - 31 news callback function, any of the NewsCallback enums (DNC_)<br/> |
240 * 4. 24 - 31 news callback function, any of the NewsCallback enums (DNC_)<br/> |
242 * If the display mode is NM_CALLBACK special news is shown and parameter |
241 * If the display mode is NM_CALLBACK special news is shown and parameter |
243 * stringid has a special meaning.<br/> |
242 * stringid has a special meaning.<br/> |
244 * DNC_TRAINAVAIL, DNC_ROADAVAIL, DNC_SHIPAVAIL, DNC_AIRCRAFTAVAIL: StringID is |
243 * DNC_TRAINAVAIL, DNC_ROADAVAIL, DNC_SHIPAVAIL, DNC_AIRCRAFTAVAIL: StringID is |
274 ni = &_news_items[_latest_news]; |
273 ni = &_news_items[_latest_news]; |
275 memset(ni, 0, sizeof(*ni)); |
274 memset(ni, 0, sizeof(*ni)); |
276 |
275 |
277 ni->string_id = string; |
276 ni->string_id = string; |
278 ni->display_mode = (byte)flags; |
277 ni->display_mode = (byte)flags; |
279 ni->flags = (byte)(flags >> 8) | NF_NOEXPIRE; |
278 ni->flags = (byte)(flags >> 8); |
280 |
279 |
281 // show this news message in color? |
280 // show this news message in color? |
282 if (_cur_year >= _patches.colored_news_year) |
281 if (_cur_year >= _patches.colored_news_year) |
283 ni->flags |= NF_INCOLOR; |
282 ni->flags |= NF_INCOLOR; |
284 |
283 |