0x004385F6
| 1055 | |
| 1056 | // 0x004385F6 |
| 1057 | uint8_t Company::getNewChallengeProgress() const |
| 1058 | { |
| 1059 | if ((challengeFlags & CompanyFlags::challengeCompleted) != CompanyFlags::none) |
| 1060 | { |
| 1061 | return 100; |
| 1062 | } |
| 1063 | |
| 1064 | if ((challengeFlags & (CompanyFlags::challengeFailed | CompanyFlags::challengeBeatenByOpponent)) != CompanyFlags::none) |
| 1065 | { |
| 1066 | return 255; |
| 1067 | } |
| 1068 | |
| 1069 | auto& objectiveProgress = Scenario::getObjectiveProgress(); |
| 1070 | auto& objective = Scenario::getObjective(); |
| 1071 | if ((challengeFlags & CompanyFlags::unk2) != CompanyFlags::none) |
| 1072 | { |
| 1073 | if (objectiveProgress.timeLimitUntilYear < getCurrentYear() && getCurrentMonth() != MonthId::january) |
| 1074 | { |
| 1075 | return 255; |
| 1076 | } |
| 1077 | } |
| 1078 | |
| 1079 | uint8_t progress = 0U; |
| 1080 | switch (objective.type) |
| 1081 | { |
| 1082 | case Scenario::ObjectiveType::companyValue: |
| 1083 | { |
| 1084 | const auto curMonthValue = companyValueHistory[0]; |
| 1085 | if (curMonthValue >= currency32_t(objective.companyValue)) |
| 1086 | { |
| 1087 | return 100; |
| 1088 | } |
| 1089 | return curMonthValue.asInt64() / (objective.companyValue / 100); |
| 1090 | } |
| 1091 | case Scenario::ObjectiveType::vehicleProfit: |
| 1092 | { |
| 1093 | if (vehicleProfit <= 0) |
| 1094 | { |
| 1095 | return 0; |
| 1096 | } |
| 1097 | |
| 1098 | if (vehicleProfit >= currency32_t(objective.monthlyVehicleProfit)) |
| 1099 | { |
| 1100 | progress = 100; |
| 1101 | break; |
| 1102 | } |
| 1103 | progress = vehicleProfit.asInt64() / (objective.monthlyVehicleProfit / 100); |
| 1104 | break; |
| 1105 | } |
| 1106 | case Scenario::ObjectiveType::performanceIndex: |
| 1107 | { |
| 1108 | if (objective.performanceIndex * 10 <= performanceIndex) |
| 1109 | { |
| 1110 | progress = 100; |
| 1111 | break; |
| 1112 | } |
| 1113 | progress = (performanceIndex * 10) / objective.performanceIndex; |
| 1114 | break; |
nothing calls this directly
no test coverage detected