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

Function map_job_constraints

plugins/workflow.cpp:926–963  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

924}
925
926static void map_job_constraints(color_ostream &out)
927{
928 melt_active = false;
929
930 for (size_t i = 0; i < constraints.size(); i++)
931 {
932 constraints[i]->jobs.clear();
933 constraints[i]->is_active = false;
934 }
935
936 auto L = Lua::Core::State;
937 Lua::StackUnwinder frame(L);
938
939 bool ok = Lua::PushModulePublic(out, L, "plugins.workflow", "doEnumJobOutputs");
940 if (!ok)
941 out.printerr("The workflow lua module is not available.\n");
942
943 for (TKnownJobs::const_iterator it = known_jobs.begin(); it != known_jobs.end(); ++it)
944 {
945 ProtectedJob *pj = it->second;
946
947 pj->constraints.clear();
948
949 if (!ok || !pj->isLive())
950 continue;
951
952 if (!melt_active && pj->actual_job->job_type == job_type::MeltMetalObject)
953 melt_active = pj->isResumed();
954
955 // Call the lua module
956 lua_pushvalue(L, -1);
957 lua_pushlightuserdata(L, pj);
958 lua_pushcclosure(L, cbEnumJobOutputs, 1);
959 Lua::PushDFObject(L, pj->job_copy);
960
961 Lua::SafeCall(out, L, 2, 0);
962 }
963}
964
965/******************************
966 * ITEM-CONSTRAINT MAPPING *

Callers 2

process_constraintsFunction · 0.85
update_data_structuresFunction · 0.85

Calls 12

PushModulePublicFunction · 0.85
lua_pushvalueFunction · 0.85
lua_pushlightuserdataFunction · 0.85
lua_pushcclosureFunction · 0.85
PushDFObjectFunction · 0.85
SafeCallFunction · 0.85
isLiveMethod · 0.80
isResumedMethod · 0.80
sizeMethod · 0.45
clearMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected