(svn r27729) -Codechange: Do not count static NewGRF when checking for the maximum...
[openttd.git] / src / linkgraph / linkgraph_type.h
blob6a3239b089bd63251b0bc1dd3672e582d52bfc1a
1 /* $Id$ */
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 */
10 /** @file linkgraph_type.h Declaration of link graph types used for cargo distribution. */
12 #ifndef LINKGRAPH_TYPE_H
13 #define LINKGRAPH_TYPE_H
15 typedef uint16 LinkGraphID;
16 static const LinkGraphID INVALID_LINK_GRAPH = UINT16_MAX;
18 typedef uint16 LinkGraphJobID;
19 static const LinkGraphID INVALID_LINK_GRAPH_JOB = UINT16_MAX;
21 typedef uint16 NodeID;
22 static const NodeID INVALID_NODE = UINT16_MAX;
24 enum DistributionType {
25 DT_BEGIN = 0,
26 DT_MIN = 0,
27 DT_MANUAL = 0, ///< Manual distribution. No link graph calculations are run.
28 DT_ASYMMETRIC = 1, ///< Asymmetric distribution. Usually cargo will only travel in one direction.
29 DT_MAX_NONSYMMETRIC = 1, ///< Maximum non-symmetric distribution.
30 DT_SYMMETRIC = 2, ///< Symmetric distribution. The same amount of cargo travels in each direction between each pair of nodes.
31 DT_MAX = 2,
32 DT_NUM = 3,
33 DT_END = 3
36 /* It needs to be 8bits, because we save and load it as such
37 * Define basic enum properties
39 template <> struct EnumPropsT<DistributionType> : MakeEnumPropsT<DistributionType, byte, DT_BEGIN, DT_END, DT_NUM> {};
40 typedef TinyEnumT<DistributionType> DistributionTypeByte; // typedefing-enumification of DistributionType
42 /**
43 * Special modes for updating links. 'Restricted' means that vehicles with
44 * 'no loading' orders are serving the link. If a link is only served by
45 * such vehicles it's 'fully restricted'. This means the link can be used
46 * by cargo arriving in such vehicles, but not by cargo generated or
47 * transferring at the source station of the link. In order to find out
48 * about this condition we keep two update timestamps in each link, one for
49 * the restricted and one for the unrestricted part of it. If either one
50 * times out while the other is still valid the link becomes fully
51 * restricted or fully unrestricted, respectively.
52 * Refreshing a link makes just sure a minimum capacity is kept. Increasing
53 * actually adds the given capacity.
55 enum EdgeUpdateMode {
56 EUM_INCREASE = 1, ///< Increase capacity.
57 EUM_REFRESH = 1 << 1, ///< Refresh capacity.
58 EUM_RESTRICTED = 1 << 2, ///< Use restricted link.
59 EUM_UNRESTRICTED = 1 << 3, ///< Use unrestricted link.
62 DECLARE_ENUM_AS_BIT_SET(EdgeUpdateMode)
64 #endif /* LINKGRAPH_TYPE_H */