OpenTTD
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 {
26 
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,
43 
44  RATING_MAXIMUM = RATING_OUTSTANDING,
45 
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 
55  RATING_GROWTH_MAXIMUM = RATING_MEDIOCRE,
58 
64 
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,
88 
90 
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 
99  TF_BEGIN = 0,
104 };
107 
108 static const uint MAX_LENGTH_TOWN_NAME_CHARS = 32;
109 
111 template <typename Tstorage>
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 */
Number of town layouts.
Definition: town_type.h:91
Helper template class that makes basic properties of given enumeration type visible from outsize...
Definition: enum_type.hpp:66
SimpleTinyEnumT< TownFounding, byte > TownFoundingByte
It needs to be 8bits, because we save and load it as such.
Definition: town_type.h:106
Geometric 3x3 grid algorithm.
Definition: town_type.h:87
Allowed.
Definition: town_type.h:101
penalty for removing town owned tunnel or bridge
Definition: town_type.h:59
Medium town.
Definition: town_type.h:23
Ratings
Definition: town_type.h:31
void NewMonth()
Update stats for a new month.
Definition: town_type.h:121
initial rating
Definition: town_type.h:46
Tstorage new_act
Actually transported this month.
Definition: town_type.h:116
Type (helpers) for enums.
Used for iterations and limit testing.
Definition: town_type.h:103
SimpleTinyEnumT< TownLayout, byte > TownLayoutByte
It needs to be 8bits, because we save and load it as such.
Definition: town_type.h:95
TownSize
Supported initial town sizes.
Definition: town_type.h:21
Geometric 2x2 grid algorithm.
Definition: town_type.h:86
minimum rating after removing town owned road
Definition: town_type.h:67
rating needed, "Permissive" difficulty settings
Definition: town_type.h:68
when a town grows, all companies have rating increased a bit ...
Definition: town_type.h:54
Number of available town sizes.
Definition: town_type.h:27
Informative template class exposing basic enumeration properties used by several other templates belo...
Definition: enum_type.hpp:52
rating needed, "Permissive" difficulty settings
Definition: town_type.h:61
Random town layout.
Definition: town_type.h:89
... up to RATING_MEDIOCRE
Definition: town_type.h:55
Tstorage new_max
Maximum amount this month.
Definition: town_type.h:114
TownFounding
Town founding setting values.
Definition: town_type.h:98
removing a roadpiece at the edge
Definition: town_type.h:66
removing a roadpiece in the middle
Definition: town_type.h:65
Tstorage old_max
Maximum amount last month.
Definition: town_type.h:113
Small town.
Definition: town_type.h:22
Random size, bigger than small, smaller than large.
Definition: town_type.h:25
TownLayout
Town Layouts.
Definition: town_type.h:82
Forbidden.
Definition: town_type.h:100
Town data structure.
Definition: town.h:55
Extended original algorithm (min. 2 distance between roads)
Definition: town_type.h:85
Used for iterations and limit testing.
Definition: town_type.h:99
Allowed, with custom town layout.
Definition: town_type.h:102
Large town.
Definition: town_type.h:24
Store the maximum and actually transported cargo amount for the current and the last month...
Definition: town_type.h:112
Original algorithm (min. 1 distance between roads)
Definition: town_type.h:84
static const uint MAX_LENGTH_TOWN_NAME_CHARS
The maximum length of a town name in characters including &#39;\0&#39;.
Definition: town_type.h:108
when a town grows, company gains reputation for all well serviced stations ...
Definition: town_type.h:56
OUTSTANDING.
Definition: town_type.h:42
... but loses for bad serviced stations
Definition: town_type.h:57
minimum rating after removing tunnel or bridge
Definition: town_type.h:60
Tstorage old_act
Actually transported last month.
Definition: town_type.h:115