OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

town_type.h
Go to the documentation of this file.
1 /* $Id: town_type.h 23233 2011-11-15 20:47:53Z michi_cc $ */
2
3 /*
4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 */
9
12 #ifndef TOWN_TYPE_H
13 #define TOWN_TYPE_H
14
15 #include "core/enum_type.hpp"
16
17 typedef uint16 TownID;
18 struct Town;
19
21 enum TownSize {
22 TSZ_SMALL,
23 TSZ_MEDIUM,
24 TSZ_LARGE,
25 TSZ_RANDOM,
26
27 TSZ_END,
28 };
29 template <> struct EnumPropsT<TownSize> : MakeEnumPropsT<TownSize, byte, TSZ_SMALL, TSZ_END, TSZ_END, 2> {};
30
31 enum Ratings {
32 /* These refer to the maximums, so Appalling is -1000 to -400
33 * MAXIMUM RATINGS BOUNDARIES */
34 RATING_MINIMUM = -1000,
35 RATING_APPALLING = -400,
36 RATING_VERYPOOR = -200,
37 RATING_POOR = 0,
38 RATING_MEDIOCRE = 200,
39 RATING_GOOD = 400,
40 RATING_VERYGOOD = 600,
41 RATING_EXCELLENT = 800,
42 RATING_OUTSTANDING = 1000,
43
44 RATING_MAXIMUM = RATING_OUTSTANDING,
45
46 RATING_INITIAL = 500,
47
48 /* RATINGS AFFECTING NUMBERS */
49 RATING_TREE_DOWN_STEP = -35,
50 RATING_TREE_MINIMUM = RATING_MINIMUM,
51 RATING_TREE_UP_STEP = 7,
52 RATING_TREE_MAXIMUM = 220,
53
54 RATING_GROWTH_UP_STEP = 5,
55 RATING_GROWTH_MAXIMUM = RATING_MEDIOCRE,
56 RATING_STATION_UP_STEP = 12,
57 RATING_STATION_DOWN_STEP = -15,
58
59 RATING_TUNNEL_BRIDGE_DOWN_STEP = -250,
60 RATING_TUNNEL_BRIDGE_MINIMUM = 0,
61 RATING_TUNNEL_BRIDGE_NEEDED_PERMISSIVE = 144,
62 RATING_TUNNEL_BRIDGE_NEEDED_NEUTRAL = 208,
63 RATING_TUNNEL_BRIDGE_NEEDED_HOSTILE = 400,
64
65 RATING_ROAD_DOWN_STEP_INNER = -50,
66 RATING_ROAD_DOWN_STEP_EDGE = -18,
67 RATING_ROAD_MINIMUM = -100,
68 RATING_ROAD_NEEDED_PERMISSIVE = 16,
69 RATING_ROAD_NEEDED_NEUTRAL = 64,
70 RATING_ROAD_NEEDED_HOSTILE = 112,
71
72 RATING_HOUSE_MINIMUM = RATING_MINIMUM,
73
74 RATING_BRIBE_UP_STEP = 200,
75 RATING_BRIBE_MAXIMUM = 800,
76 RATING_BRIBE_DOWN_TO = -50 // XXX SHOULD BE SOMETHING LOWER?
77 };
78
82 enum TownLayout {
83 TL_BEGIN = 0,
84 TL_ORIGINAL = 0,
85 TL_BETTER_ROADS,
86 TL_2X2_GRID,
87 TL_3X3_GRID,
88
89 TL_RANDOM,
90
91 NUM_TLS,
92 };
93 template <> struct EnumPropsT<TownLayout> : MakeEnumPropsT<TownLayout, byte, TL_BEGIN, NUM_TLS, NUM_TLS, 3> {};
95 typedef SimpleTinyEnumT<TownLayout, byte> TownLayoutByte; // typedefing-enumification of TownLayout
96
98 enum TownFounding {
99 TF_BEGIN = 0,
100 TF_FORBIDDEN = 0,
101 TF_ALLOWED,
102 TF_CUSTOM_LAYOUT,
103 TF_END,
104 };
106 typedef SimpleTinyEnumT<TownFounding, byte> TownFoundingByte;
107
108 static const uint MAX_LENGTH_TOWN_NAME_CHARS = 32;
109
111 template <typename Tstorage>
112 struct TransportedCargoStat {
113 Tstorage old_max;
114 Tstorage new_max;
115 Tstorage old_act;
116 Tstorage new_act;
117
118 TransportedCargoStat() : old_max(0), new_max(0), old_act(0), new_act(0) {}
119
121 void NewMonth()
122 {
123 this->old_max = this->new_max; this->new_max = 0;
124 this->old_act = this->new_act; this->new_act = 0;
125 }
126 };
127
128 #endif /* TOWN_TYPE_H */