2008-03-28 08:53:36 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
/** @file news_type.h Types related to news. */
|
|
|
|
|
|
|
|
#ifndef NEWS_TYPE_H
|
|
|
|
#define NEWS_TYPE_H
|
|
|
|
|
2009-05-17 17:17:48 +00:00
|
|
|
#include "core/enum_type.hpp"
|
2008-03-28 08:53:36 +00:00
|
|
|
#include "date_type.h"
|
|
|
|
#include "strings_type.h"
|
2008-04-19 12:50:02 +00:00
|
|
|
#include "sound_type.h"
|
2008-03-28 08:53:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Type of news.
|
|
|
|
*/
|
|
|
|
enum NewsType {
|
2008-09-30 20:39:50 +00:00
|
|
|
NT_ARRIVAL_COMPANY, ///< Cargo arrived for company
|
2008-03-28 08:53:36 +00:00
|
|
|
NT_ARRIVAL_OTHER, ///< Cargo arrived for competitor
|
|
|
|
NT_ACCIDENT, ///< An accident or disaster has occurred
|
|
|
|
NT_COMPANY_INFO, ///< Company info (new companies, bankrupcy messages)
|
2008-07-30 01:53:03 +00:00
|
|
|
NT_INDUSTRY_OPEN, ///< Opening of industries
|
|
|
|
NT_INDUSTRY_CLOSE, ///< Closing of industries
|
2008-03-28 08:53:36 +00:00
|
|
|
NT_ECONOMY, ///< Economic changes (recession, industry up/dowm)
|
2008-09-30 20:39:50 +00:00
|
|
|
NT_INDUSTRY_COMPANY,///< Production changes of industry serviced by local company
|
2008-03-28 08:53:36 +00:00
|
|
|
NT_INDUSTRY_OTHER, ///< Production changes of industry serviced by competitor(s)
|
|
|
|
NT_INDUSTRY_NOBODY, ///< Other industry production changes
|
2008-09-30 20:39:50 +00:00
|
|
|
NT_ADVICE, ///< Bits of news about vehicles of the company
|
2008-03-28 08:53:36 +00:00
|
|
|
NT_NEW_VEHICLES, ///< New vehicle has become available
|
|
|
|
NT_ACCEPTANCE, ///< A type of cargo is (no longer) accepted
|
|
|
|
NT_SUBSIDIES, ///< News about subsidies (announcements, expirations, acceptance)
|
|
|
|
NT_GENERAL, ///< General news (from towns)
|
|
|
|
NT_END, ///< end-of-array marker
|
|
|
|
};
|
|
|
|
|
2008-05-15 13:39:36 +00:00
|
|
|
/**
|
|
|
|
* News subtypes.
|
|
|
|
*/
|
|
|
|
enum NewsSubtype {
|
2008-09-30 20:39:50 +00:00
|
|
|
NS_ARRIVAL_COMPANY, ///< NT_ARRIVAL_COMPANY
|
2008-05-15 13:39:36 +00:00
|
|
|
NS_ARRIVAL_OTHER, ///< NT_ARRIVAL_OTHER
|
|
|
|
NS_ACCIDENT_TILE, ///< NT_ACCIDENT (tile)
|
|
|
|
NS_ACCIDENT_VEHICLE, ///< NT_ACCIDENT (vehicle)
|
|
|
|
NS_COMPANY_TROUBLE, ///< NT_COMPANY_INFO (trouble)
|
|
|
|
NS_COMPANY_MERGER, ///< NT_COMPANY_INFO (merger)
|
|
|
|
NS_COMPANY_BANKRUPT, ///< NT_COMPANY_INFO (bankrupt)
|
|
|
|
NS_COMPANY_NEW, ///< NT_COMPANY_INFO (new company)
|
2008-08-13 01:48:58 +00:00
|
|
|
NS_INDUSTRY_OPEN, ///< NT_INDUSTRY_OPEN
|
|
|
|
NS_INDUSTRY_CLOSE, ///< NT_INDUSTRY_CLOSE
|
2008-05-15 13:39:36 +00:00
|
|
|
NS_ECONOMY, ///< NT_ECONOMY
|
2008-09-30 20:39:50 +00:00
|
|
|
NS_INDUSTRY_COMPANY, ///< NT_INDUSTRY_COMPANY
|
2008-05-15 13:39:36 +00:00
|
|
|
NS_INDUSTRY_OTHER, ///< NT_INDUSTRY_OTHER
|
|
|
|
NS_INDUSTRY_NOBODY, ///< NT_INDUSTRY_NOBODY
|
|
|
|
NS_ADVICE, ///< NT_ADVICE
|
|
|
|
NS_NEW_VEHICLES, ///< NT_NEW_VEHICLES
|
|
|
|
NS_ACCEPTANCE, ///< NT_ACCEPTANCE
|
|
|
|
NS_SUBSIDIES, ///< NT_SUBSIDIES
|
|
|
|
NS_GENERAL, ///< NT_GENERAL
|
|
|
|
NS_END, ///< end-of-array marker
|
|
|
|
};
|
|
|
|
|
2008-03-28 08:53:36 +00:00
|
|
|
/**
|
|
|
|
* News mode.
|
|
|
|
*/
|
|
|
|
enum NewsMode {
|
|
|
|
NM_SMALL = 0, ///< Show only a small popup informing us about vehicle age for example
|
|
|
|
NM_NORMAL = 1, ///< Show a simple news message (height 170 pixels)
|
|
|
|
NM_THIN = 2, ///< Show a simple news message (height 130 pixels)
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Various OR-able news-item flags.
|
2009-02-09 02:57:15 +00:00
|
|
|
* note: NF_INCOLOUR is set automatically if needed
|
2008-03-28 08:53:36 +00:00
|
|
|
*/
|
|
|
|
enum NewsFlag {
|
|
|
|
NF_NONE = 0, ///< No flag is set.
|
|
|
|
NF_VIEWPORT = (1 << 1), ///< Does the news message have a viewport? (ingame picture of happening)
|
2008-05-08 22:53:49 +00:00
|
|
|
NF_TILE = (1 << 2), ///< When clicked on the news message scroll to a given tile? Tile is in data_a
|
2008-03-28 08:53:36 +00:00
|
|
|
NF_VEHICLE = (1 << 3), ///< When clicked on the message scroll to the vehicle? VehicleID is in data_a
|
2009-02-09 02:57:15 +00:00
|
|
|
NF_INCOLOUR = (1 << 5), ///< Show the newsmessage in colour, otherwise it defaults to black & white
|
2008-05-08 22:53:49 +00:00
|
|
|
NF_TILE2 = (1 << 6), ///< There is a second tile to scroll to; tile is in data_b
|
2008-03-28 08:53:36 +00:00
|
|
|
};
|
|
|
|
DECLARE_ENUM_AS_BIT_SET(NewsFlag);
|
|
|
|
|
|
|
|
|
2008-04-20 11:40:33 +00:00
|
|
|
/**
|
|
|
|
* News display options
|
|
|
|
*/
|
|
|
|
enum NewsDisplay {
|
|
|
|
ND_OFF, ///< Only show a reminder in the status bar
|
|
|
|
ND_SUMMARY, ///< Show ticker
|
|
|
|
ND_FULL, ///< Show newspaper
|
|
|
|
};
|
|
|
|
|
2008-04-19 12:50:02 +00:00
|
|
|
/**
|
|
|
|
* Per-NewsType data
|
|
|
|
*/
|
|
|
|
struct NewsTypeData {
|
2009-05-13 17:39:00 +00:00
|
|
|
const char * const name; ///< Name
|
|
|
|
const byte age; ///< Maximum age of news items (in days)
|
|
|
|
const SoundFx sound; ///< Sound
|
|
|
|
NewsDisplay display; ///< Display mode (off, summary, full)
|
|
|
|
const StringID description; ///< Description of the news type in news settings window
|
|
|
|
|
|
|
|
NewsTypeData(const char *name, byte age, SoundFx sound, StringID description) :
|
|
|
|
name(name),
|
|
|
|
age(age),
|
|
|
|
sound(sound),
|
|
|
|
display(ND_FULL),
|
|
|
|
description(description)
|
|
|
|
{
|
|
|
|
}
|
2008-04-19 12:50:02 +00:00
|
|
|
};
|
|
|
|
|
2008-03-28 08:53:36 +00:00
|
|
|
struct NewsItem {
|
2008-05-28 21:36:16 +00:00
|
|
|
NewsItem *prev; ///< Previous news item
|
|
|
|
NewsItem *next; ///< Next news item
|
2008-05-13 10:17:04 +00:00
|
|
|
StringID string_id; ///< Message text
|
2008-03-28 08:53:36 +00:00
|
|
|
Date date; ///< Date of the news
|
2008-05-15 13:39:36 +00:00
|
|
|
NewsSubtype subtype; ///< News subtype @see NewsSubtype
|
2008-03-28 08:53:36 +00:00
|
|
|
NewsFlag flags; ///< NewsFlags bits @see NewsFlag
|
|
|
|
|
2008-05-13 10:17:04 +00:00
|
|
|
uint data_a; ///< Custom data 1 (usually tile or vehicle)
|
|
|
|
uint data_b; ///< Custom data 2
|
2008-03-28 08:53:36 +00:00
|
|
|
|
2009-05-02 13:05:00 +00:00
|
|
|
void *free_data; ///< Data to be freed when the news item has reached its end.
|
2008-07-18 16:26:51 +00:00
|
|
|
|
2008-03-28 08:53:36 +00:00
|
|
|
uint64 params[10];
|
|
|
|
};
|
|
|
|
|
2008-07-18 16:26:51 +00:00
|
|
|
/**
|
|
|
|
* Data that needs to be stored for company news messages.
|
|
|
|
* The problem with company news messages are the custom name
|
|
|
|
* of the companies and the fact that the company data is reset,
|
|
|
|
* resulting in wrong names and such.
|
|
|
|
*/
|
|
|
|
struct CompanyNewsInformation {
|
|
|
|
char company_name[64]; ///< The name of the company
|
|
|
|
char president_name[64]; ///< The name of the president
|
|
|
|
char other_company_name[64]; ///< The name of the company taking over this one
|
|
|
|
|
|
|
|
uint32 face; ///< The face of the president
|
|
|
|
byte colour; ///< The colour related to the company
|
|
|
|
|
2008-09-30 20:39:50 +00:00
|
|
|
void FillData(const struct Company *c, const struct Company *other = NULL);
|
2008-07-18 16:26:51 +00:00
|
|
|
};
|
|
|
|
|
2008-03-28 08:53:36 +00:00
|
|
|
#endif /* NEWS_TYPE_H */
|