16#include "../../core/enum_type.hpp"
17#include "../../misc/dbg_helpers.h"
43enum EndSegmentReasonBits {
64 ESRB_POSSIBLE_TARGET = ESRB_DEPOT | ESRB_WAYPOINT | ESRB_STATION | ESRB_SAFE_TILE,
67 ESRB_CACHED_MASK = ESRB_DEAD_END | ESRB_RAIL_TYPE | ESRB_INFINITE_LOOP | ESRB_SEGMENT_TOO_LONG | ESRB_CHOICE_FOLLOWS | ESRB_DEPOT | ESRB_WAYPOINT | ESRB_STATION | ESRB_SAFE_TILE,
70 ESRB_ABORT_PF_MASK = ESRB_DEAD_END | ESRB_PATH_TOO_LONG | ESRB_INFINITE_LOOP | ESRB_FIRST_TWO_WAY_RED,
75inline std::string
ValueStr(EndSegmentReasonBits bits)
77 static const char *
const end_segment_reason_names[] = {
78 "DEAD_END",
"RAIL_TYPE",
"INFINITE_LOOP",
"SEGMENT_TOO_LONG",
"CHOICE_FOLLOWS",
79 "DEPOT",
"WAYPOINT",
"STATION",
"SAFE_TILE",
80 "PATH_TOO_LONG",
"FIRST_TWO_WAY_RED",
"LOOK_AHEAD_END",
"TARGET_REACHED"
84 ss <<
"0x" << std::setfill(
'0') << std::setw(4) << std::hex << bits;
85 ss <<
" (" <<
ComposeNameT(bits, end_segment_reason_names,
"UNK", ESRB_NONE,
"NONE") <<
")";
std::string ValueStr(Trackdir td)
Return name of given Trackdir.
std::string ComposeNameT(E value, T &t, const char *t_unk, E val_inv, const char *name_inv)
Helper template function that returns compound bitfield name that is concatenation of names of each s...
#define DECLARE_ENUM_AS_BIT_SET(enum_type)
Operators to allow to work with enum as with type safe bit set in C++.
@ ESR_SAFE_TILE
safe waiting position found (could be a target)
@ ESR_STATION
station encountered (could be a target next time)
@ ESR_NONE
no reason to end the segment here
@ ESR_TARGET_REACHED
we have just reached the destination
@ ESR_INFINITE_LOOP
infinite loop detected
@ ESR_FIRST_TWO_WAY_RED
first signal was 2-way and it was red
@ ESR_PATH_TOO_LONG
the path is too long (searching for the nearest depot in the given radius)
@ ESR_WAYPOINT
waypoint encountered (could be a target next time)
@ ESR_DEAD_END
track ends here
@ ESR_LOOK_AHEAD_END
we have just passed the last look-ahead signal
@ ESR_DEPOT
stop in the depot (could be a target next time)
@ ESR_RAIL_TYPE
the next tile has a different rail type than our tiles
@ ESR_SEGMENT_TOO_LONG
the segment is too long (possible infinite loop)
@ ESR_CHOICE_FOLLOWS
the next tile contains a choice (the track splits to more than one segments)