/** * Helper for creating a human readable output of this data. * @param dmp The location to dump to. */ template <typename D> void Dump(D &dmp) const { dmp.WriteLine("capacity = %d", Tcapacity); uint num_items = Length(); dmp.WriteLine("num_items = %d", num_items); CStrA name; for (uint i = 0; i < num_items; i++) { const T& item = (*this)[i]; name.Format("item[%d]", i); dmp.WriteStructT(name.Data(), &item); } }
/** Translate TileIndex into string. */ CStrA TileStr(TileIndex tile) { CStrA out; out.Format("0x%04X (%d, %d)", tile, TileX(tile), TileY(tile)); return out.Transfer(); }
/** Return name of given SignalType. */ CStrA ValueStr(SignalType t) { CStrA out; out.Format("%d (%s)", t, ItemAtT(t, signal_type_names, "UNK")); return out.Transfer(); }
/** Return name of given DiagDirection. */ CStrA ValueStr(DiagDirection dd) { CStrA out; out.Format("%d (%s)", dd, ItemAtT(dd, diagdir_names, "UNK", INVALID_DIAGDIR, "INV")); return out.Transfer(); }
/** Return composed name of given TrackdirBits. */ CStrA ValueStr(TrackdirBits td_bits) { CStrA out; out.Format("%d (%s)", td_bits, ComposeNameT(td_bits, trackdir_names, "UNK", INVALID_TRACKDIR_BIT, "INV").Data()); return out.Transfer(); }
/** Return name of given Trackdir. */ CStrA ValueStr(Trackdir td) { CStrA out; out.Format("%d (%s)", td, ItemAtT(td, trackdir_names, "UNK", INVALID_TRACKDIR, "INV")); return out.Transfer(); }