| 1168 | } |
| 1169 | |
| 1170 | bool Buildings::constructWithItems(df::building *bld, std::vector<df::item*> items) |
| 1171 | { |
| 1172 | CHECK_NULL_POINTER(bld); |
| 1173 | CHECK_INVALID_ARGUMENT(bld->id == -1); |
| 1174 | CHECK_INVALID_ARGUMENT(bld->isActual()); |
| 1175 | CHECK_INVALID_ARGUMENT(!items.empty() == needsItems(bld)); |
| 1176 | |
| 1177 | for (size_t i = 0; i < items.size(); i++) |
| 1178 | { |
| 1179 | CHECK_NULL_POINTER(items[i]); |
| 1180 | |
| 1181 | if (items[i]->flags.bits.in_job) |
| 1182 | return false; |
| 1183 | } |
| 1184 | |
| 1185 | df::job *job = NULL; |
| 1186 | if (!linkForConstruct(job, bld)) |
| 1187 | return false; |
| 1188 | |
| 1189 | bool rough = false; |
| 1190 | |
| 1191 | for (size_t i = 0; i < items.size(); i++) |
| 1192 | { |
| 1193 | Job::attachJobItem(job, items[i], df::job_role_type::Hauled); |
| 1194 | |
| 1195 | if (items[i]->getType() == item_type::BOULDER) |
| 1196 | rough = true; |
| 1197 | if (bld->mat_type == -1) |
| 1198 | bld->mat_type = items[i]->getMaterial(); |
| 1199 | if (bld->mat_index == -1) |
| 1200 | bld->mat_index = items[i]->getMaterialIndex(); |
| 1201 | } |
| 1202 | |
| 1203 | add_building_to_all_zones(bld); |
| 1204 | |
| 1205 | createDesign(bld, rough); |
| 1206 | return true; |
| 1207 | } |
| 1208 | |
| 1209 | bool Buildings::constructWithFilters(df::building *bld, std::vector<df::job_item*> items) |
| 1210 | { |
nothing calls this directly
no test coverage detected