| 191 | } |
| 192 | |
| 193 | static command_result job_material_in_build(color_ostream &out, MaterialInfo &new_mat) |
| 194 | { |
| 195 | df::ui_build_selector *sel = ui_build_selector; |
| 196 | df::ui_build_item_req *req = sel->requirements[ui_build_selector->req_index]; |
| 197 | |
| 198 | // Loop through matching choices |
| 199 | bool matches = build_choice_matches(req, sel->choices[sel->sel_index], new_mat, true); |
| 200 | |
| 201 | size_t size = sel->choices.size(); |
| 202 | int base = (matches ? sel->sel_index + 1 : 0); |
| 203 | |
| 204 | for (size_t i = 0; i < size; i++) |
| 205 | { |
| 206 | int idx = (base + i) % size; |
| 207 | |
| 208 | if (build_choice_matches(req, sel->choices[idx], new_mat, false)) |
| 209 | { |
| 210 | sel->sel_index = idx; |
| 211 | return CR_OK; |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | out.printerr("Could not find material in list: {}\n", new_mat.toString()); |
| 216 | return CR_FAILURE; |
| 217 | } |
| 218 | |
| 219 | static command_result job_material(color_ostream &out, vector <string> & parameters) |
| 220 | { |
no test coverage detected