@@ -387,8 +387,8 @@ static bool FixTTOEngines()
|
||||
for (uint i = 0; i < lengthof(_orig_aircraft_vehicle_info); i++, j++) new (GetTempDataEngine(j)) Engine(VEH_AIRCRAFT, i);
|
||||
}
|
||||
|
||||
Date aging_date = std::min(_date + DAYS_TILL_ORIGINAL_BASE_YEAR.AsDelta(), ConvertYMDToDate(2050, 0, 1));
|
||||
YearMonthDay aging_ymd = ConvertDateToYMD(aging_date);
|
||||
CalTime::Date aging_date = std::min(CalTime::CurDate() + CalTime::DAYS_TILL_ORIGINAL_BASE_YEAR.AsDelta(), CalTime::ConvertYMDToDate(2050, 0, 1));
|
||||
CalTime::YearMonthDay aging_ymd = CalTime::ConvertDateToYMD(aging_date);
|
||||
|
||||
for (EngineID i = 0; i < 256; i++) {
|
||||
int oi = ttd_to_tto[i];
|
||||
@@ -396,17 +396,19 @@ static bool FixTTOEngines()
|
||||
|
||||
if (oi == 255) {
|
||||
/* Default engine is used */
|
||||
_date += DAYS_TILL_ORIGINAL_BASE_YEAR.AsDelta();
|
||||
CalTime::State backup = CalTime::Detail::now;
|
||||
CalTime::Detail::now.cal_date += CalTime::DAYS_TILL_ORIGINAL_BASE_YEAR.AsDelta();
|
||||
CalTime::Detail::now.cal_ymd = CalTime::ConvertDateToYMD(CalTime::Detail::now.cal_date);
|
||||
StartupOneEngine(e, aging_date, aging_ymd, 0, INT_MAX);
|
||||
CalcEngineReliability(e, false);
|
||||
e->intro_date -= DAYS_TILL_ORIGINAL_BASE_YEAR.AsDelta();
|
||||
_date -= DAYS_TILL_ORIGINAL_BASE_YEAR.AsDelta();
|
||||
e->intro_date -= CalTime::DAYS_TILL_ORIGINAL_BASE_YEAR.AsDelta();
|
||||
CalTime::Detail::now = backup;
|
||||
|
||||
/* Make sure for example monorail and maglev are available when they should be */
|
||||
if (_date >= e->intro_date && HasBit(e->info.climates, 0)) {
|
||||
if (CalTime::CurDate() >= e->intro_date && HasBit(e->info.climates, 0)) {
|
||||
e->flags |= ENGINE_AVAILABLE;
|
||||
e->company_avail = MAX_UVALUE(CompanyMask);
|
||||
e->age = _date > e->intro_date ? (_date - e->intro_date).base() / 30 : 0;
|
||||
e->age = CalTime::CurDate() > e->intro_date ? (CalTime::CurDate() - e->intro_date).base() / 30 : 0;
|
||||
}
|
||||
} else {
|
||||
/* Using data from TTO savegame */
|
||||
@@ -857,7 +859,7 @@ static bool LoadOldIndustry(LoadgameState *ls, int num)
|
||||
if (i->type > 0x06) i->type++; // Printing Works were added
|
||||
if (i->type == 0x0A) i->type = 0x12; // Iron Ore Mine has different ID
|
||||
|
||||
i->last_prod_year = _cur_date_ymd.year;
|
||||
i->last_prod_year = CalTime::CurYear().base();
|
||||
|
||||
i->random_colour = RemapTTOColour(i->random_colour);
|
||||
}
|
||||
@@ -1033,7 +1035,7 @@ static bool LoadOldCompany(LoadgameState *ls, int num)
|
||||
}
|
||||
|
||||
_company_colours[num] = c->colour;
|
||||
c->inaugurated_year -= ORIGINAL_BASE_YEAR;
|
||||
c->inaugurated_year -= CalTime::ORIGINAL_BASE_YEAR.AsDelta();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1598,8 +1600,8 @@ extern uint8_t _old_units;
|
||||
static const OldChunks main_chunk[] = {
|
||||
OCL_ASSERT( OC_TTD, 0 ),
|
||||
OCL_ASSERT( OC_TTO, 0 ),
|
||||
OCL_VAR ( OC_FILE_U16 | OC_VAR_U32, 1, &_date ),
|
||||
OCL_VAR ( OC_UINT16, 1, &_date_fract ),
|
||||
OCL_VAR ( OC_FILE_U16 | OC_VAR_U32, 1, &CalTime::Detail::now.cal_date ),
|
||||
OCL_VAR ( OC_UINT16, 1, &CalTime::Detail::now.cal_date_fract ),
|
||||
OCL_NULL( 600 ), ///< TextEffects
|
||||
OCL_VAR ( OC_UINT32, 2, &_random.state ),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user