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

Function linkForConstruct

library/modules/Buildings.cpp:1126–1152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1124}
1125
1126static bool linkForConstruct(df::job* &job, df::building *bld)
1127{
1128 if (!checkBuildingTiles(bld, false))
1129 return false;
1130
1131 auto ref = df::allocate<df::general_ref_building_holderst>();
1132 if (!ref)
1133 {
1134 Core::printerr("Could not allocate general_ref_building_holderst\n");
1135 return false;
1136 }
1137
1138 linkBuilding(bld);
1139
1140 ref->building_id = bld->id;
1141
1142 job = new df::job();
1143 job->job_type = df::job_type::ConstructBuilding;
1144 job->pos = df::coord(bld->centerx, bld->centery, bld->z);
1145 job->general_refs.push_back(ref);
1146
1147 bld->jobs.push_back(job);
1148
1149 Job::linkIntoWorld(job);
1150
1151 return true;
1152}
1153
1154static bool needsItems(df::building *bld)
1155{

Callers 2

constructWithItemsMethod · 0.85
constructWithFiltersMethod · 0.85

Calls 3

checkBuildingTilesFunction · 0.85
linkBuildingFunction · 0.85
printerrFunction · 0.50

Tested by

no test coverage detected