12 #include "../stdafx.h" 13 #include "../rail_map.h" 16 #include "../safeguards.h" 20 "NE",
"SE",
"UE",
"LE",
"LS",
"RS",
"rne",
"rse",
21 "SW",
"NW",
"UW",
"LW",
"LN",
"RN",
"rsw",
"rnw",
29 return out.Transfer();
37 return out.Transfer();
43 "NE",
"SE",
"SW",
"NW",
51 return out.Transfer();
57 "NORMAL",
"ENTRY",
"EXIT",
"COMBO",
"PBS",
"NOENTRY",
65 return out.Transfer();
73 out.Format(
"0x%04X (%d, %d)", tile,
TileX(tile),
TileY(tile));
74 return out.Transfer();
81 static size_t last_type_id = 0;
93 return out.Transfer();
115 if (num_spaces > 0) {
125 va_start(args, format);
135 m_out.AddFormat(
"%s = %s\n", name, value_str);
142 m_out.AddFormat(
"%s = %s\n", name,
TileStr(tile).Data());
152 if (cur_name.
Size() > 0) {
165 m_out.AddFormat(
"%s = {\n", name);
176 m_out.AddFormat(
"}\n");
CStrA m_out
the output string
SignalType
Type of signal, i.e.
CStrA 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...
CStrA ValueStr(Trackdir td)
Return name of given Trackdir.
Flag for an invalid DiagDirection.
Flag for an invalid trackdirbit value.
void CDECL WriteLine(const char *format,...) WARN_FORMAT(2
Write a line with indent at the beginning and <LF> at the end.
static uint TileX(TileIndex tile)
Get the X component of a tile.
int AddFormatL(const char *format, va_list args)
Add formated string (like vsprintf) at the end of existing contents.
void WriteTile(const char *name, TileIndex t)
Write name & TileIndex to the output.
void EndStruct()
Close structure '}<LF>'.
Used as a key into map of known object instances.
Functions to be used for debug printings.
KNOWN_NAMES m_known_names
map of known object instances and their structured names
Blob based case sensitive ANSI/UTF-8 string.
int m_indent
current indent/nesting level
bool FindKnownName(size_t type_id, const void *ptr, CStrA &name)
Find the given instance in our anti-recursion repository.
Trackdir
Enumeration for tracks and directions.
char * GrowSizeNC(uint count)
Grow the actual buffer and fix the trailing zero at the end.
std::stack< CStrA > m_cur_struct
here we will track the current structure name
DiagDirection
Enumeration for diagonal directions.
static BlobHeader hdrEmpty[]
Just to silence an unsilencable GCC 4.4+ warning Note: This cannot be 'const' as we do a lot of 'hdrE...
CStrA TileStr(TileIndex tile)
Translate TileIndex into string.
void BeginStruct(size_t type_id, const char *name, const void *ptr)
Open new structure (one level deeper than the current one) 'name = {<LF>'.
CStrA GetCurrentStructName()
Return structured name of the current class/structure.
void CDECL void WriteValue(const char *name, const char *value_str)
Write 'name = value' with indent and new-line.
uint32 TileIndex
The index/ID of a Tile.
static uint TileY(TileIndex tile)
Get the Y component of a tile.
TrackdirBits
Enumeration of bitmasks for the TrackDirs.
static const char *const trackdir_names[]
Trackdir & TrackdirBits short names.
Flag for an invalid trackdir.
void WriteIndent()
Write some leading spaces into the output.
size_t Size() const
Return number of items in the Blob.
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...
static const char *const signal_type_names[]
SignalType short names.
void AppendStr(const char *str)
Append zero-ended C string.
static size_t & LastTypeId()
Keep track of the last assigned type_id.
static const char *const diagdir_names[]
DiagDirection short names.