news_func.h

Go to the documentation of this file.
00001 /* $Id$ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * 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.
00006  * 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.
00007  * 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/>.
00008  */
00009 
00012 #ifndef NEWS_FUNC_H
00013 #define NEWS_FUNC_H
00014 
00015 #include "news_type.h"
00016 #include "vehicle_type.h"
00017 #include "station_type.h"
00018 #include "industry_type.h"
00019 
00020 void AddNewsItem(StringID string, NewsType type, NewsFlag flags, NewsReferenceType reftype1 = NR_NONE, uint32 ref1 = UINT32_MAX, NewsReferenceType reftype2 = NR_NONE, uint32 ref2 = UINT32_MAX, void *free_data = NULL);
00021 
00022 static inline void AddCompanyNewsItem(StringID string, CompanyNewsInformation *cni)
00023 {
00024   AddNewsItem(string, NT_COMPANY_INFO, NF_COMPANY, NR_NONE, UINT32_MAX, NR_NONE, UINT32_MAX, cni);
00025 }
00026 
00032 static inline void AddVehicleNewsItem(StringID string, NewsType type, VehicleID vehicle, StationID station = INVALID_STATION)
00033 {
00034   AddNewsItem(string, type, NF_NO_TRANSPARENT | NF_SHADE | NF_THIN, NR_VEHICLE, vehicle, station == INVALID_STATION ? NR_NONE : NR_STATION, station);
00035 }
00036 
00042 static inline void AddVehicleAdviceNewsItem(StringID string, VehicleID vehicle)
00043 {
00044   AddNewsItem(string, NT_ADVICE, NF_INCOLOUR | NF_SMALL | NF_VEHICLE_PARAM0, NR_VEHICLE, vehicle);
00045 }
00046 
00047 static inline void AddTileNewsItem(StringID string, NewsType type, TileIndex tile, void *free_data = NULL)
00048 {
00049   AddNewsItem(string, type, NF_NO_TRANSPARENT | NF_SHADE | NF_THIN, NR_TILE, tile, NR_NONE, UINT32_MAX, free_data);
00050 }
00051 
00052 static inline void AddIndustryNewsItem(StringID string, NewsType type, IndustryID industry)
00053 {
00054   AddNewsItem(string, type, NF_NO_TRANSPARENT | NF_SHADE | NF_THIN, NR_INDUSTRY, industry);
00055 }
00056 
00057 void NewsLoop();
00058 void InitNewsItemStructs();
00059 
00060 extern const NewsItem *_statusbar_news_item;
00061 extern bool _news_ticker_sound;
00062 
00063 extern NewsTypeData _news_type_data[];
00064 
00065 void DeleteInvalidEngineNews();
00066 void DeleteVehicleNews(VehicleID vid, StringID news);
00067 void DeleteStationNews(StationID sid);
00068 void DeleteIndustryNews(IndustryID iid);
00069 
00070 #endif /* NEWS_FUNC_H */