| 197 | } |
| 198 | |
| 199 | void ScriptText::_FillParamList(ParamList ¶ms, ScriptTextList &seen_texts) |
| 200 | { |
| 201 | if (std::ranges::find(seen_texts, this) != seen_texts.end()) throw Script_FatalError(fmt::format("{}: Circular reference detected", GetGameStringName(this->string))); |
| 202 | seen_texts.push_back(this); |
| 203 | |
| 204 | for (int idx = 0; Param &p : this->param) { |
| 205 | params.emplace_back(this->string, idx, &p); |
| 206 | ++idx; |
| 207 | if (!std::holds_alternative<ScriptTextRef>(p)) continue; |
| 208 | std::get<ScriptTextRef>(p)->_FillParamList(params, seen_texts); |
| 209 | } |
| 210 | |
| 211 | seen_texts.pop_back(); |
| 212 | |
| 213 | /* Fill with dummy parameters to match old FormatString() compatibility behaviour. */ |
| 214 | if (seen_texts.empty() && ScriptText::pad_parameter_count > 0) { |
| 215 | static Param dummy = {}; |
| 216 | for (int idx = static_cast<int>(std::size(this->param)); idx < ScriptText::pad_parameter_count; ++idx) { |
| 217 | params.emplace_back(StringIndexInTab(-1), idx, &dummy); |
| 218 | } |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | void ScriptText::ParamCheck::Encode(StringBuilder &builder, std::string_view cmd) |
| 223 | { |
no test coverage detected