0x004929DB
| 816 | |
| 817 | // 0x004929DB |
| 818 | void Station::updateCargoDistribution() |
| 819 | { |
| 820 | invalidateWindow(); |
| 821 | WindowManager::invalidate(Ui::WindowType::stationList); |
| 822 | bool hasChanged = false; |
| 823 | for (uint8_t i = 0; i < kMaxCargoStats; ++i) |
| 824 | { |
| 825 | auto& stationCargo = cargoStats[i]; |
| 826 | auto newDensity = 0; |
| 827 | if (stationCargo.quantity != 0) |
| 828 | { |
| 829 | if (stationTileSize != 0) |
| 830 | { |
| 831 | newDensity = stationCargo.quantity / stationTileSize; |
| 832 | auto* cargoObj = ObjectManager::get<CargoObject>(i); |
| 833 | newDensity += (1 << cargoObj->stationCargoDensity) - 1; |
| 834 | newDensity >>= cargoObj->stationCargoDensity; |
| 835 | |
| 836 | newDensity = std::min<int32_t>(newDensity, Limits::kMaxStationCargoDensity); |
| 837 | } |
| 838 | } |
| 839 | if (stationCargo.densityPerTile != newDensity) |
| 840 | { |
| 841 | stationCargo.densityPerTile = newDensity; |
| 842 | hasChanged = true; |
| 843 | } |
| 844 | } |
| 845 | |
| 846 | if (hasChanged) |
| 847 | { |
| 848 | for (auto i = 0; i < stationTileSize; ++i) |
| 849 | { |
| 850 | const auto& tile = stationTiles[i]; |
| 851 | Ui::ViewportManager::invalidate({ tile.x, tile.y }, World::heightFloor(tile.z), World::heightFloor(tile.z) + 32, ZoomLevel::full); |
| 852 | } |
| 853 | } |
| 854 | } |
| 855 | |
| 856 | struct StationBorder |
| 857 | { |
no test coverage detected