OpenTTD Source
12.0-beta2
|
Go to the documentation of this file.
10 #include "../stdafx.h"
11 #include "../rail_map.h"
17 #include "../safeguards.h"
21 "NE",
"SE",
"UE",
"LE",
"LS",
"RS",
"rne",
"rse",
22 "SW",
"NW",
"UW",
"LW",
"LN",
"RN",
"rsw",
"rnw",
40 "NE",
"SE",
"SW",
"NW",
52 "NORMAL",
"ENTRY",
"EXIT",
"COMBO",
"PBS",
"NOENTRY",
66 ss <<
"0x" << std::setfill(
'0') << std::setw(4) << std::hex << tile;
67 ss <<
" (" <<
TileX(tile) <<
", " <<
TileY(tile) <<
")";
75 static size_t last_type_id = 0;
109 if (num_spaces > 0) {
110 m_out += std::string(num_spaces,
' ');
118 m_out += std::string(name) +
" = " + std::to_string(value) +
"\n";
125 m_out += std::string(name) +
" = " + value_str +
"\n";
132 m_out += std::string(name) +
" = " +
TileStr(tile) +
"\n";
142 if (cur_name.size() > 0) {
155 m_out += std::string(name) +
" = {\n";
bool FindKnownName(size_t type_id, const void *ptr, std::string &name)
Find the given instance in our anti-recursion repository.
uint32 TileIndex
The index/ID of a Tile.
static size_t & LastTypeId()
Keep track of the last assigned type_id.
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...
void WriteIndent()
Write some leading spaces into the output.
TrackdirBits
Enumeration of bitmasks for the TrackDirs.
void EndStruct()
Close structure '}<LF>'.
ArrayT< T >::item_t ItemAtT(E idx, const T &t, typename ArrayT< T >::item_t t_unk)
Helper template function that returns item of array at given index or t_unk when index is out of boun...
std::string GetCurrentStructName()
Return structured name of the current class/structure.
static const char *const trackdir_names[]
Trackdir & TrackdirBits short names.
static uint TileY(TileIndex tile)
Get the Y component of a tile.
KNOWN_NAMES m_known_names
map of known object instances and their structured names
void WriteTile(const char *name, TileIndex t)
Write name & TileIndex to the output.
Used as a key into map of known object instances.
@ INVALID_TRACKDIR_BIT
Flag for an invalid trackdirbit value.
static uint TileX(TileIndex tile)
Get the X component of a tile.
SignalType
Type of signal, i.e.
std::stack< std::string > m_cur_struct
here we will track the current structure name
int m_indent
current indent/nesting level
@ INVALID_DIAGDIR
Flag for an invalid DiagDirection.
@ INVALID_TRACKDIR
Flag for an invalid trackdir.
DiagDirection
Enumeration for diagonal directions.
static const char *const diagdir_names[]
DiagDirection short names.
void WriteValue(const char *name, int value)
Write 'name = value' with indent and new-line.
std::string m_out
the output string
std::string ValueStr(Trackdir td)
Return name of given Trackdir.
static const char *const signal_type_names[]
SignalType short names.
void BeginStruct(size_t type_id, const char *name, const void *ptr)
Open new structure (one level deeper than the current one) 'name = {<LF>'.
Trackdir
Enumeration for tracks and directions.
std::string TileStr(TileIndex tile)
Translate TileIndex into string.