| 496 | } |
| 497 | |
| 498 | static bool constructionIsUnsupported(color_ostream &out, df::job* job) |
| 499 | { |
| 500 | if (!isConstructionJob(job)) |
| 501 | return false; |
| 502 | |
| 503 | auto building = Job::getHolder(job); |
| 504 | if (!building || building->getType() != df::building_type::Construction) |
| 505 | return false; |
| 506 | |
| 507 | TRACE(cycle,out).print("check (construction) construction job {} for support\n", job->id); |
| 508 | |
| 509 | coord pos(building->centerx,building->centery,building->z); |
| 510 | |
| 511 | // if no neighbour is walkable, it can't be constructed now anyways |
| 512 | if (!hasWalkableNeighbor(pos)) |
| 513 | return false; |
| 514 | |
| 515 | |
| 516 | |
| 517 | auto constr_type = building->getSubtype(); |
| 518 | |
| 519 | const vector<offset> *wall_would_support, *floor_would_support; |
| 520 | vector<offset> supportbld_would_support; |
| 521 | |
| 522 | if (construction_floor_support[constr_type]){ |
| 523 | wall_would_support = &neighboursWallSupportsFloor; |
| 524 | floor_would_support = &neighboursFloorSupportsFloor; |
| 525 | supportbld_would_support = vector<offset>{offset(0,0,-1)}; |
| 526 | } else if (construction_wall_support[constr_type]){ |
| 527 | wall_would_support = &neighboursWallSupportsWall; |
| 528 | floor_would_support = &neighboursFloorSupportsWall; |
| 529 | supportbld_would_support = vector<offset>{offset(0,0,-1), offset(0,0,+1)}; |
| 530 | } else { |
| 531 | return false; // some unknown construction - don't suspend |
| 532 | } |
| 533 | |
| 534 | for (auto npos : *wall_would_support | transform(around(pos))) |
| 535 | if (tileHasSupportWall(npos)) return false; |
| 536 | for (auto npos : *floor_would_support | transform(around(pos))) |
| 537 | if (tileHasSupportFloor(npos)) return false; |
| 538 | for (auto npos : supportbld_would_support | transform(around(pos))) |
| 539 | if (tileHasSupportBuilding(npos)) return false; |
| 540 | |
| 541 | return true; |
| 542 | } |
| 543 | |
| 544 | void suspendBuilding(df::building *building, Reason reason){ |
| 545 | for (auto job : building->jobs) |