SHOW:
|
|
- or go back to the newest paste.
| 1 | - | /* Set lifetime vehicle profits */ |
| 1 | + | |
| 2 | for (Vehicle *v : Vehicle::Iterate()) {
| |
| 3 | YearMonthDay cur_date; | |
| 4 | - | if (v->age / DAYS_IN_LEAP_YEAR >= 2) {
|
| 4 | + | ConvertDateToYMD(_date, &cur_date); |
| 5 | YearMonthDay birth_date; | |
| 6 | - | } else if (v->age / DAYS_IN_LEAP_YEAR == 1) {
|
| 6 | + | ConvertDateToYMD(_date - v->age, &birth_date); |
| 7 | - | YearMonthDay cur_date; |
| 7 | + | if (cur_date.year - birth_date.year >= 2) {
|
| 8 | - | ConvertDateToYMD(_date, &cur_date); |
| 8 | + | |
| 9 | - | YearMonthDay birth_date; |
| 9 | + | |
| 10 | - | ConvertDateToYMD(_date - v->age, &birth_date); |
| 10 | + | |
| 11 | - | if (cur_date.year - birth_date.year >= 2) {
|
| 11 | + | |
| 12 | - | v->profit_lifetime = v->profit_last_year; |
| 12 | + | |
| 13 | - | } else {
|
| 13 | + |