OpenTTD Source 20241224-master-gf74b0cf984
|
Functions related to news. More...
#include "news_type.h"
#include "vehicle_type.h"
#include "station_type.h"
#include "industry_type.h"
Go to the source code of this file.
Functions | |
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, std::unique_ptr< NewsAllocatedData > &&data=nullptr) |
Add a new newsitem to be shown. | |
void | AddCompanyNewsItem (StringID string, std::unique_ptr< CompanyNewsInformation > cni) |
void | AddVehicleNewsItem (StringID string, NewsType type, VehicleID vehicle, StationID station=INVALID_STATION) |
Adds a newsitem referencing a vehicle. | |
void | AddVehicleAdviceNewsItem (StringID string, VehicleID vehicle) |
Adds a vehicle-advice news item. | |
void | AddTileNewsItem (StringID string, NewsType type, TileIndex tile, std::unique_ptr< NewsAllocatedData > &&data=nullptr, StationID station=INVALID_STATION) |
void | AddIndustryNewsItem (StringID string, NewsType type, IndustryID industry, std::unique_ptr< NewsAllocatedData > &&data=nullptr) |
void | NewsLoop () |
void | InitNewsItemStructs () |
Initialize the news-items data structures. | |
const NewsItem * | GetStatusbarNews () |
Get pointer to the current status bar news item. | |
void | DeleteInvalidEngineNews () |
Remove engine announcements for invalid engines. | |
void | DeleteVehicleNews (VehicleID vid, StringID news) |
Delete a news item type about a vehicle. | |
void | DeleteStationNews (StationID sid) |
Remove news regarding given station so there are no 'unknown station now accepts Mail' or 'First train arrived at unknown station' news items. | |
void | DeleteIndustryNews (IndustryID iid) |
Remove news regarding given industry. | |
Functions related to news.
Definition in file news_func.h.
|
inline |
Definition at line 20 of file news_func.h.
|
inline |
Definition at line 50 of file news_func.h.
void AddNewsItem | ( | StringID | string, |
NewsType | type, | ||
NewsFlag | flags, | ||
NewsReferenceType | reftype1, | ||
uint32_t | ref1, | ||
NewsReferenceType | reftype2, | ||
uint32_t | ref2, | ||
std::unique_ptr< NewsAllocatedData > && | data | ||
) |
Add a new newsitem to be shown.
string | String to display |
type | news category |
flags | display flags for the news |
reftype1 | Type of ref1 |
ref1 | Reference 1 to some object: Used for a possible viewport, scrolling after clicking on the news, and for deleting the news when the object is deleted. |
reftype2 | Type of ref2 |
ref2 | Reference 2 to some object: Used for scrolling after clicking on the news, and for deleting the news when the object is deleted. |
data | Pointer to data that must be released once the news message is cleared. |
Definition at line 897 of file news_gui.cpp.
References _news, DeleteNewsItem(), InvalidateWindowData(), MAX_NEWS_AMOUNT, and WC_MESSAGE_HISTORY.
Referenced by AddVehicleAdviceNewsItem(), AddVehicleNewsItem(), Subsidy::AwardTo(), CmdCustomNewsItem(), CreateSubsidy(), GenerateCompanyName(), NewVehicleAvailable(), ShowRejectOrAcceptNews(), TownActionBuyRights(), and TownActionRoadRebuild().
|
inline |
Definition at line 45 of file news_func.h.
Adds a vehicle-advice news item.
Definition at line 40 of file news_func.h.
References AddNewsItem(), NF_INCOLOUR, NF_SMALL, NF_VEHICLE_PARAM0, NR_VEHICLE, and NT_ADVICE.
Referenced by AgeVehicle(), AircraftHandleDestTooFar(), BuildReplacementVehicle(), CheckOrders(), Vehicle::HandlePathfindingResult(), and VehicleEnterDepot().
|
inline |
Adds a newsitem referencing a vehicle.
Definition at line 30 of file news_func.h.
References AddNewsItem(), NF_NO_TRANSPARENT, NF_SHADE, NF_THIN, NR_NONE, NR_STATION, and NR_VEHICLE.
Referenced by AircraftEntersTerminal(), RoadVehArrivesAt(), ShipArrivesAt(), and TrainEnterStation().
void DeleteIndustryNews | ( | IndustryID | iid | ) |
Remove news regarding given industry.
iid | industry to remove news about |
Definition at line 1021 of file news_gui.cpp.
References DeleteNews(), NR_INDUSTRY, NewsItem::ref1, NewsItem::ref2, NewsItem::reftype1, and NewsItem::reftype2.
void DeleteInvalidEngineNews | ( | ) |
Remove engine announcements for invalid engines.
Definition at line 1031 of file news_gui.cpp.
References DeleteNews(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::IsValidID(), NR_ENGINE, NewsItem::ref1, NewsItem::ref2, NewsItem::reftype1, and NewsItem::reftype2.
Referenced by ReloadNewGRFData().
void DeleteStationNews | ( | StationID | sid | ) |
Remove news regarding given station so there are no 'unknown station now accepts Mail' or 'First train arrived at unknown station' news items.
sid | station to remove news about |
Definition at line 1010 of file news_gui.cpp.
References DeleteNews(), NR_STATION, NewsItem::ref1, NewsItem::ref2, NewsItem::reftype1, and NewsItem::reftype2.
Referenced by Station::~Station().
Delete a news item type about a vehicle.
When the news item type is INVALID_STRING_ID all news about the vehicle gets deleted.
vid | The vehicle to remove the news for. |
news | The news type to remove. |
Definition at line 998 of file news_gui.cpp.
References DeleteNews(), INVALID_STRING_ID, NR_VEHICLE, NewsItem::ref1, NewsItem::ref2, NewsItem::reftype1, NewsItem::reftype2, and NewsItem::string_id.
Referenced by AircraftHandleDestTooFar(), CmdStartStopVehicle(), DeleteOrderWarnings(), Vehicle::HandlePathfindingResult(), and Vehicle::~Vehicle().
const NewsItem * GetStatusbarNews | ( | ) |
Get pointer to the current status bar news item.
Definition at line 70 of file news_gui.cpp.
References _news, and _statusbar_news.
Referenced by StatusBarWindow::DrawWidget(), and ReadyForNextTickerItem().
void InitNewsItemStructs | ( | ) |
Initialize the news-items data structures.
Definition at line 719 of file news_gui.cpp.
References _current_news, _forced_news, _news, _statusbar_news, and NewsWindow::duration.
Referenced by DeleteAllMessages().
void NewsLoop | ( | ) |
Definition at line 1061 of file news_gui.cpp.