| 483 | } |
| 484 | |
| 485 | static command_result setThresholds(color_ostream& out, std::vector<std::string>& parameters) |
| 486 | { |
| 487 | int val = atoi(parameters[1].c_str()); |
| 488 | for (size_t i = 2; i < parameters.size(); i++) |
| 489 | { |
| 490 | std::string id = parameters[i]; |
| 491 | std::transform(id.begin(), id.end(), id.begin(), ::toupper); |
| 492 | |
| 493 | bool ok = false; |
| 494 | for (auto plant : world->raws.plants.all) |
| 495 | { |
| 496 | if (plant->flags.is_set(df::plant_raw_flags::SEED) && (plant->id == id)) |
| 497 | { |
| 498 | autofarmInstance->setThreshold(plant->index, val); |
| 499 | ok = true; |
| 500 | break; |
| 501 | } |
| 502 | } |
| 503 | if (!ok) |
| 504 | { |
| 505 | out << "Cannot find plant with id " << id << '\n' << std::flush; |
| 506 | return CR_WRONG_USAGE; |
| 507 | } |
| 508 | } |
| 509 | autofarmInstance->save_state(out); |
| 510 | return CR_OK; |
| 511 | } |
| 512 | |
| 513 | static command_result autofarm(color_ostream& out, std::vector<std::string>& parameters) |
| 514 | { |
no test coverage detected