~ubuntu-branches/debian/squeeze/openttd/squeeze

« back to all changes in this revision

Viewing changes to src/news_type.h

  • Committer: Bazaar Package Importer
  • Author(s): Jordi Mallach, Matthijs Kooijman, Jordi Mallach
  • Date: 2009-04-15 18:22:10 UTC
  • mfrom: (1.1.6 upstream) (2.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090415182210-22ktb8kdbp2tf3bm
[ Matthijs Kooijman ]
* New upstream release.
* Remove Debian specific desktop file, upstream provides one now. 
* Add debian/watch file.

[ Jordi Mallach ]
* Bump Standards-Version to 3.8.1, with no changes required.
* Move to debhelper compat 7. Bump Build-Depends accordingly.
* Use dh_prep.
* Add "set -e" to config script.
* Remove a few extra doc files that get installed by upstream Makefile.
* Add more complete copyright information.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: news_type.h 15726 2009-03-15 16:04:39Z smatz $ */
 
2
 
 
3
/** @file news_type.h Types related to news. */
 
4
 
 
5
#ifndef NEWS_TYPE_H
 
6
#define NEWS_TYPE_H
 
7
 
 
8
#include "date_type.h"
 
9
#include "strings_type.h"
 
10
#include "sound_type.h"
 
11
 
 
12
/**
 
13
 * Type of news.
 
14
 */
 
15
enum NewsType {
 
16
        NT_ARRIVAL_COMPANY, ///< Cargo arrived for company
 
17
        NT_ARRIVAL_OTHER,   ///< Cargo arrived for competitor
 
18
        NT_ACCIDENT,        ///< An accident or disaster has occurred
 
19
        NT_COMPANY_INFO,    ///< Company info (new companies, bankrupcy messages)
 
20
        NT_INDUSTRY_OPEN,   ///< Opening of industries
 
21
        NT_INDUSTRY_CLOSE,  ///< Closing of industries
 
22
        NT_ECONOMY,         ///< Economic changes (recession, industry up/dowm)
 
23
        NT_INDUSTRY_COMPANY,///< Production changes of industry serviced by local company
 
24
        NT_INDUSTRY_OTHER,  ///< Production changes of industry serviced by competitor(s)
 
25
        NT_INDUSTRY_NOBODY, ///< Other industry production changes
 
26
        NT_ADVICE,          ///< Bits of news about vehicles of the company
 
27
        NT_NEW_VEHICLES,    ///< New vehicle has become available
 
28
        NT_ACCEPTANCE,      ///< A type of cargo is (no longer) accepted
 
29
        NT_SUBSIDIES,       ///< News about subsidies (announcements, expirations, acceptance)
 
30
        NT_GENERAL,         ///< General news (from towns)
 
31
        NT_END,             ///< end-of-array marker
 
32
};
 
33
 
 
34
/**
 
35
 * News subtypes.
 
36
 */
 
37
enum NewsSubtype {
 
38
        NS_ARRIVAL_COMPANY,  ///< NT_ARRIVAL_COMPANY
 
39
        NS_ARRIVAL_OTHER,    ///< NT_ARRIVAL_OTHER
 
40
        NS_ACCIDENT_TILE,    ///< NT_ACCIDENT (tile)
 
41
        NS_ACCIDENT_VEHICLE, ///< NT_ACCIDENT (vehicle)
 
42
        NS_COMPANY_TROUBLE,  ///< NT_COMPANY_INFO (trouble)
 
43
        NS_COMPANY_MERGER,   ///< NT_COMPANY_INFO (merger)
 
44
        NS_COMPANY_BANKRUPT, ///< NT_COMPANY_INFO (bankrupt)
 
45
        NS_COMPANY_NEW,      ///< NT_COMPANY_INFO (new company)
 
46
        NS_INDUSTRY_OPEN,    ///< NT_INDUSTRY_OPEN
 
47
        NS_INDUSTRY_CLOSE,   ///< NT_INDUSTRY_CLOSE
 
48
        NS_ECONOMY,          ///< NT_ECONOMY
 
49
        NS_INDUSTRY_COMPANY, ///< NT_INDUSTRY_COMPANY
 
50
        NS_INDUSTRY_OTHER,   ///< NT_INDUSTRY_OTHER
 
51
        NS_INDUSTRY_NOBODY,  ///< NT_INDUSTRY_NOBODY
 
52
        NS_ADVICE,           ///< NT_ADVICE
 
53
        NS_NEW_VEHICLES,     ///< NT_NEW_VEHICLES
 
54
        NS_ACCEPTANCE,       ///< NT_ACCEPTANCE
 
55
        NS_SUBSIDIES,        ///< NT_SUBSIDIES
 
56
        NS_GENERAL,          ///< NT_GENERAL
 
57
        NS_END,              ///< end-of-array marker
 
58
};
 
59
 
 
60
/**
 
61
 * News mode.
 
62
 */
 
63
enum NewsMode {
 
64
        NM_SMALL    = 0, ///< Show only a small popup informing us about vehicle age for example
 
65
        NM_NORMAL   = 1, ///< Show a simple news message (height 170 pixels)
 
66
        NM_THIN     = 2, ///< Show a simple news message (height 130 pixels)
 
67
};
 
68
 
 
69
/**
 
70
 * Various OR-able news-item flags.
 
71
 * note: NF_INCOLOUR is set automatically if needed
 
72
 */
 
73
enum NewsFlag {
 
74
        NF_NONE      = 0,        ///< No flag is set.
 
75
        NF_VIEWPORT  = (1 << 1), ///< Does the news message have a viewport? (ingame picture of happening)
 
76
        NF_TILE      = (1 << 2), ///< When clicked on the news message scroll to a given tile? Tile is in data_a
 
77
        NF_VEHICLE   = (1 << 3), ///< When clicked on the message scroll to the vehicle? VehicleID is in data_a
 
78
        NF_INCOLOUR  = (1 << 5), ///< Show the newsmessage in colour, otherwise it defaults to black & white
 
79
        NF_TILE2     = (1 << 6), ///< There is a second tile to scroll to; tile is in data_b
 
80
};
 
81
DECLARE_ENUM_AS_BIT_SET(NewsFlag);
 
82
 
 
83
 
 
84
/**
 
85
 * News display options
 
86
 */
 
87
enum NewsDisplay {
 
88
        ND_OFF,        ///< Only show a reminder in the status bar
 
89
        ND_SUMMARY,    ///< Show ticker
 
90
        ND_FULL,       ///< Show newspaper
 
91
};
 
92
 
 
93
/**
 
94
 * Per-NewsType data
 
95
 */
 
96
struct NewsTypeData {
 
97
        const char * const name; ///< Name
 
98
        const byte age;         ///< Maximum age of news items (in days)
 
99
        const SoundFx sound;    ///< Sound
 
100
        NewsDisplay display;    ///< Display mode (off, summary, full)
 
101
};
 
102
 
 
103
struct NewsItem {
 
104
        NewsItem *prev;        ///< Previous news item
 
105
        NewsItem *next;        ///< Next news item
 
106
        StringID string_id;    ///< Message text
 
107
        Date date;             ///< Date of the news
 
108
        NewsSubtype subtype;   ///< News subtype @see NewsSubtype
 
109
        NewsFlag flags;        ///< NewsFlags bits @see NewsFlag
 
110
 
 
111
        uint data_a;           ///< Custom data 1 (usually tile or vehicle)
 
112
        uint data_b;           ///< Custom data 2
 
113
 
 
114
        void *free_data;       ///< Data to be freed when the news item has reached it's end.
 
115
 
 
116
        uint64 params[10];
 
117
};
 
118
 
 
119
/**
 
120
 * Data that needs to be stored for company news messages.
 
121
 * The problem with company news messages are the custom name
 
122
 * of the companies and the fact that the company data is reset,
 
123
 * resulting in wrong names and such.
 
124
 */
 
125
struct CompanyNewsInformation {
 
126
        char company_name[64];       ///< The name of the company
 
127
        char president_name[64];     ///< The name of the president
 
128
        char other_company_name[64]; ///< The name of the company taking over this one
 
129
 
 
130
        uint32 face; ///< The face of the president
 
131
        byte colour; ///< The colour related to the company
 
132
 
 
133
        void FillData(const struct Company *c, const struct Company *other = NULL);
 
134
};
 
135
 
 
136
#endif /* NEWS_TYPE_H */