tron@2186: /* $Id$ */ tron@2186: rubidium@8763: /** @file news_type.h Types related to news. */ belugas@6348: rubidium@8763: #ifndef NEWS_TYPE_H rubidium@8763: #define NEWS_TYPE_H truelight@0: rubidium@8140: #include "date_type.h" rubidium@8264: #include "strings_type.h" rubidium@8990: #include "sound_type.h" rubidium@8106: rubidium@7598: /** rubidium@8763: * Type of news. rubidium@7598: */ Darkvater@4873: enum NewsType { rubidium@7598: NT_ARRIVAL_PLAYER, ///< Cargo arrived for player rubidium@7598: NT_ARRIVAL_OTHER, ///< Cargo arrived for competitor rubidium@7598: NT_ACCIDENT, ///< An accident or disaster has occurred rubidium@7598: NT_COMPANY_INFO, ///< Company info (new companies, bankrupcy messages) belugas@9739: NT_INDUSTRY_OPEN, ///< Opening of industries belugas@9739: NT_INDUSTRY_CLOSE, ///< Closing of industries rubidium@7598: NT_ECONOMY, ///< Economic changes (recession, industry up/dowm) rubidium@7891: NT_INDUSTRY_PLAYER, ///< Production changes of industry serviced by local player rubidium@7891: NT_INDUSTRY_OTHER, ///< Production changes of industry serviced by competitor(s) rubidium@7891: NT_INDUSTRY_NOBODY, ///< Other industry production changes rubidium@7598: NT_ADVICE, ///< Bits of news about vehicles of the player rubidium@7598: NT_NEW_VEHICLES, ///< New vehicle has become available rubidium@7598: NT_ACCEPTANCE, ///< A type of cargo is (no longer) accepted rubidium@7598: NT_SUBSIDIES, ///< News about subsidies (announcements, expirations, acceptance) rubidium@7598: NT_GENERAL, ///< General news (from towns) rubidium@7598: NT_END, ///< end-of-array marker truelight@0: }; truelight@0: rubidium@7598: /** rubidium@9234: * News subtypes. rubidium@9234: */ rubidium@9234: enum NewsSubtype { rubidium@9234: NS_ARRIVAL_PLAYER, ///< NT_ARRIVAL_PLAYER rubidium@9234: NS_ARRIVAL_OTHER, ///< NT_ARRIVAL_OTHER rubidium@9234: NS_ACCIDENT_TILE, ///< NT_ACCIDENT (tile) rubidium@9234: NS_ACCIDENT_VEHICLE, ///< NT_ACCIDENT (vehicle) rubidium@9234: NS_COMPANY_TROUBLE, ///< NT_COMPANY_INFO (trouble) rubidium@9234: NS_COMPANY_MERGER, ///< NT_COMPANY_INFO (merger) rubidium@9234: NS_COMPANY_BANKRUPT, ///< NT_COMPANY_INFO (bankrupt) rubidium@9234: NS_COMPANY_NEW, ///< NT_COMPANY_INFO (new company) belugas@9739: NS_INDUSTRY_OPEN, ///< NS_INDUSTRY_OPEN belugas@9739: NS_INDUSTRY_CLOSE, ///< NS_INDUSTRY_CLOSE rubidium@9234: NS_ECONOMY, ///< NT_ECONOMY rubidium@9234: NS_INDUSTRY_PLAYER, ///< NT_INDUSTRY_PLAYER rubidium@9234: NS_INDUSTRY_OTHER, ///< NT_INDUSTRY_OTHER rubidium@9234: NS_INDUSTRY_NOBODY, ///< NT_INDUSTRY_NOBODY rubidium@9234: NS_ADVICE, ///< NT_ADVICE rubidium@9234: NS_NEW_VEHICLES, ///< NT_NEW_VEHICLES rubidium@9234: NS_ACCEPTANCE, ///< NT_ACCEPTANCE rubidium@9234: NS_SUBSIDIES, ///< NT_SUBSIDIES rubidium@9234: NS_GENERAL, ///< NT_GENERAL rubidium@9234: NS_END, ///< end-of-array marker rubidium@9234: }; rubidium@9234: rubidium@9234: /** rubidium@7598: * News mode. rubidium@7598: */ truelight@0: enum NewsMode { Darkvater@4873: NM_SMALL = 0, ///< Show only a small popup informing us about vehicle age for example Darkvater@4873: NM_NORMAL = 1, ///< Show a simple news message (height 170 pixels) Darkvater@4873: NM_THIN = 2, ///< Show a simple news message (height 130 pixels) truelight@0: }; truelight@0: rubidium@7598: /** rubidium@7598: * Various OR-able news-item flags. rubidium@7598: * note: NF_INCOLOR is set automatically if needed rubidium@7598: */ rubidium@8763: enum NewsFlag { rubidium@8763: NF_NONE = 0, ///< No flag is set. Darkvater@4873: NF_VIEWPORT = (1 << 1), ///< Does the news message have a viewport? (ingame picture of happening) rubidium@9158: NF_TILE = (1 << 2), ///< When clicked on the news message scroll to a given tile? Tile is in data_a Darkvater@4873: NF_VEHICLE = (1 << 3), ///< When clicked on the message scroll to the vehicle? VehicleID is in data_a Darkvater@4874: NF_INCOLOR = (1 << 5), ///< Show the newsmessage in colour, otherwise it defaults to black & white rubidium@9158: NF_TILE2 = (1 << 6), ///< There is a second tile to scroll to; tile is in data_b truelight@0: }; rubidium@8763: DECLARE_ENUM_AS_BIT_SET(NewsFlag); truelight@0: rubidium@8763: rubidium@8763: /** rubidium@9010: * News display options rubidium@9010: */ rubidium@9010: enum NewsDisplay { rubidium@9010: ND_OFF, ///< Only show a reminder in the status bar rubidium@9010: ND_SUMMARY, ///< Show ticker rubidium@9010: ND_FULL, ///< Show newspaper rubidium@9010: }; rubidium@9010: rubidium@9010: /** rubidium@8990: * Per-NewsType data rubidium@8990: */ rubidium@8990: struct NewsTypeData { rubidium@8990: const char *const name; ///< Name rubidium@8990: const byte age; ///< Maximum age of news items (in days) rubidium@8990: const SoundFx sound; ///< Sound rubidium@9010: NewsDisplay display; ///< Display mode (off, summary, full) rubidium@8990: }; rubidium@8990: rubidium@8763: struct NewsItem { rubidium@9406: NewsItem *prev; ///< Previous news item rubidium@9406: NewsItem *next; ///< Next news item rubidium@9199: StringID string_id; ///< Message text rubidium@8763: Date date; ///< Date of the news rubidium@9234: NewsSubtype subtype; ///< News subtype @see NewsSubtype rubidium@8763: NewsFlag flags; ///< NewsFlags bits @see NewsFlag rubidium@8763: rubidium@9199: uint data_a; ///< Custom data 1 (usually tile or vehicle) rubidium@9199: uint data_b; ///< Custom data 2 rubidium@8763: rubidium@9658: void *free_data; ///< Data to be freed when the news item has reached it's end. rubidium@9658: rubidium@8763: uint64 params[10]; rubidium@8763: }; rubidium@8763: rubidium@9658: /** rubidium@9658: * Data that needs to be stored for company news messages. rubidium@9658: * The problem with company news messages are the custom name rubidium@9658: * of the companies and the fact that the company data is reset, rubidium@9658: * resulting in wrong names and such. rubidium@9658: */ rubidium@9658: struct CompanyNewsInformation { rubidium@9658: char company_name[64]; ///< The name of the company rubidium@9658: char president_name[64]; ///< The name of the president rubidium@9658: char other_company_name[64]; ///< The name of the company taking over this one rubidium@9658: rubidium@9658: uint32 face; ///< The face of the president rubidium@9658: byte colour; ///< The colour related to the company rubidium@9658: rubidium@9658: void FillData(const struct Player *p, const struct Player *other = NULL); rubidium@9658: }; rubidium@9658: rubidium@8763: #endif /* NEWS_TYPE_H */