Fix #9521: Don't load at just removed docks that were part of a multi-dock station...
[openttd-github.git] / src / news_func.h
blob3f21f3dca152fbbd14ace7dac4a9a87dd0e2f0f4
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
8 /** @file news_func.h Functions related to news. */
10 #ifndef NEWS_FUNC_H
11 #define NEWS_FUNC_H
13 #include "news_type.h"
14 #include "vehicle_type.h"
15 #include "station_type.h"
16 #include "industry_type.h"
18 void AddNewsItem(StringID string, NewsType type, NewsFlag flags, NewsReferenceType reftype1 = NR_NONE, uint32 ref1 = UINT32_MAX, NewsReferenceType reftype2 = NR_NONE, uint32 ref2 = UINT32_MAX, const NewsAllocatedData *data = nullptr);
20 static inline void AddCompanyNewsItem(StringID string, CompanyNewsInformation *cni)
22 AddNewsItem(string, NT_COMPANY_INFO, NF_COMPANY, NR_NONE, UINT32_MAX, NR_NONE, UINT32_MAX, cni);
25 /**
26 * Adds a newsitem referencing a vehicle.
28 * @warning The DParams may not reference the vehicle due to autoreplace stuff. See AddVehicleAdviceNewsItem for how that can be done.
30 static inline void AddVehicleNewsItem(StringID string, NewsType type, VehicleID vehicle, StationID station = INVALID_STATION)
32 AddNewsItem(string, type, NF_NO_TRANSPARENT | NF_SHADE | NF_THIN, NR_VEHICLE, vehicle, station == INVALID_STATION ? NR_NONE : NR_STATION, station);
35 /**
36 * Adds a vehicle-advice news item.
38 * @warning DParam 0 must reference the vehicle!
40 static inline void AddVehicleAdviceNewsItem(StringID string, VehicleID vehicle)
42 AddNewsItem(string, NT_ADVICE, NF_INCOLOUR | NF_SMALL | NF_VEHICLE_PARAM0, NR_VEHICLE, vehicle);
45 static inline void AddTileNewsItem(StringID string, NewsType type, TileIndex tile, const NewsAllocatedData *data = nullptr, StationID station = INVALID_STATION)
47 AddNewsItem(string, type, NF_NO_TRANSPARENT | NF_SHADE | NF_THIN, NR_TILE, tile, station == INVALID_STATION ? NR_NONE : NR_STATION, station, data);
50 static inline void AddIndustryNewsItem(StringID string, NewsType type, IndustryID industry)
52 AddNewsItem(string, type, NF_NO_TRANSPARENT | NF_SHADE | NF_THIN, NR_INDUSTRY, industry);
55 void NewsLoop();
56 void InitNewsItemStructs();
58 extern const NewsItem *_statusbar_news_item;
60 void DeleteInvalidEngineNews();
61 void DeleteVehicleNews(VehicleID vid, StringID news);
62 void DeleteStationNews(StationID sid);
63 void DeleteIndustryNews(IndustryID iid);
65 #endif /* NEWS_FUNC_H */