mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-08 15:30:00 +00:00
(svn r24285) -Codechange: Add a more explcit NewsFlag to indicate that the first string parameter is a vehicle ID.
This commit is contained in:
parent
a8c88f43b6
commit
01100053ff
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user