Functions | Variables

# news_func.h File Reference

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 ref1=UINT32_MAX, NewsReferenceType reftype2=NR_NONE, uint32 ref2=UINT32_MAX, void *free_data=NULL)
| Add a new newsitem to be shown.
static void | AddCompanyNewsItem (StringID string, CompanyNewsInformation *cni)
static void | AddVehicleNewsItem (StringID string, NewsType type, VehicleID vehicle, StationID station=INVALID_STATION)
| Adds a newsitem referencing a vehicle.
static void | AddVehicleAdviceNewsItem (StringID string, VehicleID vehicle)
| Adds a vehicle-advice news item.
static void | AddTileNewsItem (StringID string, NewsType type, TileIndex tile, void *free_data=NULL)
static void | AddIndustryNewsItem (StringID string, NewsType type, IndustryID industry)
void | NewsLoop ()
void | InitNewsItemStructs ()
| Initialize the news-items data structures.
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.
## Variables
const NewsItem * | _statusbar_news_item

## Detailed Description

Functions related to news.

Definition in file news_func.h.

## Function Documentation

void AddNewsItem | ( | StringID | string,
|  | NewsType | type,
|  | NewsFlag | flags,
|  | NewsReferenceType | reftype1,
|  | uint32 | ref1,
|  | NewsReferenceType | reftype2,
|  | uint32 | ref2,
|  | void * | free_data |
| ) |  |  |

Add a new newsitem to be shown.

Parameters:

  | 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 deleteing 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 deleteing the news when the object is deleted.
  | free_data | Pointer to data that must be freed once the news message is cleared

See also:
  NewsSubtype

Definition at line 633 of file news_gui.cpp.

References _cur_year, _date, _settings_client, _total_news, GUISettings::coloured_news_year, CopyOutDParam(), NewsItem::date, NewsItem::flags, NewsItem::free_data, ClientSettings::gui, lengthof, NewsItem::next, NewsItem::params, NewsItem::prev, NewsItem::ref1, NewsItem::ref2, NewsItem::reftype1, NewsItem::reftype2, SetWindowDirty(), NewsItem::string_id, NewsItem::type, and WC_MESSAGE_HISTORY.

Referenced by AddVehicleAdviceNewsItem(), AddVehicleNewsItem(), Subsidy::AwardTo(), CheckSwitchToEuro(), CmdCustomNewsItem(), CreateSubsidy(), GenerateCompanyName(), NewVehicleAvailable(), ShowRejectOrAcceptNews(), and SubsidyMonthlyLoop().

static void AddVehicleAdviceNewsItem | ( | StringID | string,
|  | VehicleID | vehicle |
| ) |  |  | `[inline, static]`

Adds a vehicle-advice news item.

Warning:
  DParam 0 must reference the vehicle!

Definition at line 42 of file news_func.h.

References AddNewsItem(), NF_INCOLOUR, NF_SMALL, NF_VEHICLE_PARAM0, NR_VEHICLE, and NT_ADVICE.

Referenced by AgeVehicle(), AircraftHandleDestTooFar(), CheckOrders(), Vehicle::HandlePathfindingResult(), and VehicleEnterDepot().

static void AddVehicleNewsItem | ( | StringID | string,
|  | NewsType | type,
|  | VehicleID | vehicle,
|  | StationID | station = `INVALID_STATION` |
| ) |  |  | `[inline, static]`

Adds a newsitem referencing a vehicle.

Warning:
  The DParams may not reference the vehicle due to autoreplace stuff. See AddVehicleAdviceNewsItem for how that can be done.

Definition at line 32 of file news_func.h.

References AddNewsItem(), NF_NO_TRANSPARENT, NF_SHADE, NF_THIN, NR_NONE, NR_STATION, and NR_VEHICLE.

Referenced by AircraftEntersTerminal(), CheckTrainCollision(), CrashAirplane(), DisasterTick_Ufo(), DisasterTick_Zeppeliner(), FloodVehicle(), RoadVehArrivesAt(), ShipArrivesAt(), and TrainEnterStation().

void DeleteIndustryNews | ( | IndustryID | iid | ) |

Remove news regarding given industry.

Parameters:

  | iid | industry to remove news about

Definition at line 812 of file news_gui.cpp.

References DeleteNewsItem(), NewsItem::next, NR_INDUSTRY, NewsItem::ref1, NewsItem::ref2, NewsItem::reftype1, and NewsItem::reftype2.

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.

Parameters:

  | sid | station to remove news about

Definition at line 795 of file news_gui.cpp.

References DeleteNewsItem(), NewsItem::next, NR_STATION, NewsItem::ref1, NewsItem::ref2, NewsItem::reftype1, and NewsItem::reftype2.

Referenced by Station::~Station().

void DeleteVehicleNews | ( | VehicleID | vid,
|  | StringID | news |
| ) |  |  |

Delete a news item type about a vehicle.

When the news item type is INVALID_STRING_ID all news about the vehicle gets deleted.

Parameters:

  | vid | The vehicle to remove the news for.
  | news | The news type to remove.

Definition at line 776 of file news_gui.cpp.

References DeleteNewsItem(), INVALID_STRING_ID, NewsItem::next, NR_VEHICLE, NewsItem::ref1, NewsItem::ref2, NewsItem::reftype1, NewsItem::reftype2, and NewsItem::string_id.

Referenced by AircraftHandleDestTooFar(), CmdStartStopVehicle(), DeleteOrderWarnings(), Vehicle::HandlePathfindingResult(), and Vehicle::~Vehicle().