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

Function addStockpileLink

plugins/siege-engine.cpp:678–699  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

676}
677
678static bool addStockpileLink(df::building_siegeenginest *bld, df::building_stockpilest *pile)
679{
680 CHECK_NULL_POINTER(bld);
681 CHECK_NULL_POINTER(pile);
682 CHECK_INVALID_ARGUMENT(is_build_complete(bld));
683
684 if (!enable_plugin())
685 return false;
686
687 auto key = stl_sprintf("siege-engine/stockpiles/%d/%d", bld->id, pile->id);
688 auto entry = World::GetPersistentData(key, NULL);
689 if (!entry.isValid())
690 return false;
691
692 auto engine = find_engine(bld, true);
693
694 entry.ival(0) = bld->id;
695 entry.ival(1) = pile->id;
696
697 engine->stockpiles.insert(pile->id);
698 return true;
699}
700
701static bool removeStockpileLink(df::building_siegeenginest *bld, df::building_stockpilest *pile)
702{

Callers

nothing calls this directly

Calls 7

is_build_completeFunction · 0.85
stl_sprintfFunction · 0.85
find_engineFunction · 0.85
ivalMethod · 0.80
enable_pluginFunction · 0.70
isValidMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected