| 12 | { |
| 13 | template<typename Object> |
| 14 | bool updateStationAnimation(const Animation& anim, StationType stationType) |
| 15 | { |
| 16 | auto tile = TileManager::get(anim.pos); |
| 17 | for (auto& el : tile) |
| 18 | { |
| 19 | auto* elStation = el.as<StationElement>(); |
| 20 | if (elStation == nullptr) |
| 21 | { |
| 22 | continue; |
| 23 | } |
| 24 | if (elStation->baseZ() != anim.baseZ) |
| 25 | { |
| 26 | continue; |
| 27 | } |
| 28 | if (elStation->stationType() != stationType) |
| 29 | { |
| 30 | continue; |
| 31 | } |
| 32 | |
| 33 | const auto* obj = ObjectManager::get<Object>(elStation->objectId()); |
| 34 | auto buildingParts = obj->getBuildingParts(elStation->buildingType()); |
| 35 | const auto animations = obj->getBuildingPartAnimations(); |
| 36 | bool hasAnimation = false; |
| 37 | uint8_t animSpeed = std::numeric_limits<uint8_t>::max(); |
| 38 | for (auto& part : buildingParts) |
| 39 | { |
| 40 | auto& partAnim = animations[part]; |
| 41 | if (partAnim.numFrames > 1) |
| 42 | { |
| 43 | hasAnimation = true; |
| 44 | animSpeed = std::min<uint8_t>(animSpeed, partAnim.animationSpeed & ~(1 << 7)); |
| 45 | } |
| 46 | } |
| 47 | if (!hasAnimation) |
| 48 | { |
| 49 | return true; |
| 50 | } |
| 51 | const auto speedMask = ((1 << animSpeed) - 1); |
| 52 | if (!(ScenarioManager::getScenarioTicks() & speedMask)) |
| 53 | { |
| 54 | Ui::ViewportManager::invalidate(anim.pos, el.baseHeight(), el.clearHeight(), ZoomLevel::quarter); |
| 55 | } |
| 56 | return false; |
| 57 | } |
| 58 | return true; |
| 59 | } |
| 60 | |
| 61 | // 0x004944B6 |
| 62 | bool updateDockStationAnimation(const Animation& anim) |
nothing calls this directly
no test coverage detected