Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Best guess lifetime profits based on vehicle age and last year profits */
- if (IsSavegameVersionBefore(SLV_LIFETIME_PROFIT)) {
- for (Vehicle *v : Vehicle::Iterate()) {
- /* Renewing vehicles resets lifetime profits to zero and
- * inherits last year profits from their past vehicles.
- * Using their last year profits to best guess lifetime
- * profits falls into the wrong side, unless the vehicles
- * have already gone through one entire calendar year. */
- YearMonthDay cur_date;
- ConvertDateToYMD(_date, &cur_date);
- YearMonthDay birth_date;
- ConvertDateToYMD(_date - v->age, &birth_date);
- if (cur_date.year - birth_date.year >= 2) {
- v->profit_lifetime = v->profit_last_year;
- } else {
- v->profit_lifetime = 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment