diff options
author | frosch <frosch@openttd.org> | 2012-05-26 14:16:07 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2012-05-26 14:16:07 +0000 |
commit | 01100053ff5308e0a07b1faa449255527cc12c31 (patch) | |
tree | 7f5bb0b41cc051cc6927dc9ed454ce74b05db362 /src | |
parent | a8c88f43b678b6d44e1fb4f78a51cdb7fb08a8aa (diff) | |
download | openttd-01100053ff5308e0a07b1faa449255527cc12c31.tar.xz |
(svn r24285) -Codechange: Add a more explcit NewsFlag to indicate that the first string parameter is a vehicle ID.
Diffstat (limited to 'src')
-rw-r--r-- | src/news_func.h | 2 | ||||
-rw-r--r-- | src/news_gui.cpp | 10 | ||||
-rw-r--r-- | src/news_type.h | 2 |
3 files changed, 4 insertions, 10 deletions
diff --git a/src/news_func.h b/src/news_func.h index b825c686f..f218db363 100644 --- a/src/news_func.h +++ b/src/news_func.h @@ -41,7 +41,7 @@ static inline void AddVehicleNewsItem(StringID string, NewsType type, VehicleID */ static inline void AddVehicleAdviceNewsItem(StringID string, VehicleID vehicle) { - AddNewsItem(string, NT_ADVICE, NF_INCOLOUR | NF_SMALL, NR_VEHICLE, vehicle); + AddNewsItem(string, NT_ADVICE, NF_INCOLOUR | NF_SMALL | NF_VEHICLE_PARAM0, NR_VEHICLE, vehicle); } static inline void AddTileNewsItem(StringID string, NewsType type, TileIndex tile, void *free_data = NULL) diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 023cd2082..7efa2b212 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -846,15 +846,7 @@ void ChangeVehicleNews(VehicleID from_index, VehicleID to_index) for (NewsItem *ni = _oldest_news; ni != NULL; ni = ni->next) { if (ni->reftype1 == NR_VEHICLE && ni->ref1 == from_index) ni->ref1 = to_index; if (ni->reftype2 == NR_VEHICLE && ni->ref2 == from_index) ni->ref2 = to_index; - - /* Oh noes :( - * Autoreplace is breaking the whole news-reference concept here, as we want to keep the news, - * but do not know which DParams to change. - * - * Currently only NT_ADVICE news have vehicle IDs in their DParams. - * And all NT_ADVICE news have the ID in param 0. - */ - if (ni->type == NT_ADVICE && ni->params[0] == from_index) ni->params[0] = to_index; + if (ni->flags & NF_VEHICLE_PARAM0 && ni->params[0] == from_index) ni->params[0] = to_index; } } diff --git a/src/news_type.h b/src/news_type.h index 602989075..40b6e2c94 100644 --- a/src/news_type.h +++ b/src/news_type.h @@ -81,10 +81,12 @@ enum NewsFlag { NFB_SHADE = 2, ///< News item uses shaded colours. NFB_WINDOW_LAYOUT = 3, ///< First bit for window layout. NFB_WINDOW_LAYOUT_COUNT = 3, ///< Number of bits for window layout. + NFB_VEHICLE_PARAM0 = 6, ///< String param 0 contains a vehicle ID. (special autoreplace behaviour) NF_INCOLOUR = 1 << NFB_INCOLOUR, ///< Bit value for coloured news. NF_NO_TRANSPARENT = 1 << NFB_NO_TRANSPARENT, ///< Bit value for disabling transparency. NF_SHADE = 1 << NFB_SHADE, ///< Bit value for enabling shading. + NF_VEHICLE_PARAM0 = 1 << NFB_VEHICLE_PARAM0, ///< Bit value for specifying that string param 0 contains a vehicle ID. (special autoreplace behaviour) NF_THIN = 0 << NFB_WINDOW_LAYOUT, ///< Thin news item. (Newspaper with headline and viewport) NF_SMALL = 1 << NFB_WINDOW_LAYOUT, ///< Small news item. (Information window with text and viewport) |