Advertisement
Guest User

Untitled

a guest
Jan 13th, 2020
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1.     /* Set lifetime vehicle profits */
  2.     if (IsSavegameVersionBefore(SLV_LIFETIME_PROFIT)) {
  3.         for (Vehicle *v : Vehicle::Iterate()) {
  4.             if (v->age / DAYS_IN_LEAP_YEAR >= 2) {
  5.                 v->profit_lifetime = v->profit_last_year;
  6.             } else if (v->age / DAYS_IN_LEAP_YEAR == 1) {
  7.                 YearMonthDay cur_date;
  8.                 ConvertDateToYMD(_date, &cur_date);
  9.                 YearMonthDay birth_date;
  10.                 ConvertDateToYMD(_date - v->age, &birth_date);
  11.                 if (cur_date.year - birth_date.year >= 2) {
  12.                     v->profit_lifetime = v->profit_last_year;
  13.                 } else {
  14.                     v->profit_lifetime = 0;
  15.                 }
  16.             } else {
  17.                 v->profit_lifetime = 0;
  18.             }
  19.         }
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement