2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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 /** @file linkgraph_type.h Declaration of link graph types used for cargo distribution. */
10 #ifndef LINKGRAPH_TYPE_H
11 #define LINKGRAPH_TYPE_H
13 typedef uint16 LinkGraphID
;
14 static const LinkGraphID INVALID_LINK_GRAPH
= UINT16_MAX
;
16 typedef uint16 LinkGraphJobID
;
17 static const LinkGraphID INVALID_LINK_GRAPH_JOB
= UINT16_MAX
;
19 typedef uint16 NodeID
;
20 static const NodeID INVALID_NODE
= UINT16_MAX
;
22 enum DistributionType
: byte
{
25 DT_MANUAL
= 0, ///< Manual distribution. No link graph calculations are run.
26 DT_ASYMMETRIC
= 1, ///< Asymmetric distribution. Usually cargo will only travel in one direction.
27 DT_MAX_NONSYMMETRIC
= 1, ///< Maximum non-symmetric distribution.
28 DT_SYMMETRIC
= 2, ///< Symmetric distribution. The same amount of cargo travels in each direction between each pair of nodes.
34 /* It needs to be 8bits, because we save and load it as such
35 * Define basic enum properties
37 template <> struct EnumPropsT
<DistributionType
> : MakeEnumPropsT
<DistributionType
, byte
, DT_BEGIN
, DT_END
, DT_NUM
> {};
40 * Special modes for updating links. 'Restricted' means that vehicles with
41 * 'no loading' orders are serving the link. If a link is only served by
42 * such vehicles it's 'fully restricted'. This means the link can be used
43 * by cargo arriving in such vehicles, but not by cargo generated or
44 * transferring at the source station of the link. In order to find out
45 * about this condition we keep two update timestamps in each link, one for
46 * the restricted and one for the unrestricted part of it. If either one
47 * times out while the other is still valid the link becomes fully
48 * restricted or fully unrestricted, respectively.
49 * Refreshing a link makes just sure a minimum capacity is kept. Increasing
50 * actually adds the given capacity.
53 EUM_INCREASE
= 1, ///< Increase capacity.
54 EUM_REFRESH
= 1 << 1, ///< Refresh capacity.
55 EUM_RESTRICTED
= 1 << 2, ///< Use restricted link.
56 EUM_UNRESTRICTED
= 1 << 3, ///< Use unrestricted link.
59 DECLARE_ENUM_AS_BIT_SET(EdgeUpdateMode
)
61 #endif /* LINKGRAPH_TYPE_H */