Update: Translations from eints
[openttd-github.git] / src / news_func.h
blobe24b11525802d17a5896192f231846fb2fe06739
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_t ref1 = UINT32_MAX, NewsReferenceType reftype2 = NR_NONE, uint32_t ref2 = UINT32_MAX, const NewsAllocatedData *data = nullptr);
20 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 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 inline void AddVehicleAdviceNewsItem(StringID string, VehicleID vehicle)
42 AddNewsItem(string, NT_ADVICE, NF_INCOLOUR | NF_SMALL | NF_VEHICLE_PARAM0, NR_VEHICLE, vehicle);
45 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.base(), station == INVALID_STATION ? NR_NONE : NR_STATION, station, data);
50 inline void AddIndustryNewsItem(StringID string, NewsType type, IndustryID industry, const NewsAllocatedData *data = nullptr)
52 AddNewsItem(string, type, NF_NO_TRANSPARENT | NF_SHADE | NF_THIN, NR_INDUSTRY, industry, NR_NONE, UINT32_MAX, data);
55 void NewsLoop();
56 void InitNewsItemStructs();
58 const NewsItem *GetStatusbarNews();
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 */