SHOW:
|
|
- or go back to the newest paste.
| 1 | /* Best guess lifetime profits based on vehicle age and last year profits */ | |
| 2 | if (IsSavegameVersionBefore(SLV_LIFETIME_PROFIT)) {
| |
| 3 | for (Vehicle *v : Vehicle::Iterate()) {
| |
| 4 | /* Renewing vehicles resets lifetime profits to zero and | |
| 5 | * inherits last year profits from their past vehicles. | |
| 6 | * Using their last year profits to best guess lifetime | |
| 7 | * profits falls into the wrong side, unless the vehicles | |
| 8 | * have already gone through one entire calendar year. */ | |
| 9 | YearMonthDay cur_date; | |
| 10 | ConvertDateToYMD(_date, &cur_date); | |
| 11 | YearMonthDay birth_date; | |
| 12 | ConvertDateToYMD(_date - v->age, &birth_date); | |
| 13 | if (cur_date.year - birth_date.year >= 2) {
| |
| 14 | v->profit_lifetime = v->profit_last_year; | |
| 15 | } else {
| |
| 16 | v->profit_lifetime = 0; | |
| 17 | } | |
| 18 | } | |
| 19 | } |