|
@@ -18,12 +18,13 @@
|
|
|
#include "../signs_base.h"
|
|
|
#include "../station_base.h"
|
|
|
#include "../subsidy_base.h"
|
|
|
#include "../debug.h"
|
|
|
#include "../depot_base.h"
|
|
|
#include "../date_func.h"
|
|
|
#include "../timer/timer_game_calendar.h"
|
|
|
#include "../vehicle_func.h"
|
|
|
#include "../effectvehicle_base.h"
|
|
|
#include "../engine_func.h"
|
|
|
#include "../company_base.h"
|
|
|
#include "../disaster_vehicle.h"
|
|
|
#include "../core/smallvec_type.hpp"
|
|
@@ -395,31 +396,31 @@ static bool FixTTOEngines()
|
|
|
for (uint i = 0; i < lengthof(_orig_rail_vehicle_info); i++, j++) new (GetTempDataEngine(j)) Engine(VEH_TRAIN, i);
|
|
|
for (uint i = 0; i < lengthof(_orig_road_vehicle_info); i++, j++) new (GetTempDataEngine(j)) Engine(VEH_ROAD, i);
|
|
|
for (uint i = 0; i < lengthof(_orig_ship_vehicle_info); i++, j++) new (GetTempDataEngine(j)) Engine(VEH_SHIP, i);
|
|
|
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, ConvertYMDToDate(2050, 0, 1));
|
|
|
Date aging_date = std::min(TimerGameCalendar::date + DAYS_TILL_ORIGINAL_BASE_YEAR, ConvertYMDToDate(2050, 0, 1));
|
|
|
|
|
|
for (EngineID i = 0; i < 256; i++) {
|
|
|
int oi = ttd_to_tto[i];
|
|
|
Engine *e = GetTempDataEngine(i);
|
|
|
|
|
|
if (oi == 255) {
|
|
|
/* Default engine is used */
|
|
|
_date += DAYS_TILL_ORIGINAL_BASE_YEAR;
|
|
|
TimerGameCalendar::date += DAYS_TILL_ORIGINAL_BASE_YEAR;
|
|
|
StartupOneEngine(e, aging_date, 0);
|
|
|
CalcEngineReliability(e, false);
|
|
|
e->intro_date -= DAYS_TILL_ORIGINAL_BASE_YEAR;
|
|
|
_date -= DAYS_TILL_ORIGINAL_BASE_YEAR;
|
|
|
TimerGameCalendar::date -= DAYS_TILL_ORIGINAL_BASE_YEAR;
|
|
|
|
|
|
/* Make sure for example monorail and maglev are available when they should be */
|
|
|
if (_date >= e->intro_date && HasBit(e->info.climates, 0)) {
|
|
|
if (TimerGameCalendar::date >= 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) / 30 : 0;
|
|
|
e->age = TimerGameCalendar::date > e->intro_date ? (TimerGameCalendar::date - e->intro_date) / 30 : 0;
|
|
|
}
|
|
|
} else {
|
|
|
/* Using data from TTO savegame */
|
|
|
Engine *oe = &_old_engines[oi];
|
|
|
|
|
|
e->intro_date = oe->intro_date;
|
|
@@ -843,13 +844,13 @@ static bool LoadOldIndustry(LoadgameStat
|
|
|
|
|
|
if (_savegame_type == SGT_TTO) {
|
|
|
if (i->type > 0x06) i->type++; // Printing Works were added
|
|
|
if (i->type == 0x0A) i->type = 0x12; // Iron Ore Mine has different ID
|
|
|
|
|
|
YearMonthDay ymd;
|
|
|
ConvertDateToYMD(_date, &ymd);
|
|
|
ConvertDateToYMD(TimerGameCalendar::date, &ymd);
|
|
|
i->last_prod_year = ymd.year;
|
|
|
|
|
|
i->random_colour = RemapTTOColour(i->random_colour);
|
|
|
}
|
|
|
|
|
|
Industry::IncIndustryTypeCount(i->type);
|
|
@@ -1577,14 +1578,14 @@ extern byte _trees_tick_ctr;
|
|
|
extern byte _age_cargo_skip_counter; // From misc_sl.cpp
|
|
|
extern uint8 _old_diff_level;
|
|
|
extern uint8 _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, &TimerGameCalendar::date ),
|
|
|
OCL_VAR ( OC_UINT16, 1, &TimerGameCalendar::date_fract ),
|
|
|
OCL_NULL( 600 ), ///< TextEffects
|
|
|
OCL_VAR ( OC_UINT32, 2, &_random.state ),
|
|
|
|
|
|
OCL_ASSERT( OC_TTD, 0x264 ),
|
|
|
OCL_ASSERT( OC_TTO, 0x264 ),
|
|
|
|