| 1418 | } |
| 1419 | |
| 1420 | void Scenery::collapse(GameState &state) |
| 1421 | { |
| 1422 | // If it's already falling or destroyed or supported do nothing |
| 1423 | if (falling || !tileObject) |
| 1424 | { |
| 1425 | return; |
| 1426 | } |
| 1427 | // Level 0 can't collapse |
| 1428 | if (this->initialPosition.z <= 1) |
| 1429 | { |
| 1430 | this->damaged = true; |
| 1431 | LogWarning("Scenery at %s type %s can't fall as below 2", currentPosition, type.id); |
| 1432 | } |
| 1433 | else |
| 1434 | { |
| 1435 | LogWarning("Scenery at %s type %s now falling", currentPosition, type.id); |
| 1436 | falling = true; |
| 1437 | // state.current_battle->queueVisionRefresh(position); |
| 1438 | // state.current_battle->queuePathfindingRefresh(position); |
| 1439 | // Note: Pathfinding refresh relies on tile's battlescape parameters being updated |
| 1440 | // before it happens, so that battlescape parameters already account for the |
| 1441 | // now dysfunctional map part. Pathfinding update will only happen |
| 1442 | // after we call setPosition() on the map part, which will |
| 1443 | // call update to the battlescape parameters of the tile, which will |
| 1444 | // in turn make us ignore the falling map part properly |
| 1445 | // If we would somehow call collapse() in a way that would set falling to true but |
| 1446 | // would not trigger the setPosition() afterwards, this logic would fail |
| 1447 | } |
| 1448 | ceaseBeingSupported(); |
| 1449 | ceaseSupportProvision(); |
| 1450 | if (building) |
| 1451 | { |
| 1452 | building->buildingPartChange(state, initialPosition, false); |
| 1453 | } |
| 1454 | city->notifyRoadChange(initialPosition, false); |
| 1455 | } |
| 1456 | |
| 1457 | void Scenery::update(GameState &state, unsigned int ticks) |
| 1458 | { |
no test coverage detected