GSNews Class Reference

Class that handles news messages. More...


Public Types

enum  NewsType {
  NT_ACCIDENT,
  NT_COMPANY_INFO,
  NT_ECONOMY,
  NT_ADVICE,
  NT_ACCEPTANCE,
  NT_SUBSIDIES,
  NT_GENERAL
}
 Enumeration for the news types that a script can create news for. More...
enum  NewsReferenceType {
  NR_NONE,
  NR_TILE,
  NR_STATION,
  NR_INDUSTRY,
  NR_TOWN
}
 Reference to a game element. More...

Static Public Member Functions

static bool Create (NewsType type, Text *text, GSCompany::CompanyID company, NewsReferenceType ref_type, uint32 reference)
 Create a news message for everybody, or for one company.


Detailed Description

Class that handles news messages.

Member Enumeration Documentation

Enumeration for the news types that a script can create news for.

Enumerator:
NT_ACCIDENT  Category accidents.
NT_COMPANY_INFO  Category company info.
NT_ECONOMY  Category economy.
NT_ADVICE  Category vehicle advice.
NT_ACCEPTANCE  Category acceptance changes.
NT_SUBSIDIES  Category subsidies.
NT_GENERAL  Category general.

Reference to a game element.

Enumerator:
NR_NONE  No reference supplied.
NR_TILE  Reference location, scroll to the location when clicking on the news.
NR_STATION  Reference station, scroll to the station when clicking on the news. Delete news when the station is deleted.
NR_INDUSTRY  Reference industry, scrolls to the industry when clicking on the news. Delete news when the industry is deleted.
NR_TOWN  Reference town, scroll to the town when clicking on the news.


Member Function Documentation

static bool GSNews::Create ( NewsType  type,
Text *  text,
GSCompany::CompanyID  company,
NewsReferenceType  ref_type,
uint32  reference 
) [static]

Create a news message for everybody, or for one company.

Parameters:
type The type of the news.
text The text message to show (can be either a raw string, or a GSText object).
company The company, or COMPANY_INVALID for all companies.
ref_type Type of referred game element.
reference The referenced game element of ref_type.
Returns:
True if the action succeeded.
Precondition:
type must be NT_ECONOMY, NT_SUBSIDIES, or NT_GENERAL.

text != NULL.

company == COMPANY_INVALID || ResolveCompanyID(company) != COMPANY_INVALID.

The reference condition must be fulfilled.


Generated on Sat Apr 1 17:11:59 2017 for OpenTTD Game API by  doxygen 1.5.6