MCPcopy Create free account
hub / github.com/DFHack/dfhack / setThresholds

Function setThresholds

plugins/autofarm.cpp:485–511  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

483}
484
485static 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
513static command_result autofarm(color_ostream& out, std::vector<std::string>& parameters)
514{

Callers 1

autofarmFunction · 0.85

Calls 7

c_strMethod · 0.80
is_setMethod · 0.80
setThresholdMethod · 0.80
save_stateMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected