OpenTTD Source 20250312-master-gcdcc6b491d
|
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 (EncodedString &&headline, NewsType type, NewsStyle style, NewsFlags flags, NewsReference ref1={}, NewsReference ref2={}, std::unique_ptr< NewsAllocatedData > &&data=nullptr, AdviceType advice_type=AdviceType::Invalid) |
Add a new newsitem to be shown. | |
void | AddCompanyNewsItem (EncodedString &&headline, std::unique_ptr< CompanyNewsInformation > cni) |
void | AddVehicleNewsItem (EncodedString &&headline, NewsType type, VehicleID vehicle, StationID station=StationID::Invalid()) |
Adds a newsitem referencing a vehicle. | |
void | AddVehicleAdviceNewsItem (AdviceType advice_type, EncodedString &&headline, VehicleID vehicle) |
Adds a vehicle-advice news item. | |
void | AddTileNewsItem (EncodedString &&headline, NewsType type, TileIndex tile, StationID station=StationID::Invalid()) |
void | AddIndustryNewsItem (EncodedString &&headline, NewsType type, IndustryID industry) |
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, AdviceType advice_type=AdviceType::Invalid) |
Delete news with a given advice 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. | |
uint32_t | SerialiseNewsReference (const NewsReference &reference) |
Encode a NewsReference for serialisation, e.g. | |
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 | ( | EncodedString && | headline, |
NewsType | type, | ||
NewsStyle | style, | ||
NewsFlags | flags, | ||
NewsReference | ref1, | ||
NewsReference | ref2, | ||
std::unique_ptr< NewsAllocatedData > && | data, | ||
AdviceType | advice_type | ||
) |
Add a new newsitem to be shown.
string | String to display |
type | news category |
flags | display flags for the news |
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. |
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. |
advice_type | Sub-type in case the news type is NewsType::Advice. |
Definition at line 902 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.
|
inline |
Adds a vehicle-advice news item.
Definition at line 40 of file news_func.h.
References AddNewsItem(), Advice, InColour, Small, and VehicleParam0.
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(), NoTransparency, Shaded, and Thin.
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 1040 of file news_gui.cpp.
References DeleteNews().
void DeleteInvalidEngineNews | ( | ) |
Remove engine announcements for invalid engines.
Definition at line 1058 of file news_gui.cpp.
References DeleteNews(), NewsItem::ref1, and NewsItem::ref2.
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 1029 of file news_gui.cpp.
References DeleteNews().
Referenced by Station::~Station().
void DeleteVehicleNews | ( | VehicleID | vid, |
AdviceType | advice_type | ||
) |
Delete news with a given advice type about a vehicle.
When the advice_type is AdviceType::Invalid all news about the vehicle gets deleted.
vid | The vehicle to remove the news for. |
advice_type | The advice type to remove for. |
Definition at line 1017 of file news_gui.cpp.
References NewsItem::advice_type, and DeleteNews().
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 716 of file news_gui.cpp.
References _current_news, _forced_news, _news, _statusbar_news, and NewsWindow::duration.
Referenced by DeleteAllMessages().
void NewsLoop | ( | ) |
Definition at line 1094 of file news_gui.cpp.
uint32_t SerialiseNewsReference | ( | const NewsReference & | reference | ) |
Encode a NewsReference for serialisation, e.g.
for writing in the crash log.
reference | The reference to serialise. |
Definition at line 922 of file news_gui.cpp.
Referenced by SurveyRecentNews().