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

Function seedwatch_setTarget

plugins/seedwatch.cpp:369–394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

367};
368
369static void seedwatch_setTarget(color_ostream &out, string name, int32_t num) {
370 DEBUG(control,out).print("entering seedwatch_setTarget\n");
371
372 if (num < 0) {
373 out.printerr("target must be at least 0\n");
374 return;
375 }
376
377 if (name == "all") {
378 for (auto &entry : world_plant_ids) {
379 set_target(out, entry.second, num);
380 }
381 return;
382 }
383
384 string token = searchAbbreviations(name);
385 if (!world_plant_ids.count(token)) {
386 token = toUpper_cp437(token);
387 if (!world_plant_ids.count(token)) {
388 out.printerr("{} has not been found as a material.\n", token);
389 return;
390 }
391 }
392
393 set_target(out, world_plant_ids[token], num);
394}
395
396static int seedwatch_getData(lua_State *L) {
397 color_ostream *out = Lua::GetOutput(L);

Callers 1

Calls 5

set_targetFunction · 0.85
searchAbbreviationsFunction · 0.85
toUpper_cp437Function · 0.85
printMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected