0x00438047 Returns a string between 1810 and 1816 with up to two arguments.
| 914 | // 0x00438047 |
| 915 | // Returns a string between 1810 and 1816 with up to two arguments. |
| 916 | StringId getOwnerStatus(CompanyId id, FormatArguments& args) |
| 917 | { |
| 918 | auto* company = get(id); |
| 919 | if (company == nullptr) |
| 920 | { |
| 921 | return StringIds::company_status_empty; |
| 922 | } |
| 923 | |
| 924 | if ((company->challengeFlags & CompanyFlags::bankrupt) != CompanyFlags::none) |
| 925 | { |
| 926 | return StringIds::company_status_bankrupt; |
| 927 | } |
| 928 | |
| 929 | const StringId observationStatusStrings[] = { |
| 930 | StringIds::company_status_empty, |
| 931 | StringIds::company_status_building_track_road, |
| 932 | StringIds::company_status_building_airport, |
| 933 | StringIds::company_status_building_dock, |
| 934 | StringIds::company_status_checking_services, |
| 935 | StringIds::company_status_surveying_landscape, |
| 936 | }; |
| 937 | |
| 938 | StringId statusString = observationStatusStrings[company->observationStatus]; |
| 939 | if (company->observationStatus == ObservationStatus::empty || company->observationTownId == TownId::null) |
| 940 | { |
| 941 | return StringIds::company_status_empty; |
| 942 | } |
| 943 | |
| 944 | switch (company->observationStatus) |
| 945 | { |
| 946 | case ObservationStatus::buildingTrackRoad: |
| 947 | if (company->observationObject & 0x80) |
| 948 | { |
| 949 | auto* obj = ObjectManager::get<RoadObject>(company->observationObject & 0xFF7F); |
| 950 | if (obj != nullptr) |
| 951 | { |
| 952 | args.push(obj->name); |
| 953 | } |
| 954 | } |
| 955 | else |
| 956 | { |
| 957 | auto* obj = ObjectManager::get<TrackObject>(company->observationObject); |
| 958 | if (obj != nullptr) |
| 959 | { |
| 960 | args.push(obj->name); |
| 961 | } |
| 962 | } |
| 963 | break; |
| 964 | |
| 965 | case ObservationStatus::buildingAirport: |
| 966 | { |
| 967 | auto* obj = ObjectManager::get<AirportObject>(company->observationObject); |
| 968 | if (obj != nullptr) |
| 969 | { |
| 970 | args.push(obj->name); |
| 971 | } |
| 972 | break; |
| 973 | } |
no test coverage detected