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

Function checkRaceStocksTotal

plugins/autobutcher.cpp:754–766  ·  view source on GitHub ↗

abuse WatchedRace struct for counting stocks (since it sorts by gender and age) calling method must delete pointer!

Source from the content-addressed store, hash-verified

752// abuse WatchedRace struct for counting stocks (since it sorts by gender and age)
753// calling method must delete pointer!
754static WatchedRace * checkRaceStocksTotal(color_ostream &out, int race) {
755 WatchedRace * w = new WatchedRace(out, race, true, 0, 0, 0, 0);
756 for (auto unit : world->units.active) {
757 if (unit->race != race)
758 continue;
759
760 if (isInappropriateUnit(unit))
761 continue;
762
763 w->PushButcherableUnit(unit);
764 }
765 return w;
766}
767
768WatchedRace * checkRaceStocksProtected(color_ostream &out, int race) {
769 WatchedRace * w = new WatchedRace(out, race, true, 0, 0, 0, 0);

Callers 1

autobutcher_getWatchListFunction · 0.85

Calls 2

isInappropriateUnitFunction · 0.85
PushButcherableUnitMethod · 0.80

Tested by

no test coverage detected