OpenTTD Source 20250428-master-g68ba2735ea
news_type.h File Reference

Types related to news. More...

#include "core/enum_type.hpp"
#include "engine_type.h"
#include "industry_type.h"
#include "gfx_type.h"
#include "sound_type.h"
#include "station_type.h"
#include "strings_type.h"
#include "timer/timer_game_calendar.h"
#include "timer/timer_game_economy.h"
#include "town_type.h"
#include "vehicle_type.h"

Go to the source code of this file.

Data Structures

struct  NewsTypeData
 Per-NewsType data. More...
 
struct  NewsAllocatedData
 Container for any custom data that must be deleted after the news item has reached end-of-life. More...
 
struct  NewsItem
 Information about a single item of news. More...
 
struct  CompanyNewsInformation
 Data that needs to be stored for company news messages. More...
 

Typedefs

using NewsReference = std::variant< std::monostate, TileIndex, VehicleID, StationID, IndustryID, TownID, EngineID >
 References to objects in news.
 
using NewsFlags = EnumBitSet< NewsFlag, uint8_t >
 
using NewsContainer = std::list< NewsItem >
 Container type for storing news items.
 
using NewsIterator = NewsContainer::const_iterator
 Iterator type for news items.
 

Enumerations

enum class  NewsType : uint8_t {
  ArrivalCompany , ArrivalOther , Accident , AccidentOther ,
  CompanyInfo , IndustryOpen , IndustryClose , Economy ,
  IndustryCompany , IndustryOther , IndustryNobody , Advice ,
  NewVehicles , Acceptance , Subsidies , General ,
  End
}
 Type of news. More...
 
enum class  AdviceType : uint8_t {
  AircraftDestinationTooFar , AutorenewFailed , Order , RefitFailed ,
  TrainStuck , VehicleLost , VehicleOld , VehicleUnprofitable ,
  VehicleWaiting , Invalid
}
 Sub type of the NewsType::Advice to be able to remove specific news items. More...
 
enum class  NewsStyle : uint8_t {
  Thin , Small , Normal , Vehicle ,
  Company
}
 News Window Styles. More...
 
enum class  NewsFlag : uint8_t { InColour , NoTransparency , Shaded , VehicleParam0 }
 Various OR-able news-item flags. More...
 
enum class  NewsDisplay : uint8_t { Off , Summary , Full }
 News display options. More...
 

Detailed Description

Types related to news.

Definition in file news_type.h.

Typedef Documentation

◆ NewsContainer

using NewsContainer = std::list<NewsItem>

Container type for storing news items.

Definition at line 173 of file news_type.h.

◆ NewsFlags

using NewsFlags = EnumBitSet<NewsFlag, uint8_t>

Definition at line 94 of file news_type.h.

◆ NewsIterator

using NewsIterator = NewsContainer::const_iterator

Iterator type for news items.

Definition at line 174 of file news_type.h.

◆ NewsReference

using NewsReference = std::variant<std::monostate, TileIndex, VehicleID, StationID, IndustryID, TownID, EngineID>

References to objects in news.

Warning
Be careful! Vehicles are a special case, as news are kept when vehicles are autoreplaced/renewed. You have to make sure, ChangeVehicleNews catches the DParams of your message. This is NOT ensured by the references.

Definition at line 73 of file news_type.h.

Enumeration Type Documentation

◆ AdviceType

enum class AdviceType : uint8_t
strong

Sub type of the NewsType::Advice to be able to remove specific news items.

Enumerator
AircraftDestinationTooFar 

Next (order) destination is too far for the aircraft type.

AutorenewFailed 

Autorenew or autoreplace failed.

Order 

Something wrong with the order, e.g. invalid or duplicate entries, too few entries.

RefitFailed 

The refit order failed to execute.

TrainStuck 

The train got stuck and needs to be unstuck manually.

VehicleLost 

The vehicle has become lost.

VehicleOld 

The vehicle is starting to get old.

VehicleUnprofitable 

The vehicle is costing you money.

VehicleWaiting 

The vehicle is waiting in the depot.

Definition at line 50 of file news_type.h.

◆ NewsDisplay

enum class NewsDisplay : uint8_t
strong

News display options.

Enumerator
Off 

Only show a reminder in the status bar.

Summary 

Show ticker.

Full 

Show newspaper.

Definition at line 99 of file news_type.h.

◆ NewsFlag

enum class NewsFlag : uint8_t
strong

Various OR-able news-item flags.

Note
NewsFlag::InColour is set automatically if needed.
Enumerator
InColour 

News item is shown in colour (otherwise it is shown in black & white).

NoTransparency 

News item disables transparency in the viewport.

Shaded 

News item uses shaded colours.

VehicleParam0 

String param 0 contains a vehicle ID. (special autoreplace behaviour)

Definition at line 88 of file news_type.h.

◆ NewsStyle

enum class NewsStyle : uint8_t
strong

News Window Styles.

Enumerator
Thin 

Thin news item. (Newspaper with headline and viewport)

Small 

Small news item. (Information window with text and viewport)

Normal 

Normal news item. (Newspaper with text only)

Vehicle 

Vehicle news item. (new engine available)

Company 

Company news item. (Newspaper with face)

Definition at line 76 of file news_type.h.

◆ NewsType

enum class NewsType : uint8_t
strong

Type of news.

Enumerator
ArrivalCompany 

First vehicle arrived for company.

ArrivalOther 

First vehicle arrived for competitor.

Accident 

An accident or disaster has occurred.

AccidentOther 

An accident or disaster has occurred.

CompanyInfo 

Company info (new companies, bankruptcy messages)

IndustryOpen 

Opening of industries.

IndustryClose 

Closing of industries.

Economy 

Economic changes (recession, industry up/dowm)

IndustryCompany 

Production changes of industry serviced by local company.

IndustryOther 

Production changes of industry serviced by competitor(s)

IndustryNobody 

Other industry production changes.

Advice 

Bits of news about vehicles of the company.

NewVehicles 

New vehicle has become available.

Acceptance 

A type of cargo is (no longer) accepted.

Subsidies 

News about subsidies (announcements, expirations, acceptance)

General 

General news (from towns)

End 

end-of-array marker

Definition at line 28 of file news_type.h.