MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetDriversInfo

Method GetDriversInfo

src/driver.cpp:221–237  ·  view source on GitHub ↗

* Build a human readable list of available drivers, grouped by type. * @param output_iterator The iterator to write the string to. */

Source from the content-addressed store, hash-verified

219 * @param output_iterator The iterator to write the string to.
220 */
221void DriverFactoryBase::GetDriversInfo(std::back_insert_iterator<std::string> &output_iterator)
222{
223 for (Driver::Type type = Driver::DT_BEGIN; type != Driver::DT_END; type++) {
224 fmt::format_to(output_iterator, "List of {} drivers:\n", GetDriverTypeName(type));
225
226 for (int priority = 10; priority >= 0; priority--) {
227 for (auto &it : GetDrivers()) {
228 DriverFactoryBase *d = it.second;
229 if (d->type != type) continue;
230 if (d->priority != priority) continue;
231 fmt::format_to(output_iterator, "{:>18}: {}\n", d->name, d->GetDescription());
232 }
233 }
234
235 fmt::format_to(output_iterator, "\n");
236 }
237}
238
239/**
240 * Construct a new DriverFactory.

Callers

nothing calls this directly

Calls 2

format_toFunction · 0.50
GetDescriptionMethod · 0.45

Tested by

no test coverage detected