11#include "../rail_map.h"
12#include "../core/enum_type.hpp"
15#include "../safeguards.h"
19 "NE",
"SE",
"UE",
"LE",
"LS",
"RS",
"rne",
"rse",
20 "SW",
"NW",
"UW",
"LW",
"LN",
"RN",
"rsw",
"rnw",
38 "NE",
"SE",
"SW",
"NW",
50 "NORMAL",
"ENTRY",
"EXIT",
"COMBO",
"PBS",
"NOENTRY",
63 return fmt::format(
"0x{:04X} ({}, {})", tile.base(),
TileX(tile),
TileY(tile));
size_t&
DumpTarget::LastTypeId()
70 static size_t last_type_id = 0;
104 if (num_spaces > 0) {
105 m_out += std::string(num_spaces,
' ');
123 if (!cur_name.empty()) {
136 format_append(
m_out,
"{} = {{\n", name);
static const std::string_view signal_type_names[]
SignalType short names.
std::string ValueStr(Trackdir td)
Return name of given Trackdir.
std::string TileStr(TileIndex tile)
Translate TileIndex into string.
static const std::string_view diagdir_names[]
DiagDirection short names.
static const std::string_view trackdir_names[]
Trackdir & TrackdirBits short names.
Functions to be used for debug printings.
std::string ComposeNameT(E value, T &t, std::string_view t_unk, E val_inv, std::string_view name_inv)
Helper template function that returns compound bitfield name that is concatenation of names of each s...
ArrayT< T >::Item ItemAtT(E idx, const T &t, typename ArrayT< T >::Item t_unk)
Helper template function that returns item of array at given index or t_unk when index is out of boun...
DiagDirection
Enumeration for diagonal directions.
@ INVALID_DIAGDIR
Flag for an invalid DiagDirection.
constexpr std::underlying_type_t< enum_type > to_underlying(enum_type e)
Implementation of std::to_underlying (from C++23)
static debug_inline uint TileY(TileIndex tile)
Get the Y component of a tile.
static debug_inline uint TileX(TileIndex tile)
Get the X component of a tile.
SignalType
Type of signal, i.e.
Used as a key into map of known object instances.
int m_indent
current indent/nesting level
std::string m_out
the output string
void WriteTile(std::string_view name, TileIndex t)
Write name & TileIndex to the output.
std::stack< std::string > m_cur_struct
here we will track the current structure name
void BeginStruct(size_t type_id, std::string_view name, const void *ptr)
Open new structure (one level deeper than the current one) 'name = {<LF>'.
std::string GetCurrentStructName()
Return structured name of the current class/structure.
KNOWN_NAMES m_known_names
map of known object instances and their structured names
bool FindKnownName(size_t type_id, const void *ptr, std::string &name)
Find the given instance in our anti-recursion repository.
void WriteIndent()
Write some leading spaces into the output.
static size_t & LastTypeId()
Keep track of the last assigned type_id.
void EndStruct()
Close structure '}<LF>'.
Trackdir
Enumeration for tracks and directions.
@ INVALID_TRACKDIR
Flag for an invalid trackdir.
TrackdirBits
Allow incrementing of Trackdir variables.
@ INVALID_TRACKDIR_BIT
Flag for an invalid trackdirbit value.