richk@10184: /* $Id$ */ richk@10184: richk@10184: /** @file news_type.h Types related to news. */ richk@10184: richk@10184: #ifndef NEWS_TYPE_H richk@10184: #define NEWS_TYPE_H richk@10184: richk@10184: #include "window_type.h" richk@10184: #include "date_type.h" richk@10184: #include "strings_type.h" richk@10184: richk@10184: /** richk@10184: * Type of news. richk@10184: */ richk@10184: enum NewsType { richk@10184: NT_ARRIVAL_PLAYER, ///< Cargo arrived for player richk@10184: NT_ARRIVAL_OTHER, ///< Cargo arrived for competitor richk@10184: NT_ACCIDENT, ///< An accident or disaster has occurred richk@10184: NT_COMPANY_INFO, ///< Company info (new companies, bankrupcy messages) richk@10184: NT_OPENCLOSE, ///< Opening and closing of industries richk@10184: NT_ECONOMY, ///< Economic changes (recession, industry up/dowm) richk@10184: NT_INDUSTRY_PLAYER, ///< Production changes of industry serviced by local player richk@10184: NT_INDUSTRY_OTHER, ///< Production changes of industry serviced by competitor(s) richk@10184: NT_INDUSTRY_NOBODY, ///< Other industry production changes richk@10184: NT_ADVICE, ///< Bits of news about vehicles of the player richk@10184: NT_NEW_VEHICLES, ///< New vehicle has become available richk@10184: NT_ACCEPTANCE, ///< A type of cargo is (no longer) accepted richk@10184: NT_SUBSIDIES, ///< News about subsidies (announcements, expirations, acceptance) richk@10184: NT_GENERAL, ///< General news (from towns) richk@10184: NT_END, ///< end-of-array marker richk@10184: }; richk@10184: richk@10184: /** richk@10184: * News mode. richk@10184: */ richk@10184: enum NewsMode { richk@10184: NM_SMALL = 0, ///< Show only a small popup informing us about vehicle age for example richk@10184: NM_NORMAL = 1, ///< Show a simple news message (height 170 pixels) richk@10184: NM_THIN = 2, ///< Show a simple news message (height 130 pixels) richk@10184: NM_CALLBACK = 3, ///< Do some special processing before displaying news message. Which callback to call is in NewsCallback richk@10184: }; richk@10184: richk@10184: /** richk@10184: * Various OR-able news-item flags. richk@10184: * note: NF_INCOLOR is set automatically if needed richk@10184: */ richk@10184: enum NewsFlag { richk@10184: NF_NONE = 0, ///< No flag is set. richk@10184: NF_VIEWPORT = (1 << 1), ///< Does the news message have a viewport? (ingame picture of happening) richk@10184: NF_TILE = (1 << 2), ///< When clicked on the news message scroll to a given tile? Tile is in data_a/data_b richk@10184: NF_VEHICLE = (1 << 3), ///< When clicked on the message scroll to the vehicle? VehicleID is in data_a richk@10184: NF_FORCE_BIG = (1 << 4), ///< Force the appearance of a news message if it has already been shown (internal) richk@10184: NF_INCOLOR = (1 << 5), ///< Show the newsmessage in colour, otherwise it defaults to black & white richk@10184: }; richk@10184: DECLARE_ENUM_AS_BIT_SET(NewsFlag); richk@10184: richk@10184: richk@10184: /** richk@10184: * Special news items richk@10184: */ richk@10184: enum NewsCallback { richk@10184: DNC_VEHICLEAVAIL = 0, ///< Show new vehicle available message. StringID is EngineID richk@10184: DNC_BANKRUPCY = 1, ///< Show bankrupcy message. StringID is PlayerID (0-3) and NewsBankrupcy (4-7) richk@10184: DNC_NONE = 0xFF, ///< No news callback. richk@10184: }; richk@10184: richk@10184: /** richk@10184: * Kinds of bankrupcy richk@10184: */ richk@10184: enum NewsBankrupcy { richk@10184: NB_BTROUBLE, ///< Company is in trouble (warning) richk@10184: NB_BMERGER, ///< Company has been bought by another company richk@10184: NB_BBANKRUPT, ///< Company has gone bankrupt richk@10184: NB_BNEWCOMPANY, ///< A new company has been started richk@10184: }; richk@10184: richk@10184: struct NewsItem { richk@10184: StringID string_id; ///< Message text (sometimes also used for storing other info) richk@10184: uint16 duration; ///< Remaining time for showing this news message richk@10184: Date date; ///< Date of the news richk@10184: NewsFlag flags; ///< NewsFlags bits @see NewsFlag richk@10184: NewsMode display_mode; ///< Display mode value @see NewsMode richk@10184: NewsType type; ///< News category @see NewsType richk@10184: NewsCallback callback; ///< Call-back function richk@10184: richk@10184: uint data_a; ///< Reference to tile or vehicle richk@10184: uint data_b; ///< Reference to second tile or vehicle richk@10184: richk@10184: uint64 params[10]; richk@10184: }; richk@10184: richk@10184: typedef bool ValidationProc(uint data_a, uint data_b); richk@10184: typedef void DrawNewsCallbackProc(Window *w, const NewsItem *ni); richk@10184: typedef StringID GetNewsStringCallbackProc(const NewsItem *ni); richk@10184: richk@10184: #endif /* NEWS_TYPE_H */