| 199 | } |
| 200 | |
| 201 | static df::unit_labor construction_build_labor(df::building_actual* b) |
| 202 | { |
| 203 | if (b->getType() == df::building_type::RoadPaved) |
| 204 | return df::unit_labor::BUILD_ROAD; |
| 205 | // Find last item in building with use mode appropriate to the building's constructions state |
| 206 | // For screw pumps contained_items[0] = pipe, 1 corkscrew, 2 block |
| 207 | // For wells 0 mechanism, 1 rope, 2 bucket, 3 block |
| 208 | // Trade depots and bridges use the last one too |
| 209 | // Must check use mode b/c buildings may have items in them that are not part of the building |
| 210 | |
| 211 | df::item* i = 0; |
| 212 | for (auto p = b->contained_items.begin(); p != b->contained_items.end(); p++) |
| 213 | if ((b->construction_stage > 0 && (*p)->use_mode == 2) || |
| 214 | (b->construction_stage == 0 && (*p)->use_mode == 0)) |
| 215 | i = (*p)->item; |
| 216 | |
| 217 | MaterialInfo matinfo; |
| 218 | if (i && matinfo.decode(i)) |
| 219 | { |
| 220 | if (matinfo.material->flags.is_set(df::material_flags::IS_METAL)) |
| 221 | return df::unit_labor::METAL_CRAFT; |
| 222 | if (matinfo.material->flags.is_set(df::material_flags::WOOD)) |
| 223 | return df::unit_labor::CARPENTER; |
| 224 | } |
| 225 | return df::unit_labor::MASON; |
| 226 | } |
| 227 | |
| 228 | |
| 229 | class jlfunc |