* Prints active gamelog * @param proc the procedure to draw with */
| 145 | * @param proc the procedure to draw with |
| 146 | */ |
| 147 | void 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) |
no test coverage detected