| 779 | } |
| 780 | |
| 781 | CompanyId getTileOwner(const World::TileElement& el) |
| 782 | { |
| 783 | CompanyId owner = CompanyId::null; |
| 784 | |
| 785 | if (auto* elTrack = el.as<TrackElement>(); |
| 786 | elTrack != nullptr) |
| 787 | { |
| 788 | owner = elTrack->owner(); |
| 789 | } |
| 790 | else if (auto* elRoad = el.as<RoadElement>(); |
| 791 | elRoad != nullptr) |
| 792 | { |
| 793 | owner = elRoad->owner(); |
| 794 | } |
| 795 | else if (auto* elStation = el.as<StationElement>(); |
| 796 | elStation != nullptr) |
| 797 | { |
| 798 | if (elStation->stationType() == StationType::trainStation) |
| 799 | { |
| 800 | if (auto* prevElTrack = el.prev()->as<TrackElement>(); |
| 801 | prevElTrack != nullptr) |
| 802 | { |
| 803 | owner = prevElTrack->owner(); |
| 804 | } |
| 805 | } |
| 806 | else if (elStation->stationType() == StationType::roadStation) |
| 807 | { |
| 808 | if (auto* prevElRoad = el.prev()->as<RoadElement>(); |
| 809 | prevElRoad != nullptr) |
| 810 | { |
| 811 | owner = prevElRoad->owner(); |
| 812 | } |
| 813 | } |
| 814 | else |
| 815 | { |
| 816 | owner = elStation->owner(); |
| 817 | } |
| 818 | } |
| 819 | else if (auto* elSignal = el.as<SignalElement>(); |
| 820 | elSignal != nullptr) |
| 821 | { |
| 822 | if (auto* prevElTrack = el.prev()->as<TrackElement>(); |
| 823 | prevElTrack != nullptr) |
| 824 | { |
| 825 | owner = prevElTrack->owner(); |
| 826 | } |
| 827 | } |
| 828 | return owner; |
| 829 | } |
| 830 | |
| 831 | // 0x004CBE5F |
| 832 | // regs.ax: pos.x |
no test coverage detected