annotate src/town_type.h @ 13756:9f062af2f34a draft

(svn r18281) -Feature: founding towns in-game (based on work by Belugas, TheJosh, GeekToo, Terkhen and others)
author smatz <smatz@openttd.org>
date Tue, 24 Nov 2009 21:18:11 +0000
parents bc7926153e19
children f2931c1d6199
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8213
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1 /* $Id$ */
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
2
12778
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 12249
diff changeset
3 /*
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 12249
diff changeset
4 * This file is part of OpenTTD.
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 12249
diff changeset
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.
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 12249
diff changeset
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.
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 12249
diff changeset
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/>.
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 12249
diff changeset
8 */
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 12249
diff changeset
9
8213
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
10 /** @file town_type.h Types related to towns. */
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
11
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
12 #ifndef TOWN_TYPE_H
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
13 #define TOWN_TYPE_H
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
14
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
15 #include "core/enum_type.hpp"
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
16
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
17 typedef uint16 TownID;
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
18 struct Town;
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
19
11012
88712c0e082e (svn r15352) -Codechange: make the arguments passed around while founding a town a bit more readable
smatz <smatz@openttd.org>
parents: 11000
diff changeset
20 /** Supported initial town sizes */
88712c0e082e (svn r15352) -Codechange: make the arguments passed around while founding a town a bit more readable
smatz <smatz@openttd.org>
parents: 11000
diff changeset
21 enum TownSize {
88712c0e082e (svn r15352) -Codechange: make the arguments passed around while founding a town a bit more readable
smatz <smatz@openttd.org>
parents: 11000
diff changeset
22 TS_SMALL, ///< small town
88712c0e082e (svn r15352) -Codechange: make the arguments passed around while founding a town a bit more readable
smatz <smatz@openttd.org>
parents: 11000
diff changeset
23 TS_MEDIUM, ///< medium town
88712c0e082e (svn r15352) -Codechange: make the arguments passed around while founding a town a bit more readable
smatz <smatz@openttd.org>
parents: 11000
diff changeset
24 TS_LARGE, ///< large town
88712c0e082e (svn r15352) -Codechange: make the arguments passed around while founding a town a bit more readable
smatz <smatz@openttd.org>
parents: 11000
diff changeset
25 TS_RANDOM, ///< random size, bigger than small, smaller than large
8213
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
26 };
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
27
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
28 enum {
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
29 /* These refer to the maximums, so Appalling is -1000 to -400
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
30 * MAXIMUM RATINGS BOUNDARIES */
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
31 RATING_MINIMUM = -1000,
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
32 RATING_APPALLING = -400,
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
33 RATING_VERYPOOR = -200,
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
34 RATING_POOR = 0,
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
35 RATING_MEDIOCRE = 200,
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
36 RATING_GOOD = 400,
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
37 RATING_VERYGOOD = 600,
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
38 RATING_EXCELLENT = 800,
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
39 RATING_OUTSTANDING = 1000, ///< OUTSTANDING
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
40
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
41 RATING_MAXIMUM = RATING_OUTSTANDING,
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
42
8814
eb3b487b80a4 (svn r12560) -Cleanup: town_cmd.cpp and header files - variable scope and a bit of coding style
smatz <smatz@openttd.org>
parents: 8796
diff changeset
43 RATING_INITIAL = 500, ///< initial rating
eb3b487b80a4 (svn r12560) -Cleanup: town_cmd.cpp and header files - variable scope and a bit of coding style
smatz <smatz@openttd.org>
parents: 8796
diff changeset
44
8213
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
45 /* RATINGS AFFECTING NUMBERS */
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
46 RATING_TREE_DOWN_STEP = -35,
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
47 RATING_TREE_MINIMUM = RATING_MINIMUM,
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
48 RATING_TREE_UP_STEP = 7,
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
49 RATING_TREE_MAXIMUM = 220,
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
50
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents: 9913
diff changeset
51 RATING_GROWTH_UP_STEP = 5, ///< when a town grows, all companies have rating increased a bit ...
8814
eb3b487b80a4 (svn r12560) -Cleanup: town_cmd.cpp and header files - variable scope and a bit of coding style
smatz <smatz@openttd.org>
parents: 8796
diff changeset
52 RATING_GROWTH_MAXIMUM = RATING_MEDIOCRE, ///< ... up to RATING_MEDIOCRE
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents: 9913
diff changeset
53 RATING_STATION_UP_STEP = 12, ///< when a town grows, company gains reputation for all well serviced stations ...
8814
eb3b487b80a4 (svn r12560) -Cleanup: town_cmd.cpp and header files - variable scope and a bit of coding style
smatz <smatz@openttd.org>
parents: 8796
diff changeset
54 RATING_STATION_DOWN_STEP = -15, ///< ... but loses for bad serviced stations
eb3b487b80a4 (svn r12560) -Cleanup: town_cmd.cpp and header files - variable scope and a bit of coding style
smatz <smatz@openttd.org>
parents: 8796
diff changeset
55
11879
0552f4ad7c9e (svn r16277) -Codechange: enumerize values and remove unneeded values used for testing town rating
smatz <smatz@openttd.org>
parents: 11368
diff changeset
56 RATING_TUNNEL_BRIDGE_DOWN_STEP = -250, ///< penalty for removing town owned tunnel or bridge
0552f4ad7c9e (svn r16277) -Codechange: enumerize values and remove unneeded values used for testing town rating
smatz <smatz@openttd.org>
parents: 11368
diff changeset
57 RATING_TUNNEL_BRIDGE_MINIMUM = 0, ///< minimum rating after removing tunnel or bridge
0552f4ad7c9e (svn r16277) -Codechange: enumerize values and remove unneeded values used for testing town rating
smatz <smatz@openttd.org>
parents: 11368
diff changeset
58 RATING_TUNNEL_BRIDGE_NEEDED_PERMISSIVE = 144, ///< rating needed, "Permissive" difficulty settings
0552f4ad7c9e (svn r16277) -Codechange: enumerize values and remove unneeded values used for testing town rating
smatz <smatz@openttd.org>
parents: 11368
diff changeset
59 RATING_TUNNEL_BRIDGE_NEEDED_NEUTRAL = 208, ///< "Neutral"
0552f4ad7c9e (svn r16277) -Codechange: enumerize values and remove unneeded values used for testing town rating
smatz <smatz@openttd.org>
parents: 11368
diff changeset
60 RATING_TUNNEL_BRIDGE_NEEDED_HOSTILE = 400, ///< "Hostile"
8213
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
61
11879
0552f4ad7c9e (svn r16277) -Codechange: enumerize values and remove unneeded values used for testing town rating
smatz <smatz@openttd.org>
parents: 11368
diff changeset
62 RATING_ROAD_DOWN_STEP_INNER = -50, ///< removing a roadpiece in the middle
0552f4ad7c9e (svn r16277) -Codechange: enumerize values and remove unneeded values used for testing town rating
smatz <smatz@openttd.org>
parents: 11368
diff changeset
63 RATING_ROAD_DOWN_STEP_EDGE = -18, ///< removing a roadpiece at the edge
0552f4ad7c9e (svn r16277) -Codechange: enumerize values and remove unneeded values used for testing town rating
smatz <smatz@openttd.org>
parents: 11368
diff changeset
64 RATING_ROAD_MINIMUM = -100, ///< minimum rating after removing town owned road
0552f4ad7c9e (svn r16277) -Codechange: enumerize values and remove unneeded values used for testing town rating
smatz <smatz@openttd.org>
parents: 11368
diff changeset
65 RATING_ROAD_NEEDED_PERMISSIVE = 16, ///< rating needed, "Permissive" difficulty settings
0552f4ad7c9e (svn r16277) -Codechange: enumerize values and remove unneeded values used for testing town rating
smatz <smatz@openttd.org>
parents: 11368
diff changeset
66 RATING_ROAD_NEEDED_NEUTRAL = 64, ///< "Neutral"
0552f4ad7c9e (svn r16277) -Codechange: enumerize values and remove unneeded values used for testing town rating
smatz <smatz@openttd.org>
parents: 11368
diff changeset
67 RATING_ROAD_NEEDED_HOSTILE = 112, ///< "Hostile"
0552f4ad7c9e (svn r16277) -Codechange: enumerize values and remove unneeded values used for testing town rating
smatz <smatz@openttd.org>
parents: 11368
diff changeset
68
8213
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
69 RATING_HOUSE_MINIMUM = RATING_MINIMUM,
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
70
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
71 RATING_BRIBE_UP_STEP = 200,
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
72 RATING_BRIBE_MAXIMUM = 800,
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
73 RATING_BRIBE_DOWN_TO = -50 // XXX SHOULD BE SOMETHING LOWER?
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
74 };
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
75
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
76 /**
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
77 * Town Layouts
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
78 */
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
79 enum TownLayout {
11000
def5dbb7e314 (svn r15340) -Fix [FS#2121]: changing town road layout in-game caused ugly road networks
smatz <smatz@openttd.org>
parents: 10208
diff changeset
80 TL_BEGIN = 0,
def5dbb7e314 (svn r15340) -Fix [FS#2121]: changing town road layout in-game caused ugly road networks
smatz <smatz@openttd.org>
parents: 10208
diff changeset
81 TL_ORIGINAL = 0, ///< Original algorithm (min. 1 distance between roads)
8213
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
82 TL_BETTER_ROADS, ///< Extended original algorithm (min. 2 distance between roads)
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
83 TL_2X2_GRID, ///< Geometric 2x2 grid algorithm
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
84 TL_3X3_GRID, ///< Geometric 3x3 grid algorithm
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
85
8796
54e679b675c5 (svn r12534) -Feature: Add a new type of town road layouts - random for each town
skidd13 <skidd13@openttd.org>
parents: 8213
diff changeset
86 TL_RANDOM, ///< Random town layout
54e679b675c5 (svn r12534) -Feature: Add a new type of town road layouts - random for each town
skidd13 <skidd13@openttd.org>
parents: 8213
diff changeset
87
8213
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
88 NUM_TLS, ///< Number of town layouts
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
89 };
12021
9ca215bac61b (svn r16428) -Codechange: use the less bloated SimpleTinyEnumT instead of TinyEnumT if the stuff provided by TinyEnumT but not SimpleTinyEnumT is not used.
rubidium <rubidium@openttd.org>
parents: 11879
diff changeset
90 /** It needs to be 8bits, because we save and load it as such */
9ca215bac61b (svn r16428) -Codechange: use the less bloated SimpleTinyEnumT instead of TinyEnumT if the stuff provided by TinyEnumT but not SimpleTinyEnumT is not used.
rubidium <rubidium@openttd.org>
parents: 11879
diff changeset
91 typedef SimpleTinyEnumT<TownLayout, byte> TownLayoutByte; // typedefing-enumification of TownLayout
8213
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
92
13756
9f062af2f34a (svn r18281) -Feature: founding towns in-game (based on work by Belugas, TheJosh, GeekToo, Terkhen and others)
smatz <smatz@openttd.org>
parents: 12778
diff changeset
93 /** Town founding setting values */
9f062af2f34a (svn r18281) -Feature: founding towns in-game (based on work by Belugas, TheJosh, GeekToo, Terkhen and others)
smatz <smatz@openttd.org>
parents: 12778
diff changeset
94 enum TownFounding {
9f062af2f34a (svn r18281) -Feature: founding towns in-game (based on work by Belugas, TheJosh, GeekToo, Terkhen and others)
smatz <smatz@openttd.org>
parents: 12778
diff changeset
95 TF_BEGIN = 0, ///< Used for iterations and limit testing
9f062af2f34a (svn r18281) -Feature: founding towns in-game (based on work by Belugas, TheJosh, GeekToo, Terkhen and others)
smatz <smatz@openttd.org>
parents: 12778
diff changeset
96 TF_FORBIDDEN = 0, ///< Forbidden
9f062af2f34a (svn r18281) -Feature: founding towns in-game (based on work by Belugas, TheJosh, GeekToo, Terkhen and others)
smatz <smatz@openttd.org>
parents: 12778
diff changeset
97 TF_ALLOWED, ///< Allowed
9f062af2f34a (svn r18281) -Feature: founding towns in-game (based on work by Belugas, TheJosh, GeekToo, Terkhen and others)
smatz <smatz@openttd.org>
parents: 12778
diff changeset
98 TF_CUSTOM_LAYOUT, ///< Allowed, with custom town layout
9f062af2f34a (svn r18281) -Feature: founding towns in-game (based on work by Belugas, TheJosh, GeekToo, Terkhen and others)
smatz <smatz@openttd.org>
parents: 12778
diff changeset
99 TF_END, ///< Used for iterations and limit testing
9f062af2f34a (svn r18281) -Feature: founding towns in-game (based on work by Belugas, TheJosh, GeekToo, Terkhen and others)
smatz <smatz@openttd.org>
parents: 12778
diff changeset
100 };
9f062af2f34a (svn r18281) -Feature: founding towns in-game (based on work by Belugas, TheJosh, GeekToo, Terkhen and others)
smatz <smatz@openttd.org>
parents: 12778
diff changeset
101 /** It needs to be 8bits, because we save and load it as such */
9f062af2f34a (svn r18281) -Feature: founding towns in-game (based on work by Belugas, TheJosh, GeekToo, Terkhen and others)
smatz <smatz@openttd.org>
parents: 12778
diff changeset
102 typedef SimpleTinyEnumT<TownFounding, byte> TownFoundingByte;
9f062af2f34a (svn r18281) -Feature: founding towns in-game (based on work by Belugas, TheJosh, GeekToo, Terkhen and others)
smatz <smatz@openttd.org>
parents: 12778
diff changeset
103
9913
a1cc2bf90049 (svn r14063) -Codechange: replace some "magic" constants with enumified constants.
rubidium <rubidium@openttd.org>
parents: 9478
diff changeset
104 enum {
a1cc2bf90049 (svn r14063) -Codechange: replace some "magic" constants with enumified constants.
rubidium <rubidium@openttd.org>
parents: 9478
diff changeset
105 MAX_LENGTH_TOWN_NAME_BYTES = 31, ///< The maximum length of a town name in bytes including '\0'
a1cc2bf90049 (svn r14063) -Codechange: replace some "magic" constants with enumified constants.
rubidium <rubidium@openttd.org>
parents: 9478
diff changeset
106 MAX_LENGTH_TOWN_NAME_PIXELS = 130, ///< The maximum length of a town name in pixels
a1cc2bf90049 (svn r14063) -Codechange: replace some "magic" constants with enumified constants.
rubidium <rubidium@openttd.org>
parents: 9478
diff changeset
107 };
a1cc2bf90049 (svn r14063) -Codechange: replace some "magic" constants with enumified constants.
rubidium <rubidium@openttd.org>
parents: 9478
diff changeset
108
8213
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
diff changeset
109 #endif /* TOWN_TYPE_H */