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_t LinkGraphID
;
14 static const LinkGraphID INVALID_LINK_GRAPH
= UINT16_MAX
;
16 typedef uint16_t LinkGraphJobID
;
17 static const LinkGraphJobID INVALID_LINK_GRAPH_JOB
= UINT16_MAX
;
19 typedef uint16_t NodeID
;
20 static const NodeID INVALID_NODE
= UINT16_MAX
;
22 enum DistributionType
: uint8_t {
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.
35 * Special modes for updating links. 'Restricted' means that vehicles with
36 * 'no loading' orders are serving the link. If a link is only served by
37 * such vehicles it's 'fully restricted'. This means the link can be used
38 * by cargo arriving in such vehicles, but not by cargo generated or
39 * transferring at the source station of the link. In order to find out
40 * about this condition we keep two update timestamps in each link, one for
41 * the restricted and one for the unrestricted part of it. If either one
42 * times out while the other is still valid the link becomes fully
43 * restricted or fully unrestricted, respectively.
44 * Refreshing a link makes just sure a minimum capacity is kept. Increasing
45 * actually adds the given capacity.
48 EUM_INCREASE
= 1, ///< Increase capacity.
49 EUM_REFRESH
= 1 << 1, ///< Refresh capacity.
50 EUM_RESTRICTED
= 1 << 2, ///< Use restricted link.
51 EUM_UNRESTRICTED
= 1 << 3, ///< Use unrestricted link.
54 DECLARE_ENUM_AS_BIT_SET(EdgeUpdateMode
)
56 #endif /* LINKGRAPH_TYPE_H */