Go to the documentation of this file.
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");
uint32 TileIndex
The index/ID of a Tile.
static size_t & LastTypeId()
Keep track of the last assigned type_id.
void WriteIndent()
Write some leading spaces into the output.
TrackdirBits
Enumeration of bitmasks for the TrackDirs.
Blob based case sensitive ANSI/UTF-8 string.
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...
static const char *const trackdir_names[]
Trackdir & TrackdirBits short names.
void CDECL WriteLine(const char *format,...) WARN_FORMAT(2
Write a line with indent at the beginning and <LF> at the end.
static BlobHeader hdrEmpty[]
Just to silence an unsilencable GCC 4.4+ warning Note: This cannot be 'const' as we do a lot of 'hdrE...
static uint TileY(TileIndex tile)
Get the Y component of a tile.
char * GrowSizeNC(uint count)
Grow the actual buffer and fix the trailing zero at the end.
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.
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...
int m_indent
current indent/nesting level
size_t Size() const
Return number of items in the Blob.
bool FindKnownName(size_t type_id, const void *ptr, CStrA &name)
Find the given instance in our anti-recursion repository.
void AppendStr(const char *str)
Append zero-ended C string.
@ INVALID_DIAGDIR
Flag for an invalid DiagDirection.
@ INVALID_TRACKDIR
Flag for an invalid trackdir.
DiagDirection
Enumeration for diagonal directions.
int AddFormatL(const char *format, va_list args) WARN_FORMAT(2
Add formatted string (like vsprintf) at the end of existing contents.
std::stack< CStrA > m_cur_struct
here we will track the current structure name
void CDECL void WriteValue(const char *name, const char *value_str)
Write 'name = value' with indent and new-line.
CStrA TileStr(TileIndex tile)
Translate TileIndex into string.
static const char *const diagdir_names[]
DiagDirection short names.
CStrA GetCurrentStructName()
Return structured name of the current class/structure.
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>'.
CStrA m_out
the output string
Trackdir
Enumeration for tracks and directions.
CStrA ValueStr(Trackdir td)
Return name of given Trackdir.