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

Function scan_item

plugins/logistics.cpp:447–475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

445} bad_flags;
446
447static void scan_item(color_ostream &out, df::item *item, StockProcessor &processor) {
448 DEBUG(cycle,out).print("scan_item [{}] item_id={}\n", processor.name, item->id);
449
450 if (DBG_NAME(cycle).isEnabled(DebugCategory::LTRACE)) {
451 string name = "";
452 item->getItemDescription(&name, 0);
453 TRACE(cycle,out).print("item: {}\n", name);
454 }
455
456 if (processor.is_designated(out, item)) {
457 TRACE(cycle,out).print("already designated\n");
458 ++processor.stats.designated_counts[processor.stockpile_number];
459 return;
460 }
461
462 if (!processor.can_designate(out, item)) {
463 TRACE(cycle,out).print("cannot designate\n");
464 return;
465 }
466
467 if (!processor.enabled) {
468 ++processor.stats.can_designate_counts[processor.stockpile_number];
469 return;
470 }
471
472 processor.designate(out, item);
473 ++processor.stats.newly_designated;
474 ++processor.stats.designated_counts[processor.stockpile_number];
475}
476
477// quick check for type. this is intended to catch the case of newly empty storage item
478// that happens to still be on the stockpile. we can do a more careful check (e.g. including

Callers 1

scan_stockpileFunction · 0.70

Calls 4

printMethod · 0.45
is_designatedMethod · 0.45
can_designateMethod · 0.45
designateMethod · 0.45

Tested by

no test coverage detected