10 #include "../stdafx.h" 11 #include "../rail_map.h" 14 #include "../safeguards.h" 18 "NE",
"SE",
"UE",
"LE",
"LS",
"RS",
"rne",
"rse",
19 "SW",
"NW",
"UW",
"LW",
"LN",
"RN",
"rsw",
"rnw",
27 return out.Transfer();
35 return out.Transfer();
41 "NE",
"SE",
"SW",
"NW",
49 return out.Transfer();
55 "NORMAL",
"ENTRY",
"EXIT",
"COMBO",
"PBS",
"NOENTRY",
63 return out.Transfer();
71 out.Format(
"0x%04X (%d, %d)", tile,
TileX(tile),
TileY(tile));
72 return out.Transfer();
79 static size_t last_type_id = 0;
91 return out.Transfer();
113 if (num_spaces > 0) {
123 va_start(args, format);
133 m_out.AddFormat(
"%s = %s\n", name, value_str);
140 m_out.AddFormat(
"%s = %s\n", name,
TileStr(tile).Data());
150 if (cur_name.
Size() > 0) {
163 m_out.AddFormat(
"%s = {\n", name);
174 m_out.AddFormat(
"}\n");
CStrA m_out
the output string
TrackdirBits
Enumeration of bitmasks for the TrackDirs.
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.
Trackdir
Enumeration for tracks and directions.
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 formatted string (like vsprintf) at the end of existing contents.
void WriteTile(const char *name, TileIndex t)
Write name & TileIndex to the output.
Flag for an invalid DiagDirection.
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
Flag for an invalid trackdir.
bool FindKnownName(size_t type_id, const void *ptr, CStrA &name)
Find the given instance in our anti-recursion repository.
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
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.
static const char *const trackdir_names[]
Trackdir & TrackdirBits short names.
DiagDirection
Enumeration for diagonal directions.
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...
Flag for an invalid trackdirbit value.
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.