| 367 | }; |
| 368 | |
| 369 | static 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 | |
| 396 | static int seedwatch_getData(lua_State *L) { |
| 397 | color_ostream *out = Lua::GetOutput(L); |
no test coverage detected