2009-08-21 20:21:05 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* 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.
|
|
|
|
* 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.
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2008-01-07 14:02:26 +00:00
|
|
|
/** @file town_type.h Types related to towns. */
|
|
|
|
|
|
|
|
#ifndef TOWN_TYPE_H
|
|
|
|
#define TOWN_TYPE_H
|
|
|
|
|
|
|
|
#include "core/enum_type.hpp"
|
2023-07-03 21:43:37 +00:00
|
|
|
#include <vector>
|
2008-01-07 14:02:26 +00:00
|
|
|
|
2024-01-07 16:41:53 +00:00
|
|
|
typedef uint16_t TownID;
|
2008-01-07 14:02:26 +00:00
|
|
|
struct Town;
|
|
|
|
|
2019-03-27 18:12:04 +00:00
|
|
|
typedef std::vector<TownID> TownList;
|
2015-08-03 20:29:03 +00:00
|
|
|
|
2009-02-05 13:33:37 +00:00
|
|
|
/** Supported initial town sizes */
|
|
|
|
enum TownSize {
|
2010-03-20 10:55:08 +00:00
|
|
|
TSZ_SMALL, ///< Small town.
|
|
|
|
TSZ_MEDIUM, ///< Medium town.
|
|
|
|
TSZ_LARGE, ///< Large town.
|
|
|
|
TSZ_RANDOM, ///< Random size, bigger than small, smaller than large.
|
2010-03-20 10:59:06 +00:00
|
|
|
|
|
|
|
TSZ_END, ///< Number of available town sizes.
|
2008-01-07 14:02:26 +00:00
|
|
|
};
|
2010-04-17 13:31:41 +00:00
|
|
|
template <> struct EnumPropsT<TownSize> : MakeEnumPropsT<TownSize, byte, TSZ_SMALL, TSZ_END, TSZ_END, 2> {};
|
2024-01-16 21:01:28 +00:00
|
|
|
DECLARE_ENUM_AS_ADDABLE(TownSize)
|
2008-01-07 14:02:26 +00:00
|
|
|
|
2010-05-13 09:44:44 +00:00
|
|
|
enum Ratings {
|
2008-01-07 14:02:26 +00:00
|
|
|
/* These refer to the maximums, so Appalling is -1000 to -400
|
|
|
|
* MAXIMUM RATINGS BOUNDARIES */
|
|
|
|
RATING_MINIMUM = -1000,
|
|
|
|
RATING_APPALLING = -400,
|
|
|
|
RATING_VERYPOOR = -200,
|
|
|
|
RATING_POOR = 0,
|
|
|
|
RATING_MEDIOCRE = 200,
|
|
|
|
RATING_GOOD = 400,
|
|
|
|
RATING_VERYGOOD = 600,
|
|
|
|
RATING_EXCELLENT = 800,
|
|
|
|
RATING_OUTSTANDING = 1000, ///< OUTSTANDING
|
|
|
|
|
|
|
|
RATING_MAXIMUM = RATING_OUTSTANDING,
|
|
|
|
|
2008-04-04 14:53:06 +00:00
|
|
|
RATING_INITIAL = 500, ///< initial rating
|
|
|
|
|
2008-01-07 14:02:26 +00:00
|
|
|
/* RATINGS AFFECTING NUMBERS */
|
|
|
|
RATING_TREE_DOWN_STEP = -35,
|
|
|
|
RATING_TREE_MINIMUM = RATING_MINIMUM,
|
|
|
|
RATING_TREE_UP_STEP = 7,
|
|
|
|
RATING_TREE_MAXIMUM = 220,
|
|
|
|
|
2008-09-30 20:51:04 +00:00
|
|
|
RATING_GROWTH_UP_STEP = 5, ///< when a town grows, all companies have rating increased a bit ...
|
2008-04-04 14:53:06 +00:00
|
|
|
RATING_GROWTH_MAXIMUM = RATING_MEDIOCRE, ///< ... up to RATING_MEDIOCRE
|
2008-09-30 20:51:04 +00:00
|
|
|
RATING_STATION_UP_STEP = 12, ///< when a town grows, company gains reputation for all well serviced stations ...
|
2019-01-13 07:38:48 +00:00
|
|
|
RATING_STATION_DOWN_STEP = -15, ///< ... but loses for badly serviced stations
|
2008-04-04 14:53:06 +00:00
|
|
|
|
2009-05-11 11:55:41 +00:00
|
|
|
RATING_TUNNEL_BRIDGE_DOWN_STEP = -250, ///< penalty for removing town owned tunnel or bridge
|
|
|
|
RATING_TUNNEL_BRIDGE_MINIMUM = 0, ///< minimum rating after removing tunnel or bridge
|
2022-03-11 16:50:43 +00:00
|
|
|
RATING_TUNNEL_BRIDGE_NEEDED_LENIENT = 144, ///< rating needed, "Lenient" difficulty settings
|
|
|
|
RATING_TUNNEL_BRIDGE_NEEDED_NEUTRAL = 208, ///< "Neutral"
|
|
|
|
RATING_TUNNEL_BRIDGE_NEEDED_HOSTILE = 400, ///< "Hostile"
|
|
|
|
RATING_TUNNEL_BRIDGE_NEEDED_PERMISSIVE = RATING_MINIMUM, ///< "Permissive" (local authority disabled)
|
2009-05-11 11:55:41 +00:00
|
|
|
|
|
|
|
RATING_ROAD_DOWN_STEP_INNER = -50, ///< removing a roadpiece in the middle
|
|
|
|
RATING_ROAD_DOWN_STEP_EDGE = -18, ///< removing a roadpiece at the edge
|
|
|
|
RATING_ROAD_MINIMUM = -100, ///< minimum rating after removing town owned road
|
2022-03-11 16:50:43 +00:00
|
|
|
RATING_ROAD_NEEDED_LENIENT = 16, ///< rating needed, "Lenient" difficulty settings
|
|
|
|
RATING_ROAD_NEEDED_NEUTRAL = 64, ///< "Neutral"
|
|
|
|
RATING_ROAD_NEEDED_HOSTILE = 112, ///< "Hostile"
|
|
|
|
RATING_ROAD_NEEDED_PERMISSIVE = RATING_MINIMUM, ///< "Permissive" (local authority disabled)
|
2008-01-07 14:02:26 +00:00
|
|
|
|
|
|
|
RATING_HOUSE_MINIMUM = RATING_MINIMUM,
|
|
|
|
|
|
|
|
RATING_BRIBE_UP_STEP = 200,
|
|
|
|
RATING_BRIBE_MAXIMUM = 800,
|
|
|
|
RATING_BRIBE_DOWN_TO = -50 // XXX SHOULD BE SOMETHING LOWER?
|
|
|
|
};
|
|
|
|
|
2019-04-21 21:56:35 +00:00
|
|
|
/** Town Layouts. It needs to be 8bits, because we save and load it as such */
|
|
|
|
enum TownLayout : byte {
|
2009-02-04 20:17:25 +00:00
|
|
|
TL_BEGIN = 0,
|
|
|
|
TL_ORIGINAL = 0, ///< Original algorithm (min. 1 distance between roads)
|
2008-01-07 14:02:26 +00:00
|
|
|
TL_BETTER_ROADS, ///< Extended original algorithm (min. 2 distance between roads)
|
|
|
|
TL_2X2_GRID, ///< Geometric 2x2 grid algorithm
|
|
|
|
TL_3X3_GRID, ///< Geometric 3x3 grid algorithm
|
|
|
|
|
2008-04-01 16:27:01 +00:00
|
|
|
TL_RANDOM, ///< Random town layout
|
|
|
|
|
2008-01-07 14:02:26 +00:00
|
|
|
NUM_TLS, ///< Number of town layouts
|
|
|
|
};
|
2010-04-17 13:31:41 +00:00
|
|
|
template <> struct EnumPropsT<TownLayout> : MakeEnumPropsT<TownLayout, byte, TL_BEGIN, NUM_TLS, NUM_TLS, 3> {};
|
2024-01-16 21:01:28 +00:00
|
|
|
DECLARE_ENUM_AS_ADDABLE(TownLayout)
|
2008-01-07 14:02:26 +00:00
|
|
|
|
2019-04-21 21:39:32 +00:00
|
|
|
/** Town founding setting values. It needs to be 8bits, because we save and load it as such */
|
|
|
|
enum TownFounding : byte {
|
2009-11-24 21:18:11 +00:00
|
|
|
TF_BEGIN = 0, ///< Used for iterations and limit testing
|
|
|
|
TF_FORBIDDEN = 0, ///< Forbidden
|
|
|
|
TF_ALLOWED, ///< Allowed
|
|
|
|
TF_CUSTOM_LAYOUT, ///< Allowed, with custom town layout
|
|
|
|
TF_END, ///< Used for iterations and limit testing
|
|
|
|
};
|
|
|
|
|
2018-11-07 18:06:39 +00:00
|
|
|
/** Town cargo generation modes */
|
|
|
|
enum TownCargoGenMode : byte {
|
|
|
|
TCGM_BEGIN = 0,
|
|
|
|
TCGM_ORIGINAL = 0, ///< Original algorithm (quadratic cargo by population)
|
|
|
|
TCGM_BITCOUNT, ///< Bit-counted algorithm (normal distribution from individual house population)
|
|
|
|
TCGM_END,
|
|
|
|
};
|
|
|
|
|
2011-04-17 18:42:17 +00:00
|
|
|
static const uint MAX_LENGTH_TOWN_NAME_CHARS = 32; ///< The maximum length of a town name in characters including '\0'
|
2008-08-13 06:05:01 +00:00
|
|
|
|
2011-11-15 20:47:53 +00:00
|
|
|
/** Store the maximum and actually transported cargo amount for the current and the last month. */
|
|
|
|
template <typename Tstorage>
|
|
|
|
struct TransportedCargoStat {
|
|
|
|
Tstorage old_max; ///< Maximum amount last month
|
|
|
|
Tstorage new_max; ///< Maximum amount this month
|
|
|
|
Tstorage old_act; ///< Actually transported last month
|
|
|
|
Tstorage new_act; ///< Actually transported this month
|
|
|
|
|
|
|
|
TransportedCargoStat() : old_max(0), new_max(0), old_act(0), new_act(0) {}
|
|
|
|
|
|
|
|
/** Update stats for a new month. */
|
|
|
|
void NewMonth()
|
|
|
|
{
|
|
|
|
this->old_max = this->new_max; this->new_max = 0;
|
|
|
|
this->old_act = this->new_act; this->new_act = 0;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-10-10 17:01:44 +00:00
|
|
|
|
|
|
|
/** Town allow tunnel building setting values. It needs to be 8bits, because we save and load it as such */
|
|
|
|
enum TownTunnelMode : byte {
|
|
|
|
TTM_BEGIN = 0, ///< Used for iterations and limit testing
|
|
|
|
TTM_FORBIDDEN = 0, ///< Forbidden
|
|
|
|
TTM_OBSTRUCTION_ONLY, ///< Allowed only for tunnels under obstructions
|
|
|
|
TTM_ALLOWED, ///< Allowed in all cases (including through hills)
|
|
|
|
TTM_END, ///< Used for iterations and limit testing
|
|
|
|
};
|
|
|
|
|
2008-01-07 14:02:26 +00:00
|
|
|
#endif /* TOWN_TYPE_H */
|