0x00438747
| 1012 | |
| 1013 | // 0x00438747 |
| 1014 | static uint8_t applyBeTopProgressModifiers(const uint8_t progress, const Scenario::Objective& objective, const Company& company) |
| 1015 | { |
| 1016 | if ((objective.flags & (Scenario::ObjectiveFlags::beTopCompany | Scenario::ObjectiveFlags::beWithinTopThreeCompanies)) == Scenario::ObjectiveFlags::none) |
| 1017 | { |
| 1018 | return progress; |
| 1019 | } |
| 1020 | |
| 1021 | auto numCompaniesBetterPerforming = 0U; |
| 1022 | for (auto& otherCompany : CompanyManager::companies()) |
| 1023 | { |
| 1024 | if (otherCompany.id() == company.id()) |
| 1025 | { |
| 1026 | continue; |
| 1027 | } |
| 1028 | if (company.performanceIndex < otherCompany.performanceIndex) |
| 1029 | { |
| 1030 | numCompaniesBetterPerforming++; |
| 1031 | } |
| 1032 | } |
| 1033 | |
| 1034 | if ((objective.flags & Scenario::ObjectiveFlags::beTopCompany) != Scenario::ObjectiveFlags::none) |
| 1035 | { |
| 1036 | if (numCompaniesBetterPerforming != 0) |
| 1037 | { |
| 1038 | return std::max(progress - 10, 0); |
| 1039 | } |
| 1040 | return progress; |
| 1041 | } |
| 1042 | if ((objective.flags & Scenario::ObjectiveFlags::beWithinTopThreeCompanies) != Scenario::ObjectiveFlags::none) |
| 1043 | { |
| 1044 | if (numCompaniesBetterPerforming >= 3) |
| 1045 | { |
| 1046 | // Reduces progress by 10% for each company outside of top 3 better performing than the player |
| 1047 | // Caps out at 30% reduction |
| 1048 | const auto multiplier = std::min(numCompaniesBetterPerforming - 2, 3U); |
| 1049 | return static_cast<uint8_t>(std::max(progress - 10 * multiplier, 0U)); |
| 1050 | } |
| 1051 | return progress; |
| 1052 | } |
| 1053 | return progress; |
| 1054 | } |
| 1055 | |
| 1056 | // 0x004385F6 |
| 1057 | uint8_t Company::getNewChallengeProgress() const |
no test coverage detected