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

Method Print

src/gamelog.cpp:147–168  ·  view source on GitHub ↗

* Prints active gamelog * @param proc the procedure to draw with */

Source from the content-addressed store, hash-verified

145 * @param proc the procedure to draw with
146 */
147void Gamelog::Print(std::function<void(const std::string &)> proc)
148{
149 GrfIDMapping grf_names;
150
151 proc("---- gamelog start ----");
152
153 for (const LoggedAction &la : this->data->action) {
154 assert(la.at < GLAT_END);
155
156 proc(fmt::format("Tick {}: {}", la.tick, la_text[la.at]));
157
158 for (auto &lc : la.change) {
159 std::string message;
160 auto output_iterator = std::back_inserter(message);
161 lc->FormatTo(output_iterator, grf_names, la.at);
162
163 proc(message);
164 }
165 }
166
167 proc("---- gamelog end ----");
168}
169
170
171/* virtual */ void LoggedChangeMode::FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &, GamelogActionType)

Callers 3

PrintConsoleMethod · 0.95
PrintDebugMethod · 0.95
SurveyGamelogFunction · 0.45

Calls 2

FormatToMethod · 0.80
formatFunction · 0.50

Tested by

no test coverage detected