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