summaryrefslogtreecommitdiff
path: root/src/news_type.h
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-05-24 16:52:42 +0000
committerfrosch <frosch@openttd.org>2009-05-24 16:52:42 +0000
commita4557c7da4329188e3561d9404891c0346f8f70e (patch)
tree96e7ba45ee42e5b0d0c8ca2867b081a56ebef645 /src/news_type.h
parentb7d065ce99886e2cf86883469a077f653428e5b8 (diff)
downloadopenttd-a4557c7da4329188e3561d9404891c0346f8f70e.tar.xz
(svn r16416) -Fix [FS#2912]: Rework deleting of news when referenced vehicles/stations/industries are deleted.
Diffstat (limited to 'src/news_type.h')
-rw-r--r--src/news_type.h49
1 files changed, 30 insertions, 19 deletions
diff --git a/src/news_type.h b/src/news_type.h
index 4efcacb05..12e6a5ff6 100644
--- a/src/news_type.h
+++ b/src/news_type.h
@@ -38,8 +38,7 @@ enum NewsType {
enum NewsSubtype {
NS_ARRIVAL_COMPANY, ///< NT_ARRIVAL_COMPANY
NS_ARRIVAL_OTHER, ///< NT_ARRIVAL_OTHER
- NS_ACCIDENT_TILE, ///< NT_ACCIDENT (tile)
- NS_ACCIDENT_VEHICLE, ///< NT_ACCIDENT (vehicle)
+ NS_ACCIDENT, ///< NT_ACCIDENT
NS_COMPANY_TROUBLE, ///< NT_COMPANY_INFO (trouble)
NS_COMPANY_MERGER, ///< NT_COMPANY_INFO (merger)
NS_COMPANY_BANKRUPT, ///< NT_COMPANY_INFO (bankrupt)
@@ -68,16 +67,26 @@ enum NewsMode {
};
/**
+ * References to objects in news.
+ */
+enum NewsReferenceType {
+ NR_NONE, ///< Empty reference
+ NR_TILE, ///< Reference tile. Scroll to tile when clicking on the news.
+ NR_VEHICLE, ///< Reference vehicle. Scroll to vehicle when clicking on the news. Delete news when vehicle is deleted.
+ NR_STATION, ///< Reference station. Scroll to station when clicking on the news. Delete news when station is deleted.
+ NR_INDUSTRY, ///< Reference industry. Scroll to industry when clicking on the news. Delete news when industry is deleted.
+ NR_TOWN, ///< Reference town. Scroll to town when clicking on the news.
+ NR_ENGINE ///< Reference engine.
+};
+
+/**
* Various OR-able news-item flags.
* note: NF_INCOLOUR is set automatically if needed
*/
enum NewsFlag {
- NF_NONE = 0, ///< No flag is set.
- NF_VIEWPORT = (1 << 1), ///< Does the news message have a viewport? (ingame picture of happening)
- NF_TILE = (1 << 2), ///< When clicked on the news message scroll to a given tile? Tile is in data_a
- NF_VEHICLE = (1 << 3), ///< When clicked on the message scroll to the vehicle? VehicleID is in data_a
- NF_INCOLOUR = (1 << 5), ///< Show the newsmessage in colour, otherwise it defaults to black & white
- NF_TILE2 = (1 << 6), ///< There is a second tile to scroll to; tile is in data_b
+ NF_NONE = 0, ///< No flag is set.
+ NF_VIEWPORT = 1 << 1, ///< Does the news message have a viewport? (ingame picture of happening)
+ NF_INCOLOUR = 1 << 2, ///< Show the newsmessage in colour, otherwise it defaults to black & white
};
DECLARE_ENUM_AS_BIT_SET(NewsFlag);
@@ -112,17 +121,19 @@ struct NewsTypeData {
};
struct NewsItem {
- NewsItem *prev; ///< Previous news item
- NewsItem *next; ///< Next news item
- StringID string_id; ///< Message text
- Date date; ///< Date of the news
- NewsSubtype subtype; ///< News subtype @see NewsSubtype
- NewsFlag flags; ///< NewsFlags bits @see NewsFlag
-
- uint data_a; ///< Custom data 1 (usually tile or vehicle)
- uint data_b; ///< Custom data 2
-
- void *free_data; ///< Data to be freed when the news item has reached its end.
+ NewsItem *prev; ///< Previous news item
+ NewsItem *next; ///< Next news item
+ StringID string_id; ///< Message text
+ Date date; ///< Date of the news
+ NewsSubtype subtype; ///< News subtype @see NewsSubtype
+ NewsFlag flags; ///< NewsFlags bits @see NewsFlag
+
+ NewsReferenceType reftype1; ///< Type of ref1
+ NewsReferenceType reftype2; ///< Type of ref2
+ uint32 ref1; ///< Reference 1 to some object: Used for a possible viewport, scrolling after clicking on the news, and for deleteing the news when the object is deleted.
+ uint32 ref2; ///< Reference 2 to some object: Used for scrolling after clicking on the news, and for deleteing the news when the object is deleted.
+
+ void *free_data; ///< Data to be freed when the news item has reached its end.
uint64 params[10];
};