| 225 | } |
| 226 | |
| 227 | static bool assignUnitToZone(color_ostream &out, df::unit *unit, df::building_civzonest *zone) { |
| 228 | auto ref = createCivzoneRef(); |
| 229 | if (!ref) { |
| 230 | ERR(cycle,out).print("Could not create activity zone reference!\n"); |
| 231 | return false; |
| 232 | } |
| 233 | |
| 234 | ref->building_id = zone->id; |
| 235 | unit->general_refs.push_back(ref); |
| 236 | zone->assigned_units.push_back(unit->id); |
| 237 | |
| 238 | INFO(cycle,out).print("Unit {} ({}) assigned to nestbox zone {} ({})\n", |
| 239 | unit->id, Units::getRaceName(unit), |
| 240 | zone->id, zone->name); |
| 241 | |
| 242 | return true; |
| 243 | } |
| 244 | |
| 245 | // also assigns units to zone if they have already claimed the nestbox |
| 246 | // and are not assigned elsewhere; returns number assigned |
no test coverage detected