1
0
Fork 0

Compare commits

...

4 Commits

Author SHA1 Message Date
Patric Stout e6c02ebee6
Fix b0e73277: cargodist information got lost when splitting of cargo (#11280)
During b0e73277 we removed loaded_at_xy, but I kinda forgot that
it was a union with next_station. Now next_station wasn't copied
anymore, or checked in AreMergable.
2023-09-10 15:20:58 +02:00
Tyler Trahan 701a61c9af Codechange: Delete date_type.h 2023-09-10 08:40:25 -04:00
Tyler Trahan 77173a6a10 Codechange: Move date consts and functions to CalendarTime and TimerGameCalendar classes 2023-09-10 08:40:25 -04:00
Tyler Trahan fca2b37726 Codechange: Move Ticks into their own class 2023-09-10 08:40:25 -04:00
92 changed files with 529 additions and 537 deletions

View File

@ -117,7 +117,6 @@ add_files(
currency.h currency.h
date_gui.cpp date_gui.cpp
date_gui.h date_gui.h
date_type.h
debug.cpp debug.cpp
debug.h debug.h
dedicated.cpp dedicated.cpp

View File

@ -453,7 +453,7 @@ void Aircraft::OnNewDay()
if (this->running_ticks == 0) return; if (this->running_ticks == 0) return;
CommandCost cost(EXPENSES_AIRCRAFT_RUN, this->GetRunningCost() * this->running_ticks / (DAYS_IN_YEAR * DAY_TICKS)); CommandCost cost(EXPENSES_AIRCRAFT_RUN, this->GetRunningCost() * this->running_ticks / (CalendarTime::DAYS_IN_YEAR * Ticks::DAY_TICKS));
this->profit_this_year -= cost.GetCost(); this->profit_this_year -= cost.GetCost();
this->running_ticks = 0; this->running_ticks = 0;

View File

@ -967,7 +967,7 @@ int DrawVehiclePurchaseInfo(int left, int right, int y, EngineID engine_number,
if (e->type != VEH_TRAIN || e->u.rail.railveh_type != RAILVEH_WAGON) { if (e->type != VEH_TRAIN || e->u.rail.railveh_type != RAILVEH_WAGON) {
/* Design date - Life length */ /* Design date - Life length */
SetDParam(0, ymd.year); SetDParam(0, ymd.year);
SetDParam(1, DateToYear(e->GetLifeLengthInDays())); SetDParam(1, TimerGameCalendar::DateToYear(e->GetLifeLengthInDays()));
DrawString(left, right, y, STR_PURCHASE_INFO_DESIGNED_LIFE); DrawString(left, right, y, STR_PURCHASE_INFO_DESIGNED_LIFE);
y += FONT_HEIGHT_NORMAL; y += FONT_HEIGHT_NORMAL;

View File

@ -57,6 +57,7 @@ CargoPacket::CargoPacket(StationID first_station, TileIndex source_xy, uint16_t
* @param count Number of cargo entities to put in this packet. * @param count Number of cargo entities to put in this packet.
* @param periods_in_transit Number of cargo aging periods the cargo has been in transit. * @param periods_in_transit Number of cargo aging periods the cargo has been in transit.
* @param first_station Station the cargo was initially loaded. * @param first_station Station the cargo was initially loaded.
* @param next_station Next station the cargo wants to go.
* @param source_xy Station location the cargo was initially loaded. * @param source_xy Station location the cargo was initially loaded.
* @param feeder_share Feeder share the packet has already accumulated. * @param feeder_share Feeder share the packet has already accumulated.
* @param source_type 'Type' of source the packet comes from (for subsidies). * @param source_type 'Type' of source the packet comes from (for subsidies).
@ -64,14 +65,15 @@ CargoPacket::CargoPacket(StationID first_station, TileIndex source_xy, uint16_t
* @note We have to zero memory ourselves here because we are using a 'new' * @note We have to zero memory ourselves here because we are using a 'new'
* that, in contrary to all other pools, does not memset to 0. * that, in contrary to all other pools, does not memset to 0.
*/ */
CargoPacket::CargoPacket(uint16_t count, uint16_t periods_in_transit, StationID first_station, TileIndex source_xy, Money feeder_share, SourceType source_type, SourceID source_id) : CargoPacket::CargoPacket(uint16_t count, uint16_t periods_in_transit, StationID first_station, StationID next_station, TileIndex source_xy, Money feeder_share, SourceType source_type, SourceID source_id) :
count(count), count(count),
periods_in_transit(periods_in_transit), periods_in_transit(periods_in_transit),
feeder_share(feeder_share), feeder_share(feeder_share),
source_xy(source_xy), source_xy(source_xy),
source_id(source_id), source_id(source_id),
source_type(source_type), source_type(source_type),
first_station(first_station) first_station(first_station),
next_station(next_station)
{ {
assert(count != 0); assert(count != 0);
} }
@ -86,7 +88,7 @@ CargoPacket *CargoPacket::Split(uint new_size)
if (!CargoPacket::CanAllocateItem()) return nullptr; if (!CargoPacket::CanAllocateItem()) return nullptr;
Money fs = this->GetFeederShare(new_size); Money fs = this->GetFeederShare(new_size);
CargoPacket *cp_new = new CargoPacket(new_size, this->periods_in_transit, this->first_station, this->source_xy, fs, this->source_type, this->source_id); CargoPacket *cp_new = new CargoPacket(new_size, this->periods_in_transit, this->first_station, this->next_station, this->source_xy, fs, this->source_type, this->source_id);
this->feeder_share -= fs; this->feeder_share -= fs;
this->count -= new_size; this->count -= new_size;
return cp_new; return cp_new;

View File

@ -63,7 +63,7 @@ public:
CargoPacket(); CargoPacket();
CargoPacket(StationID first_station, TileIndex source_xy, uint16_t count, SourceType source_type, SourceID source_id); CargoPacket(StationID first_station, TileIndex source_xy, uint16_t count, SourceType source_type, SourceID source_id);
CargoPacket(uint16_t count, uint16_t periods_in_transit, StationID source, TileIndex source_xy, Money feeder_share = 0, SourceType source_type = SourceType::Industry, SourceID source_id = INVALID_SOURCE); CargoPacket(uint16_t count, uint16_t periods_in_transit, StationID first_station, StationID next_station, TileIndex source_xy, Money feeder_share = 0, SourceType source_type = SourceType::Industry, SourceID source_id = INVALID_SOURCE);
/** Destroy the packet. */ /** Destroy the packet. */
~CargoPacket() { } ~CargoPacket() { }
@ -422,6 +422,7 @@ public:
return cp1->source_xy == cp2->source_xy && return cp1->source_xy == cp2->source_xy &&
cp1->periods_in_transit == cp2->periods_in_transit && cp1->periods_in_transit == cp2->periods_in_transit &&
cp1->source_type == cp2->source_type && cp1->source_type == cp2->source_type &&
cp1->next_station == cp2->next_station &&
cp1->source_id == cp2->source_id; cp1->source_id == cp2->source_id;
} }
}; };
@ -536,6 +537,7 @@ public:
return cp1->source_xy == cp2->source_xy && return cp1->source_xy == cp2->source_xy &&
cp1->periods_in_transit == cp2->periods_in_transit && cp1->periods_in_transit == cp2->periods_in_transit &&
cp1->source_type == cp2->source_type && cp1->source_type == cp2->source_type &&
cp1->next_station == cp2->next_station &&
cp1->source_id == cp2->source_id; cp1->source_id == cp2->source_id;
} }
}; };

View File

@ -104,7 +104,7 @@ extern void EnginesMonthlyLoop();
static int32_t ClickChangeDateCheat(int32_t new_value, int32_t change_direction) static int32_t ClickChangeDateCheat(int32_t new_value, int32_t change_direction)
{ {
/* Don't allow changing to an invalid year, or the current year. */ /* Don't allow changing to an invalid year, or the current year. */
auto new_year = Clamp(TimerGameCalendar::Year(new_value), MIN_YEAR, MAX_YEAR); auto new_year = Clamp(TimerGameCalendar::Year(new_value), CalendarTime::MIN_YEAR, CalendarTime::MAX_YEAR);
if (new_year == TimerGameCalendar::year) return static_cast<int32_t>(TimerGameCalendar::year); if (new_year == TimerGameCalendar::year) return static_cast<int32_t>(TimerGameCalendar::year);
TimerGameCalendar::YearMonthDay ymd; TimerGameCalendar::YearMonthDay ymd;
@ -320,7 +320,7 @@ struct CheatWindow : Window {
switch (ce->str) { switch (ce->str) {
/* Display date for change date cheat */ /* Display date for change date cheat */
case STR_CHEAT_CHANGE_DATE: case STR_CHEAT_CHANGE_DATE:
SetDParam(0, TimerGameCalendar::ConvertYMDToDate(MAX_YEAR, 11, 31)); SetDParam(0, TimerGameCalendar::ConvertYMDToDate(CalendarTime::MAX_YEAR, 11, 31));
width = std::max(width, GetStringBoundingBox(ce->str).width); width = std::max(width, GetStringBoundingBox(ce->str).width);
break; break;

View File

@ -659,7 +659,7 @@ static void HandleBankruptcyTakeover(Company *c)
* number of companies. The minimum number of days in a quarter * number of companies. The minimum number of days in a quarter
* is 90: 31 in January, 28 in February and 31 in March. * is 90: 31 in January, 28 in February and 31 in March.
* Note that the company going bankrupt can't buy itself. */ * Note that the company going bankrupt can't buy itself. */
static const int TAKE_OVER_TIMEOUT = 3 * 30 * DAY_TICKS / (MAX_COMPANIES - 1); static const int TAKE_OVER_TIMEOUT = 3 * 30 * Ticks::DAY_TICKS / (MAX_COMPANIES - 1);
assert(c->bankrupt_asked != 0); assert(c->bankrupt_asked != 0);
@ -717,7 +717,7 @@ void OnTick_Companies()
} }
if (_new_competitor_timeout.HasFired() && _game_mode != GM_MENU && AI::CanStartNew()) { if (_new_competitor_timeout.HasFired() && _game_mode != GM_MENU && AI::CanStartNew()) {
int32_t timeout = _settings_game.difficulty.competitors_interval * 60 * TICKS_PER_SECOND; int32_t timeout = _settings_game.difficulty.competitors_interval * 60 * Ticks::TICKS_PER_SECOND;
/* If the interval is zero, start as many competitors as needed then check every ~10 minutes if a company went bankrupt and needs replacing. */ /* If the interval is zero, start as many competitors as needed then check every ~10 minutes if a company went bankrupt and needs replacing. */
if (timeout == 0) { if (timeout == 0) {
/* count number of competitors */ /* count number of competitors */
@ -731,7 +731,7 @@ void OnTick_Companies()
if (n++ >= _settings_game.difficulty.max_no_competitors) break; if (n++ >= _settings_game.difficulty.max_no_competitors) break;
Command<CMD_COMPANY_CTRL>::Post(CCA_NEW_AI, INVALID_COMPANY, CRR_NONE, INVALID_CLIENT_ID); Command<CMD_COMPANY_CTRL>::Post(CCA_NEW_AI, INVALID_COMPANY, CRR_NONE, INVALID_CLIENT_ID);
} }
timeout = 10 * 60 * TICKS_PER_SECOND; timeout = 10 * 60 * Ticks::TICKS_PER_SECOND;
} }
/* Randomize a bit when the AI is actually going to start; ranges from 87.5% .. 112.5% of indicated value. */ /* Randomize a bit when the AI is actually going to start; ranges from 87.5% .. 112.5% of indicated value. */
timeout += ScriptObject::GetRandomizer(OWNER_NONE).Next(timeout / 4) - timeout / 8; timeout += ScriptObject::GetRandomizer(OWNER_NONE).Next(timeout / 4) - timeout / 8;

View File

@ -1861,7 +1861,7 @@ struct CompanyInfrastructureWindow : Window
} }
/* Get the date introduced railtypes as well. */ /* Get the date introduced railtypes as well. */
this->railtypes = AddDateIntroducedRailTypes(this->railtypes, MAX_DATE); this->railtypes = AddDateIntroducedRailTypes(this->railtypes, CalendarTime::MAX_DATE);
/* Find the used roadtypes. */ /* Find the used roadtypes. */
for (const Engine *e : Engine::IterateType(VEH_ROAD)) { for (const Engine *e : Engine::IterateType(VEH_ROAD)) {
@ -1871,7 +1871,7 @@ struct CompanyInfrastructureWindow : Window
} }
/* Get the date introduced roadtypes as well. */ /* Get the date introduced roadtypes as well. */
this->roadtypes = AddDateIntroducedRoadTypes(this->roadtypes, MAX_DATE); this->roadtypes = AddDateIntroducedRoadTypes(this->roadtypes, CalendarTime::MAX_DATE);
this->roadtypes &= ~_roadtypes_hidden_mask; this->roadtypes &= ~_roadtypes_hidden_mask;
} }

View File

@ -13,7 +13,6 @@
#include "window_func.h" #include "window_func.h"
#include "window_gui.h" #include "window_gui.h"
#include "date_gui.h" #include "date_gui.h"
#include "date_type.h"
#include "core/geometry_func.hpp" #include "core/geometry_func.hpp"
#include "widgets/dropdown_type.h" #include "widgets/dropdown_type.h"
@ -44,8 +43,8 @@ struct SetDateWindow : Window {
Window(desc), Window(desc),
callback(callback), callback(callback),
callback_data(callback_data), callback_data(callback_data),
min_year(std::max(MIN_YEAR, min_year)), min_year(std::max(CalendarTime::MIN_YEAR, min_year)),
max_year(std::min(MAX_YEAR, max_year)) max_year(std::min(CalendarTime::MAX_YEAR, max_year))
{ {
assert(this->min_year <= this->max_year); assert(this->min_year <= this->max_year);
this->parent = parent; this->parent = parent;

View File

@ -1,103 +0,0 @@
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file date_type.h Types related to the dates in OpenTTD. */
#ifndef DATE_TYPE_H
#define DATE_TYPE_H
#include "timer/timer_game_calendar.h"
typedef int32_t Ticks; ///< The type to store ticks in
/**
* 1 day is 74 ticks; TimerGameCalendar::date_fract used to be uint16_t and incremented by 885. On
* an overflow the new day begun and 65535 / 885 = 74.
* 1 tick is approximately 27 ms.
* 1 day is thus about 2 seconds (74 * 27 = 1998) on a machine that can run OpenTTD normally
*/
static const int DAY_TICKS = 74; ///< ticks per day
static const int DAYS_IN_YEAR = 365; ///< days per year
static const int DAYS_IN_LEAP_YEAR = 366; ///< sometimes, you need one day more...
static const int MONTHS_IN_YEAR = 12; ///< months per year
static const int SECONDS_PER_DAY = 2; ///< approximate seconds per day, not for precise calculations
static const int STATION_RATING_TICKS = 185; ///< cycle duration for updating station rating
static const int STATION_ACCEPTANCE_TICKS = 250; ///< cycle duration for updating station acceptance
static const int STATION_LINKGRAPH_TICKS = 504; ///< cycle duration for cleaning dead links
static const int CARGO_AGING_TICKS = 185; ///< cycle duration for aging cargo
static const int INDUSTRY_PRODUCE_TICKS = 256; ///< cycle duration for industry production
static const int TOWN_GROWTH_TICKS = 70; ///< cycle duration for towns trying to grow. (this originates from the size of the town array in TTD
static const int INDUSTRY_CUT_TREE_TICKS = INDUSTRY_PRODUCE_TICKS * 2; ///< cycle duration for lumber mill's extra action
/*
* ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR and DAYS_TILL_ORIGINAL_BASE_YEAR are
* primarily used for loading newgrf and savegame data and returning some
* newgrf (callback) functions that were in the original (TTD) inherited
* format, where 'TimerGameCalendar::date == 0' meant that it was 1920-01-01.
*/
/** The minimum starting year/base year of the original TTD */
static constexpr TimerGameCalendar::Year ORIGINAL_BASE_YEAR = 1920;
/** The original ending year */
static constexpr TimerGameCalendar::Year ORIGINAL_END_YEAR = 2051;
/** The maximum year of the original TTD */
static constexpr TimerGameCalendar::Year ORIGINAL_MAX_YEAR = 2090;
/**
* Calculate the date of the first day of a given year.
* @param year the year to get the first day of.
* @return the date.
*/
static constexpr TimerGameCalendar::Date DateAtStartOfYear(TimerGameCalendar::Year year)
{
int32_t year_as_int = static_cast<int32_t>(year);
uint number_of_leap_years = (year == 0) ? 0 : ((year_as_int - 1) / 4 - (year_as_int - 1) / 100 + (year_as_int - 1) / 400 + 1);
return (DAYS_IN_YEAR * year_as_int) + number_of_leap_years;
}
/**
* Calculate the year of a given date.
* @param date The date to consider.
* @return the year.
*/
static inline TimerGameCalendar::Year DateToYear(TimerGameCalendar::Date date)
{
return static_cast<int32_t>(date) / DAYS_IN_LEAP_YEAR;
}
/**
* The date of the first day of the original base year.
*/
static constexpr TimerGameCalendar::Date DAYS_TILL_ORIGINAL_BASE_YEAR = DateAtStartOfYear(ORIGINAL_BASE_YEAR);
/** The absolute minimum & maximum years in OTTD */
static constexpr TimerGameCalendar::Year MIN_YEAR = 0;
/** The default starting year */
static constexpr TimerGameCalendar::Year DEF_START_YEAR = 1950;
/** The default scoring end year */
static constexpr TimerGameCalendar::Year DEF_END_YEAR = ORIGINAL_END_YEAR - 1;
/**
* MAX_YEAR, nicely rounded value of the number of years that can
* be encoded in a single 32 bits date, about 2^31 / 366 years.
*/
static constexpr TimerGameCalendar::Year MAX_YEAR = 5000000;
/** The date of the last day of the max year. */
static constexpr TimerGameCalendar::Date MAX_DATE = DateAtStartOfYear(MAX_YEAR + 1) - 1;
static constexpr TimerGameCalendar::Year INVALID_YEAR = -1; ///< Representation of an invalid year
static constexpr TimerGameCalendar::Date INVALID_DATE = -1; ///< Representation of an invalid date
static constexpr Ticks INVALID_TICKS = -1; ///< Representation of an invalid number of ticks
#endif /* DATE_TYPE_H */

View File

@ -360,7 +360,7 @@ struct DepotWindow : Window {
DrawSpriteIgnorePadding((v->vehstatus & VS_STOPPED) ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, PAL_NONE, flag, false, SA_CENTER); DrawSpriteIgnorePadding((v->vehstatus & VS_STOPPED) ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, PAL_NONE, flag, false, SA_CENTER);
SetDParam(0, v->unitnumber); SetDParam(0, v->unitnumber);
DrawString(text, STR_JUST_COMMA, (v->max_age - DAYS_IN_LEAP_YEAR) >= v->age ? TC_BLACK : TC_RED); DrawString(text, STR_JUST_COMMA, (v->max_age - CalendarTime::DAYS_IN_LEAP_YEAR) >= v->age ? TC_BLACK : TC_RED);
} }
} }

View File

@ -735,7 +735,7 @@ bool AddInflation(bool check_year)
* inflation doesn't add anything after that either; it even makes playing * inflation doesn't add anything after that either; it even makes playing
* it impossible due to the diverging cost and income rates. * it impossible due to the diverging cost and income rates.
*/ */
if (check_year && (TimerGameCalendar::year < ORIGINAL_BASE_YEAR || TimerGameCalendar::year >= ORIGINAL_MAX_YEAR)) return true; if (check_year && (TimerGameCalendar::year < CalendarTime::ORIGINAL_BASE_YEAR || TimerGameCalendar::year >= CalendarTime::ORIGINAL_MAX_YEAR)) return true;
if (_economy.inflation_prices == MAX_INFLATION || _economy.inflation_payment == MAX_INFLATION) return true; if (_economy.inflation_prices == MAX_INFLATION || _economy.inflation_payment == MAX_INFLATION) return true;
@ -928,7 +928,7 @@ void StartupEconomy()
if (_settings_game.economy.inflation) { if (_settings_game.economy.inflation) {
/* Apply inflation that happened before our game start year. */ /* Apply inflation that happened before our game start year. */
int months = static_cast<int32_t>(std::min(TimerGameCalendar::year, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR) * 12; int months = static_cast<int32_t>(std::min(TimerGameCalendar::year, CalendarTime::ORIGINAL_MAX_YEAR) - CalendarTime::ORIGINAL_BASE_YEAR) * 12;
for (int i = 0; i < months; i++) { for (int i = 0; i < months; i++) {
AddInflation(false); AddInflation(false);
} }

View File

@ -30,6 +30,7 @@
#include "error.h" #include "error.h"
#include "engine_base.h" #include "engine_base.h"
#include "timer/timer.h" #include "timer/timer.h"
#include "timer/timer_game_tick.h"
#include "timer/timer_game_calendar.h" #include "timer/timer_game_calendar.h"
#include "table/strings.h" #include "table/strings.h"
@ -94,7 +95,7 @@ Engine::Engine(VehicleType type, EngineID base)
default: break; // The aircraft, disasters and especially visual effects have no NewGRF configured visual effects default: break; // The aircraft, disasters and especially visual effects have no NewGRF configured visual effects
} }
/* Set cargo aging period to the default value. */ /* Set cargo aging period to the default value. */
this->info.cargo_age_period = CARGO_AGING_TICKS; this->info.cargo_age_period = Ticks::CARGO_AGING_TICKS;
/* Not a variant */ /* Not a variant */
this->info.variant_id = INVALID_ENGINE; this->info.variant_id = INVALID_ENGINE;
return; return;
@ -437,7 +438,7 @@ uint Engine::GetDisplayMaxTractiveEffort() const
*/ */
TimerGameCalendar::Date Engine::GetLifeLengthInDays() const TimerGameCalendar::Date Engine::GetLifeLengthInDays() const
{ {
return DateAtStartOfYear(this->info.lifelength + _settings_game.vehicle.extend_vehicle_life); return TimerGameCalendar::DateAtStartOfYear(this->info.lifelength + _settings_game.vehicle.extend_vehicle_life);
} }
/** /**
@ -662,7 +663,7 @@ void SetYearEngineAgingStops()
/* Base year ending date on half the model life */ /* Base year ending date on half the model life */
TimerGameCalendar::YearMonthDay ymd; TimerGameCalendar::YearMonthDay ymd;
TimerGameCalendar::ConvertDateToYMD(ei->base_intro + static_cast<int32_t>(DateAtStartOfYear(ei->lifelength)) / 2, &ymd); TimerGameCalendar::ConvertDateToYMD(ei->base_intro + static_cast<int32_t>(TimerGameCalendar::DateAtStartOfYear(ei->lifelength)) / 2, &ymd);
_year_engine_aging_stops = std::max(_year_engine_aging_stops, ymd.year); _year_engine_aging_stops = std::max(_year_engine_aging_stops, ymd.year);
} }
@ -1102,7 +1103,7 @@ void EnginesMonthlyLoop()
/* Do not introduce invalid engines */ /* Do not introduce invalid engines */
if (!e->IsEnabled()) continue; if (!e->IsEnabled()) continue;
if (!(e->flags & ENGINE_AVAILABLE) && TimerGameCalendar::date >= (e->intro_date + DAYS_IN_YEAR)) { if (!(e->flags & ENGINE_AVAILABLE) && TimerGameCalendar::date >= (e->intro_date + CalendarTime::DAYS_IN_YEAR)) {
/* Introduce it to all companies */ /* Introduce it to all companies */
NewVehicleAvailable(e); NewVehicleAvailable(e);
} else if (!(e->flags & (ENGINE_AVAILABLE | ENGINE_EXCLUSIVE_PREVIEW)) && TimerGameCalendar::date >= e->intro_date) { } else if (!(e->flags & (ENGINE_AVAILABLE | ENGINE_EXCLUSIVE_PREVIEW)) && TimerGameCalendar::date >= e->intro_date) {

View File

@ -569,8 +569,8 @@ struct GenerateLandscapeWindow : public Window {
this->SetWidgetDisabledState(WID_GL_HEIGHTMAP_HEIGHT_DOWN, _settings_newgame.game_creation.heightmap_height <= MIN_HEIGHTMAP_HEIGHT); this->SetWidgetDisabledState(WID_GL_HEIGHTMAP_HEIGHT_DOWN, _settings_newgame.game_creation.heightmap_height <= MIN_HEIGHTMAP_HEIGHT);
this->SetWidgetDisabledState(WID_GL_HEIGHTMAP_HEIGHT_UP, _settings_newgame.game_creation.heightmap_height >= GetMapHeightLimit()); this->SetWidgetDisabledState(WID_GL_HEIGHTMAP_HEIGHT_UP, _settings_newgame.game_creation.heightmap_height >= GetMapHeightLimit());
} }
this->SetWidgetDisabledState(WID_GL_START_DATE_DOWN, _settings_newgame.game_creation.starting_year <= MIN_YEAR); this->SetWidgetDisabledState(WID_GL_START_DATE_DOWN, _settings_newgame.game_creation.starting_year <= CalendarTime::MIN_YEAR);
this->SetWidgetDisabledState(WID_GL_START_DATE_UP, _settings_newgame.game_creation.starting_year >= MAX_YEAR); this->SetWidgetDisabledState(WID_GL_START_DATE_UP, _settings_newgame.game_creation.starting_year >= CalendarTime::MAX_YEAR);
this->SetWidgetDisabledState(WID_GL_SNOW_COVERAGE_DOWN, _settings_newgame.game_creation.snow_coverage <= 0 || _settings_newgame.game_creation.landscape != LT_ARCTIC); this->SetWidgetDisabledState(WID_GL_SNOW_COVERAGE_DOWN, _settings_newgame.game_creation.snow_coverage <= 0 || _settings_newgame.game_creation.landscape != LT_ARCTIC);
this->SetWidgetDisabledState(WID_GL_SNOW_COVERAGE_UP, _settings_newgame.game_creation.snow_coverage >= 100 || _settings_newgame.game_creation.landscape != LT_ARCTIC); this->SetWidgetDisabledState(WID_GL_SNOW_COVERAGE_UP, _settings_newgame.game_creation.snow_coverage >= 100 || _settings_newgame.game_creation.landscape != LT_ARCTIC);
this->SetWidgetDisabledState(WID_GL_DESERT_COVERAGE_DOWN, _settings_newgame.game_creation.desert_coverage <= 0 || _settings_newgame.game_creation.landscape != LT_TROPIC); this->SetWidgetDisabledState(WID_GL_DESERT_COVERAGE_DOWN, _settings_newgame.game_creation.desert_coverage <= 0 || _settings_newgame.game_creation.landscape != LT_TROPIC);
@ -599,7 +599,7 @@ struct GenerateLandscapeWindow : public Window {
break; break;
case WID_GL_START_DATE_TEXT: case WID_GL_START_DATE_TEXT:
SetDParam(0, TimerGameCalendar::ConvertYMDToDate(MAX_YEAR, 0, 1)); SetDParam(0, TimerGameCalendar::ConvertYMDToDate(CalendarTime::MAX_YEAR, 0, 1));
d = GetStringBoundingBox(STR_JUST_DATE_LONG); d = GetStringBoundingBox(STR_JUST_DATE_LONG);
break; break;
@ -763,7 +763,7 @@ struct GenerateLandscapeWindow : public Window {
if (!(this->flags & WF_TIMEOUT) || this->timeout_timer <= 1) { if (!(this->flags & WF_TIMEOUT) || this->timeout_timer <= 1) {
this->HandleButtonClick(widget); this->HandleButtonClick(widget);
_settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + widget - WID_GL_START_DATE_TEXT, MIN_YEAR, MAX_YEAR); _settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + widget - WID_GL_START_DATE_TEXT, CalendarTime::MIN_YEAR, CalendarTime::MAX_YEAR);
this->InvalidateData(); this->InvalidateData();
} }
_left_button_clicked = false; _left_button_clicked = false;
@ -968,7 +968,7 @@ struct GenerateLandscapeWindow : public Window {
/* An empty string means revert to the default */ /* An empty string means revert to the default */
switch (this->widget_id) { switch (this->widget_id) {
case WID_GL_HEIGHTMAP_HEIGHT_TEXT: value = MAP_HEIGHT_LIMIT_AUTO_MINIMUM; break; case WID_GL_HEIGHTMAP_HEIGHT_TEXT: value = MAP_HEIGHT_LIMIT_AUTO_MINIMUM; break;
case WID_GL_START_DATE_TEXT: value = static_cast<int32_t>(DEF_START_YEAR); break; case WID_GL_START_DATE_TEXT: value = static_cast<int32_t>(CalendarTime::DEF_START_YEAR); break;
case WID_GL_SNOW_COVERAGE_TEXT: value = DEF_SNOW_COVERAGE; break; case WID_GL_SNOW_COVERAGE_TEXT: value = DEF_SNOW_COVERAGE; break;
case WID_GL_DESERT_COVERAGE_TEXT: value = DEF_DESERT_COVERAGE; break; case WID_GL_DESERT_COVERAGE_TEXT: value = DEF_DESERT_COVERAGE; break;
case WID_GL_TOWN_PULLDOWN: value = 1; break; case WID_GL_TOWN_PULLDOWN: value = 1; break;
@ -987,7 +987,7 @@ struct GenerateLandscapeWindow : public Window {
case WID_GL_START_DATE_TEXT: case WID_GL_START_DATE_TEXT:
this->SetWidgetDirty(WID_GL_START_DATE_TEXT); this->SetWidgetDirty(WID_GL_START_DATE_TEXT);
_settings_newgame.game_creation.starting_year = Clamp(TimerGameCalendar::Year(value), MIN_YEAR, MAX_YEAR); _settings_newgame.game_creation.starting_year = Clamp(TimerGameCalendar::Year(value), CalendarTime::MIN_YEAR, CalendarTime::MAX_YEAR);
break; break;
case WID_GL_SNOW_COVERAGE_TEXT: case WID_GL_SNOW_COVERAGE_TEXT:
@ -1125,8 +1125,8 @@ struct CreateScenarioWindow : public Window
void OnPaint() override void OnPaint() override
{ {
this->SetWidgetDisabledState(WID_CS_START_DATE_DOWN, _settings_newgame.game_creation.starting_year <= MIN_YEAR); this->SetWidgetDisabledState(WID_CS_START_DATE_DOWN, _settings_newgame.game_creation.starting_year <= CalendarTime::MIN_YEAR);
this->SetWidgetDisabledState(WID_CS_START_DATE_UP, _settings_newgame.game_creation.starting_year >= MAX_YEAR); this->SetWidgetDisabledState(WID_CS_START_DATE_UP, _settings_newgame.game_creation.starting_year >= CalendarTime::MAX_YEAR);
this->SetWidgetDisabledState(WID_CS_FLAT_LAND_HEIGHT_DOWN, _settings_newgame.game_creation.se_flat_world_height <= 0); this->SetWidgetDisabledState(WID_CS_FLAT_LAND_HEIGHT_DOWN, _settings_newgame.game_creation.se_flat_world_height <= 0);
this->SetWidgetDisabledState(WID_CS_FLAT_LAND_HEIGHT_UP, _settings_newgame.game_creation.se_flat_world_height >= GetMapHeightLimit()); this->SetWidgetDisabledState(WID_CS_FLAT_LAND_HEIGHT_UP, _settings_newgame.game_creation.se_flat_world_height >= GetMapHeightLimit());
@ -1143,7 +1143,7 @@ struct CreateScenarioWindow : public Window
StringID str = STR_JUST_INT; StringID str = STR_JUST_INT;
switch (widget) { switch (widget) {
case WID_CS_START_DATE_TEXT: case WID_CS_START_DATE_TEXT:
SetDParam(0, TimerGameCalendar::ConvertYMDToDate(MAX_YEAR, 0, 1)); SetDParam(0, TimerGameCalendar::ConvertYMDToDate(CalendarTime::MAX_YEAR, 0, 1));
str = STR_JUST_DATE_LONG; str = STR_JUST_DATE_LONG;
break; break;
@ -1199,7 +1199,7 @@ struct CreateScenarioWindow : public Window
this->HandleButtonClick(widget); this->HandleButtonClick(widget);
this->SetDirty(); this->SetDirty();
_settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + widget - WID_CS_START_DATE_TEXT, MIN_YEAR, MAX_YEAR); _settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + widget - WID_CS_START_DATE_TEXT, CalendarTime::MIN_YEAR, CalendarTime::MAX_YEAR);
} }
_left_button_clicked = false; _left_button_clicked = false;
break; break;
@ -1258,7 +1258,7 @@ struct CreateScenarioWindow : public Window
switch (this->widget_id) { switch (this->widget_id) {
case WID_CS_START_DATE_TEXT: case WID_CS_START_DATE_TEXT:
this->SetWidgetDirty(WID_CS_START_DATE_TEXT); this->SetWidgetDirty(WID_CS_START_DATE_TEXT);
_settings_newgame.game_creation.starting_year = Clamp(TimerGameCalendar::Year(value), MIN_YEAR, MAX_YEAR); _settings_newgame.game_creation.starting_year = Clamp(TimerGameCalendar::Year(value), CalendarTime::MIN_YEAR, CalendarTime::MAX_YEAR);
break; break;
case WID_CS_FLAT_LAND_HEIGHT_TEXT: case WID_CS_FLAT_LAND_HEIGHT_TEXT:

View File

@ -16,12 +16,12 @@
#include "cargotype.h" #include "cargotype.h"
#include "strings_func.h" #include "strings_func.h"
#include "window_func.h" #include "window_func.h"
#include "date_type.h"
#include "gfx_func.h" #include "gfx_func.h"
#include "core/geometry_func.hpp" #include "core/geometry_func.hpp"
#include "currency.h" #include "currency.h"
#include "timer/timer.h" #include "timer/timer.h"
#include "timer/timer_window.h" #include "timer/timer_window.h"
#include "timer/timer_game_tick.h"
#include "timer/timer_game_calendar.h" #include "timer/timer_game_calendar.h"
#include "zoom_func.h" #include "zoom_func.h"
@ -1130,7 +1130,7 @@ struct PerformanceRatingDetailWindow : Window {
UpdateCompanyRatingAndValue(c, false); UpdateCompanyRatingAndValue(c, false);
} }
this->timeout = DAY_TICKS * 5; this->timeout = Ticks::DAY_TICKS * 5;
} }
uint score_info_left; uint score_info_left;

View File

@ -1155,7 +1155,7 @@ static void ProduceIndustryGoods(Industry *i)
i->counter--; i->counter--;
/* produce some cargo */ /* produce some cargo */
if ((i->counter % INDUSTRY_PRODUCE_TICKS) == 0) { if ((i->counter % Ticks::INDUSTRY_PRODUCE_TICKS) == 0) {
if (HasBit(indsp->callback_mask, CBM_IND_PRODUCTION_256_TICKS)) IndustryProductionCallback(i, 1); if (HasBit(indsp->callback_mask, CBM_IND_PRODUCTION_256_TICKS)) IndustryProductionCallback(i, 1);
IndustryBehaviour indbehav = indsp->behaviour; IndustryBehaviour indbehav = indsp->behaviour;
@ -1188,7 +1188,7 @@ static void ProduceIndustryGoods(Industry *i)
if (cb_res != CALLBACK_FAILED) { if (cb_res != CALLBACK_FAILED) {
cut = ConvertBooleanCallback(indsp->grf_prop.grffile, CBID_INDUSTRY_SPECIAL_EFFECT, cb_res); cut = ConvertBooleanCallback(indsp->grf_prop.grffile, CBID_INDUSTRY_SPECIAL_EFFECT, cb_res);
} else { } else {
cut = ((i->counter % INDUSTRY_CUT_TREE_TICKS) == 0); cut = ((i->counter % Ticks::INDUSTRY_CUT_TREE_TICKS) == 0);
} }
if (cut) ChopLumberMillTrees(i); if (cut) ChopLumberMillTrees(i);

View File

@ -50,7 +50,7 @@ void FlowMapper::Run(LinkGraphJob &job) const
/* Scale by time the graph has been running without being compressed. Add 1 to avoid /* Scale by time the graph has been running without being compressed. Add 1 to avoid
* division by 0 if spawn date == last compression date. This matches * division by 0 if spawn date == last compression date. This matches
* LinkGraph::Monthly(). */ * LinkGraph::Monthly(). */
auto runtime = job.JoinDate() - job.Settings().recalc_time / SECONDS_PER_DAY - job.LastCompression() + 1; auto runtime = job.JoinDate() - job.Settings().recalc_time / CalendarTime::SECONDS_PER_DAY - job.LastCompression() + 1;
for (auto &it : flows) { for (auto &it : flows) {
it.second.ScaleToMonthly(static_cast<int32_t>(runtime)); it.second.ScaleToMonthly(static_cast<int32_t>(runtime));
} }

View File

@ -29,7 +29,7 @@ LinkGraph::BaseNode::BaseNode(TileIndex xy, StationID st, uint demand)
this->supply = 0; this->supply = 0;
this->demand = demand; this->demand = demand;
this->station = st; this->station = st;
this->last_update = INVALID_DATE; this->last_update = CalendarTime::INVALID_DATE;
} }
/** /**
@ -40,8 +40,8 @@ LinkGraph::BaseEdge::BaseEdge(NodeID dest_node)
this->capacity = 0; this->capacity = 0;
this->usage = 0; this->usage = 0;
this->travel_time_sum = 0; this->travel_time_sum = 0;
this->last_unrestricted_update = INVALID_DATE; this->last_unrestricted_update = CalendarTime::INVALID_DATE;
this->last_restricted_update = INVALID_DATE; this->last_restricted_update = CalendarTime::INVALID_DATE;
this->dest_node = dest_node; this->dest_node = dest_node;
} }
@ -55,10 +55,10 @@ void LinkGraph::ShiftDates(TimerGameCalendar::Date interval)
this->last_compression += interval; this->last_compression += interval;
for (NodeID node1 = 0; node1 < this->Size(); ++node1) { for (NodeID node1 = 0; node1 < this->Size(); ++node1) {
BaseNode &source = this->nodes[node1]; BaseNode &source = this->nodes[node1];
if (source.last_update != INVALID_DATE) source.last_update += interval; if (source.last_update != CalendarTime::INVALID_DATE) source.last_update += interval;
for (BaseEdge &edge : this->nodes[node1].edges) { for (BaseEdge &edge : this->nodes[node1].edges) {
if (edge.last_unrestricted_update != INVALID_DATE) edge.last_unrestricted_update += interval; if (edge.last_unrestricted_update != CalendarTime::INVALID_DATE) edge.last_unrestricted_update += interval;
if (edge.last_restricted_update != INVALID_DATE) edge.last_restricted_update += interval; if (edge.last_restricted_update != CalendarTime::INVALID_DATE) edge.last_restricted_update += interval;
} }
} }
} }

View File

@ -13,7 +13,6 @@
#include "../core/pool_type.hpp" #include "../core/pool_type.hpp"
#include "../station_base.h" #include "../station_base.h"
#include "../cargotype.h" #include "../cargotype.h"
#include "../date_type.h"
#include "../timer/timer_game_calendar.h" #include "../timer/timer_game_calendar.h"
#include "../saveload/saveload.h" #include "../saveload/saveload.h"
#include "linkgraph_type.h" #include "linkgraph_type.h"
@ -63,8 +62,8 @@ public:
TimerGameCalendar::Date LastUpdate() const { return std::max(this->last_unrestricted_update, this->last_restricted_update); } TimerGameCalendar::Date LastUpdate() const { return std::max(this->last_unrestricted_update, this->last_restricted_update); }
void Update(uint capacity, uint usage, uint32_t time, EdgeUpdateMode mode); void Update(uint capacity, uint usage, uint32_t time, EdgeUpdateMode mode);
void Restrict() { this->last_unrestricted_update = INVALID_DATE; } void Restrict() { this->last_unrestricted_update = CalendarTime::INVALID_DATE; }
void Release() { this->last_restricted_update = INVALID_DATE; } void Release() { this->last_restricted_update = CalendarTime::INVALID_DATE; }
/** Comparison operator based on \c dest_node. */ /** Comparison operator based on \c dest_node. */
bool operator <(const BaseEdge &rhs) const bool operator <(const BaseEdge &rhs) const

View File

@ -12,6 +12,7 @@
#include "../window_func.h" #include "../window_func.h"
#include "../company_base.h" #include "../company_base.h"
#include "../company_gui.h" #include "../company_gui.h"
#include "../timer/timer_game_tick.h"
#include "../timer/timer_game_calendar.h" #include "../timer/timer_game_calendar.h"
#include "../viewport_func.h" #include "../viewport_func.h"
#include "../zoom_func.h" #include "../zoom_func.h"
@ -221,7 +222,7 @@ void LinkGraphOverlay::AddLinks(const Station *from, const Station *to)
ConstEdge &edge = lg[ge.node][to->goods[c].node]; ConstEdge &edge = lg[ge.node][to->goods[c].node];
this->AddStats(c, lg.Monthly(edge.capacity), lg.Monthly(edge.usage), this->AddStats(c, lg.Monthly(edge.capacity), lg.Monthly(edge.usage),
ge.flows.GetFlowVia(to->index), ge.flows.GetFlowVia(to->index),
edge.TravelTime() / DAY_TICKS, edge.TravelTime() / Ticks::DAY_TICKS,
from->owner == OWNER_NONE || to->owner == OWNER_NONE, from->owner == OWNER_NONE || to->owner == OWNER_NONE,
this->cached_links[from->index][to->index]); this->cached_links[from->index][to->index]);
} }

View File

@ -37,7 +37,7 @@ LinkGraphJob::LinkGraphJob(const LinkGraph &orig) :
* This is on purpose. */ * This is on purpose. */
link_graph(orig), link_graph(orig),
settings(_settings_game.linkgraph), settings(_settings_game.linkgraph),
join_date(TimerGameCalendar::date + (_settings_game.linkgraph.recalc_time / SECONDS_PER_DAY)), join_date(TimerGameCalendar::date + (_settings_game.linkgraph.recalc_time / CalendarTime::SECONDS_PER_DAY)),
job_completed(false), job_completed(false),
job_aborted(false) job_aborted(false)
{ {
@ -131,14 +131,14 @@ LinkGraphJob::~LinkGraphJob()
if (st2 == nullptr || st2->goods[this->Cargo()].link_graph != this->link_graph.index || if (st2 == nullptr || st2->goods[this->Cargo()].link_graph != this->link_graph.index ||
st2->goods[this->Cargo()].node != dest_id || st2->goods[this->Cargo()].node != dest_id ||
!(*lg)[node_id].HasEdgeTo(dest_id) || !(*lg)[node_id].HasEdgeTo(dest_id) ||
(*lg)[node_id][dest_id].LastUpdate() == INVALID_DATE) { (*lg)[node_id][dest_id].LastUpdate() == CalendarTime::INVALID_DATE) {
/* Edge has been removed. Delete flows. */ /* Edge has been removed. Delete flows. */
StationIDStack erased = flows.DeleteFlows(to); StationIDStack erased = flows.DeleteFlows(to);
/* Delete old flows for source stations which have been deleted /* Delete old flows for source stations which have been deleted
* from the new flows. This avoids flow cycles between old and * from the new flows. This avoids flow cycles between old and
* new flows. */ * new flows. */
while (!erased.IsEmpty()) ge.flows.erase(erased.Pop()); while (!erased.IsEmpty()) ge.flows.erase(erased.Pop());
} else if ((*lg)[node_id][dest_id].last_restricted_update == INVALID_DATE) { } else if ((*lg)[node_id][dest_id].last_restricted_update == CalendarTime::INVALID_DATE) {
/* Edge is fully restricted. */ /* Edge is fully restricted. */
flows.RestrictFlows(to); flows.RestrictFlows(to);
} }

View File

@ -178,7 +178,7 @@ public:
* settings have to be brutally const-casted in order to populate them. * settings have to be brutally const-casted in order to populate them.
*/ */
LinkGraphJob() : settings(_settings_game.linkgraph), LinkGraphJob() : settings(_settings_game.linkgraph),
join_date(INVALID_DATE), job_completed(false), job_aborted(false) {} join_date(CalendarTime::INVALID_DATE), job_completed(false), job_aborted(false) {}
LinkGraphJob(const LinkGraph &orig); LinkGraphJob(const LinkGraph &orig);
~LinkGraphJob(); ~LinkGraphJob();

View File

@ -178,7 +178,7 @@ void StateGameLoop_LinkGraphPauseControl()
} }
} else if (_pause_mode == PM_UNPAUSED && } else if (_pause_mode == PM_UNPAUSED &&
TimerGameCalendar::date_fract == LinkGraphSchedule::SPAWN_JOIN_TICK - 2 && TimerGameCalendar::date_fract == LinkGraphSchedule::SPAWN_JOIN_TICK - 2 &&
static_cast<int32_t>(TimerGameCalendar::date) % (_settings_game.linkgraph.recalc_interval / SECONDS_PER_DAY) == (_settings_game.linkgraph.recalc_interval / SECONDS_PER_DAY) / 2 && static_cast<int32_t>(TimerGameCalendar::date) % (_settings_game.linkgraph.recalc_interval / CalendarTime::SECONDS_PER_DAY) == (_settings_game.linkgraph.recalc_interval / CalendarTime::SECONDS_PER_DAY) / 2 &&
LinkGraphSchedule::instance.IsJoinWithUnfinishedJobDue()) { LinkGraphSchedule::instance.IsJoinWithUnfinishedJobDue()) {
/* Perform check two TimerGameCalendar::date_fract ticks before we would join, to make /* Perform check two TimerGameCalendar::date_fract ticks before we would join, to make
* sure it also works in multiplayer. */ * sure it also works in multiplayer. */
@ -205,10 +205,10 @@ void AfterLoad_LinkGraphPauseControl()
void OnTick_LinkGraph() void OnTick_LinkGraph()
{ {
if (TimerGameCalendar::date_fract != LinkGraphSchedule::SPAWN_JOIN_TICK) return; if (TimerGameCalendar::date_fract != LinkGraphSchedule::SPAWN_JOIN_TICK) return;
TimerGameCalendar::Date offset = static_cast<int32_t>(TimerGameCalendar::date) % (_settings_game.linkgraph.recalc_interval / SECONDS_PER_DAY); TimerGameCalendar::Date offset = static_cast<int32_t>(TimerGameCalendar::date) % (_settings_game.linkgraph.recalc_interval / CalendarTime::SECONDS_PER_DAY);
if (offset == 0) { if (offset == 0) {
LinkGraphSchedule::instance.SpawnNext(); LinkGraphSchedule::instance.SpawnNext();
} else if (offset == (_settings_game.linkgraph.recalc_interval / SECONDS_PER_DAY) / 2) { } else if (offset == (_settings_game.linkgraph.recalc_interval / CalendarTime::SECONDS_PER_DAY) / 2) {
if (!_networking || _network_server) { if (!_networking || _network_server) {
PerformanceMeasurer::SetInactive(PFE_GL_LINKGRAPH); PerformanceMeasurer::SetInactive(PFE_GL_LINKGRAPH);
LinkGraphSchedule::instance.JoinNext(); LinkGraphSchedule::instance.JoinNext();

View File

@ -2,6 +2,7 @@
#include "../stdafx.h" #include "../stdafx.h"
#include "../core/math_func.hpp" #include "../core/math_func.hpp"
#include "../timer/timer_game_tick.h"
#include "mcf.h" #include "mcf.h"
#include "../safeguards.h" #include "../safeguards.h"
@ -290,7 +291,7 @@ void MultiCommodityFlow::Dijkstra(NodeID source_node, PathVector &paths)
IsCargoInClass(this->job.Cargo(), CC_EXPRESS); IsCargoInClass(this->job.Cargo(), CC_EXPRESS);
uint distance = DistanceMaxPlusManhattan(this->job[from].base.xy, this->job[to].base.xy) + 1; uint distance = DistanceMaxPlusManhattan(this->job[from].base.xy, this->job[to].base.xy) + 1;
/* Compute a default travel time from the distance and an average speed of 1 tile/day. */ /* Compute a default travel time from the distance and an average speed of 1 tile/day. */
uint time = (edge.base.TravelTime() != 0) ? edge.base.TravelTime() + DAY_TICKS : distance * DAY_TICKS; uint time = (edge.base.TravelTime() != 0) ? edge.base.TravelTime() + Ticks::DAY_TICKS : distance * Ticks::DAY_TICKS;
uint distance_anno = express ? time : distance; uint distance_anno = express ? time : distance;
Tannotation *dest = static_cast<Tannotation *>(paths[to]); Tannotation *dest = static_cast<Tannotation *>(paths[to]);

View File

@ -234,7 +234,7 @@ void LinkRefresher::RefreshStats(const Order *cur, const Order *next)
if (this->is_full_loading && this->vehicle->orders != nullptr && if (this->is_full_loading && this->vehicle->orders != nullptr &&
st->index == vehicle->last_station_visited && st->index == vehicle->last_station_visited &&
this->vehicle->orders->GetTotalDuration() > this->vehicle->orders->GetTotalDuration() >
(Ticks)this->vehicle->current_order_time) { (TimerGameTick::Ticks)this->vehicle->current_order_time) {
uint effective_capacity = cargo_quantity * this->vehicle->load_unload_ticks; uint effective_capacity = cargo_quantity * this->vehicle->load_unload_ticks;
if (effective_capacity > (uint)this->vehicle->orders->GetTotalDuration()) { if (effective_capacity > (uint)this->vehicle->orders->GetTotalDuration()) {
IncreaseStats(st, c, next_station, effective_capacity / IncreaseStats(st, c, next_station, effective_capacity /

View File

@ -138,7 +138,7 @@ public:
/* Because build_date is not set yet in every TileDesc, we make sure it is empty */ /* Because build_date is not set yet in every TileDesc, we make sure it is empty */
TileDesc td; TileDesc td;
td.build_date = INVALID_DATE; td.build_date = CalendarTime::INVALID_DATE;
/* Most tiles have only one owner, but /* Most tiles have only one owner, but
* - drivethrough roadstops can be build on town owned roads (up to 2 owners) and * - drivethrough roadstops can be build on town owned roads (up to 2 owners) and
@ -224,7 +224,7 @@ public:
this->landinfo_data.push_back(GetString(STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY)); this->landinfo_data.push_back(GetString(STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY));
/* Build date */ /* Build date */
if (td.build_date != INVALID_DATE) { if (td.build_date != CalendarTime::INVALID_DATE) {
SetDParam(0, td.build_date); SetDParam(0, td.build_date);
this->landinfo_data.push_back(GetString(STR_LAND_AREA_INFORMATION_BUILD_DATE)); this->landinfo_data.push_back(GetString(STR_LAND_AREA_INFORMATION_BUILD_DATE));
} }
@ -573,7 +573,7 @@ void ShowCostOrIncomeAnimation(int x, int y, int z, Money cost)
msg = STR_INCOME_FLOAT_INCOME; msg = STR_INCOME_FLOAT_INCOME;
} }
SetDParam(0, cost); SetDParam(0, cost);
AddTextEffect(msg, pt.x, pt.y, DAY_TICKS, TE_RISING); AddTextEffect(msg, pt.x, pt.y, Ticks::DAY_TICKS, TE_RISING);
} }
/** /**
@ -590,7 +590,7 @@ void ShowFeederIncomeAnimation(int x, int y, int z, Money transfer, Money income
SetDParam(0, transfer); SetDParam(0, transfer);
if (income == 0) { if (income == 0) {
AddTextEffect(STR_FEEDER, pt.x, pt.y, DAY_TICKS, TE_RISING); AddTextEffect(STR_FEEDER, pt.x, pt.y, Ticks::DAY_TICKS, TE_RISING);
} else { } else {
StringID msg = STR_FEEDER_COST; StringID msg = STR_FEEDER_COST;
if (income < 0) { if (income < 0) {
@ -598,7 +598,7 @@ void ShowFeederIncomeAnimation(int x, int y, int z, Money transfer, Money income
msg = STR_FEEDER_INCOME; msg = STR_FEEDER_INCOME;
} }
SetDParam(1, income); SetDParam(1, income);
AddTextEffect(msg, pt.x, pt.y, DAY_TICKS, TE_RISING); AddTextEffect(msg, pt.x, pt.y, Ticks::DAY_TICKS, TE_RISING);
} }
} }

View File

@ -255,8 +255,6 @@ void SerializeNetworkGameInfo(Packet *p, const NetworkServerGameInfo *info, bool
*/ */
void DeserializeNetworkGameInfo(Packet *p, NetworkGameInfo *info, const GameInfoNewGRFLookupTable *newgrf_lookup_table) void DeserializeNetworkGameInfo(Packet *p, NetworkGameInfo *info, const GameInfoNewGRFLookupTable *newgrf_lookup_table)
{ {
static const TimerGameCalendar::Date MAX_DATE = TimerGameCalendar::ConvertYMDToDate(MAX_YEAR, 11, 31); // December is month 11
byte game_info_version = p->Recv_uint8(); byte game_info_version = p->Recv_uint8();
NewGRFSerializationType newgrf_serialisation = NST_GRFID_MD5; NewGRFSerializationType newgrf_serialisation = NST_GRFID_MD5;
@ -323,8 +321,8 @@ void DeserializeNetworkGameInfo(Packet *p, NetworkGameInfo *info, const GameInfo
} }
case 3: case 3:
info->game_date = Clamp(p->Recv_uint32(), 0, static_cast<int32_t>(MAX_DATE)); info->game_date = Clamp(p->Recv_uint32(), 0, static_cast<int32_t>(CalendarTime::MAX_DATE));
info->start_date = Clamp(p->Recv_uint32(), 0, static_cast<int32_t>(MAX_DATE)); info->start_date = Clamp(p->Recv_uint32(), 0, static_cast<int32_t>(CalendarTime::MAX_DATE));
FALLTHROUGH; FALLTHROUGH;
case 2: case 2:
@ -342,8 +340,8 @@ void DeserializeNetworkGameInfo(Packet *p, NetworkGameInfo *info, const GameInfo
info->clients_on = p->Recv_uint8 (); info->clients_on = p->Recv_uint8 ();
info->spectators_on = p->Recv_uint8 (); info->spectators_on = p->Recv_uint8 ();
if (game_info_version < 3) { // 16 bits dates got scrapped and are read earlier if (game_info_version < 3) { // 16 bits dates got scrapped and are read earlier
info->game_date = p->Recv_uint16() + DAYS_TILL_ORIGINAL_BASE_YEAR; info->game_date = p->Recv_uint16() + CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR;
info->start_date = p->Recv_uint16() + DAYS_TILL_ORIGINAL_BASE_YEAR; info->start_date = p->Recv_uint16() + CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR;
} }
if (game_info_version < 6) while (p->Recv_uint8() != 0) {} // Used to contain the map-name. if (game_info_version < 6) while (p->Recv_uint8() != 0) {} // Used to contain the map-name.
info->map_width = p->Recv_uint16(); info->map_width = p->Recv_uint16();

View File

@ -11,6 +11,7 @@
#include "../strings_func.h" #include "../strings_func.h"
#include "../command_func.h" #include "../command_func.h"
#include "../timer/timer_game_tick.h"
#include "../timer/timer_game_calendar.h" #include "../timer/timer_game_calendar.h"
#include "network_admin.h" #include "network_admin.h"
#include "network_client.h" #include "network_client.h"
@ -274,8 +275,8 @@ uint NetworkCalculateLag(const NetworkClientSocket *cs)
/* This client has missed their ACK packet after 1 DAY_TICKS.. /* This client has missed their ACK packet after 1 DAY_TICKS..
* so we increase their lag for every frame that passes! * so we increase their lag for every frame that passes!
* The packet can be out by a max of _net_frame_freq */ * The packet can be out by a max of _net_frame_freq */
if (cs->last_frame_server + DAY_TICKS + _settings_client.network.frame_freq < _frame_counter) { if (cs->last_frame_server + Ticks::DAY_TICKS + _settings_client.network.frame_freq < _frame_counter) {
lag += _frame_counter - (cs->last_frame_server + DAY_TICKS + _settings_client.network.frame_freq); lag += _frame_counter - (cs->last_frame_server + Ticks::DAY_TICKS + _settings_client.network.frame_freq);
} }
return lag; return lag;
} }

View File

@ -14,7 +14,6 @@
#include "core/address.h" #include "core/address.h"
#include "../core/pool_type.hpp" #include "../core/pool_type.hpp"
#include "../company_type.h" #include "../company_type.h"
#include "../date_type.h"
#include "../timer/timer_game_calendar.h" #include "../timer/timer_game_calendar.h"
/** Type for the pool with client information. */ /** Type for the pool with client information. */

View File

@ -20,6 +20,7 @@
#include "../company_gui.h" #include "../company_gui.h"
#include "../company_cmd.h" #include "../company_cmd.h"
#include "../core/random_func.hpp" #include "../core/random_func.hpp"
#include "../timer/timer_game_tick.h"
#include "../timer/timer_game_calendar.h" #include "../timer/timer_game_calendar.h"
#include "../gfx_func.h" #include "../gfx_func.h"
#include "../error.h" #include "../error.h"
@ -876,7 +877,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_FRAME(Packet *p
/* Let the server know that we received this frame correctly /* Let the server know that we received this frame correctly
* We do this only once per day, to save some bandwidth ;) */ * We do this only once per day, to save some bandwidth ;) */
if (!_network_first_time && last_ack_frame < _frame_counter) { if (!_network_first_time && last_ack_frame < _frame_counter) {
last_ack_frame = _frame_counter + DAY_TICKS; last_ack_frame = _frame_counter + Ticks::DAY_TICKS;
Debug(net, 7, "Sent ACK at {}", _frame_counter); Debug(net, 7, "Sent ACK at {}", _frame_counter);
SendAck(); SendAck();
} }

View File

@ -1141,7 +1141,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_ACK(Packet *p)
/* The client is trying to catch up with the server */ /* The client is trying to catch up with the server */
if (this->status == STATUS_PRE_ACTIVE) { if (this->status == STATUS_PRE_ACTIVE) {
/* The client is not yet caught up? */ /* The client is not yet caught up? */
if (frame + DAY_TICKS < _frame_counter) return NETWORK_RECV_STATUS_OKAY; if (frame + Ticks::DAY_TICKS < _frame_counter) return NETWORK_RECV_STATUS_OKAY;
/* Now it is! Unpause the game */ /* Now it is! Unpause the game */
this->status = STATUS_ACTIVE; this->status = STATUS_ACTIVE;
@ -1724,7 +1724,7 @@ void NetworkServer_Tick(bool send_frame)
* did not receive a packet, then the client is not just * did not receive a packet, then the client is not just
* slow, but the connection is likely severed. Mentioning * slow, but the connection is likely severed. Mentioning
* frame_freq is not useful in this case. */ * frame_freq is not useful in this case. */
if (lag > (uint)DAY_TICKS && cs->lag_test == 0 && cs->last_packet + std::chrono::seconds(2) > std::chrono::steady_clock::now()) { if (lag > (uint)Ticks::DAY_TICKS && cs->lag_test == 0 && cs->last_packet + std::chrono::seconds(2) > std::chrono::steady_clock::now()) {
IConsolePrint(CC_WARNING, "[{}] Client #{} is slow, try increasing [network.]frame_freq to a higher value!", _frame_counter, cs->client_id); IConsolePrint(CC_WARNING, "[{}] Client #{} is slow, try increasing [network.]frame_freq to a higher value!", _frame_counter, cs->client_id);
cs->lag_test = 1; cs->lag_test = 1;
} }

View File

@ -996,7 +996,7 @@ static ChangeInfoResult CommonVehicleChangeInfo(EngineInfo *ei, int prop, ByteRe
{ {
switch (prop) { switch (prop) {
case 0x00: // Introduction date case 0x00: // Introduction date
ei->base_intro = buf->ReadWord() + DAYS_TILL_ORIGINAL_BASE_YEAR; ei->base_intro = buf->ReadWord() + CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR;
break; break;
case 0x02: // Decay speed case 0x02: // Decay speed
@ -2197,7 +2197,7 @@ static ChangeInfoResult BridgeChangeInfo(uint brid, int numinfo, int prop, ByteR
case 0x08: { // Year of availability case 0x08: { // Year of availability
/* We treat '0' as always available */ /* We treat '0' as always available */
byte year = buf->ReadByte(); byte year = buf->ReadByte();
bridge->avail_year = (year > 0 ? ORIGINAL_BASE_YEAR + year : 0); bridge->avail_year = (year > 0 ? CalendarTime::ORIGINAL_BASE_YEAR + year : 0);
break; break;
} }
@ -2257,7 +2257,7 @@ static ChangeInfoResult BridgeChangeInfo(uint brid, int numinfo, int prop, ByteR
break; break;
case 0x0F: // Long format year of availability (year since year 0) case 0x0F: // Long format year of availability (year since year 0)
bridge->avail_year = Clamp(TimerGameCalendar::Year(buf->ReadDWord()), MIN_YEAR, MAX_YEAR); bridge->avail_year = Clamp(TimerGameCalendar::Year(buf->ReadDWord()), CalendarTime::MIN_YEAR, CalendarTime::MAX_YEAR);
break; break;
case 0x10: { // purchase string case 0x10: { // purchase string
@ -2430,8 +2430,8 @@ static ChangeInfoResult TownHouseChangeInfo(uint hid, int numinfo, int prop, Byt
case 0x0A: { // Availability years case 0x0A: { // Availability years
uint16_t years = buf->ReadWord(); uint16_t years = buf->ReadWord();
housespec->min_year = GB(years, 0, 8) > 150 ? MAX_YEAR : ORIGINAL_BASE_YEAR + GB(years, 0, 8); housespec->min_year = GB(years, 0, 8) > 150 ? CalendarTime::MAX_YEAR : CalendarTime::ORIGINAL_BASE_YEAR + GB(years, 0, 8);
housespec->max_year = GB(years, 8, 8) > 150 ? MAX_YEAR : ORIGINAL_BASE_YEAR + GB(years, 8, 8); housespec->max_year = GB(years, 8, 8) > 150 ? CalendarTime::MAX_YEAR : CalendarTime::ORIGINAL_BASE_YEAR + GB(years, 8, 8);
break; break;
} }
@ -3991,7 +3991,7 @@ static ChangeInfoResult AirportChangeInfo(uint airport, int numinfo, int prop, B
case 0x0C: case 0x0C:
as->min_year = buf->ReadWord(); as->min_year = buf->ReadWord();
as->max_year = buf->ReadWord(); as->max_year = buf->ReadWord();
if (as->max_year == 0xFFFF) as->max_year = MAX_YEAR; if (as->max_year == 0xFFFF) as->max_year = CalendarTime::MAX_YEAR;
break; break;
case 0x0D: case 0x0D:
@ -6512,11 +6512,11 @@ bool GetGlobalVariable(byte param, uint32_t *value, const GRFFile *grffile)
{ {
switch (param) { switch (param) {
case 0x00: // current date case 0x00: // current date
*value = static_cast<int32_t>(std::max(TimerGameCalendar::date - DAYS_TILL_ORIGINAL_BASE_YEAR, TimerGameCalendar::Date(0))); *value = static_cast<int32_t>(std::max(TimerGameCalendar::date - CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR, TimerGameCalendar::Date(0)));
return true; return true;
case 0x01: // current year case 0x01: // current year
*value = static_cast<int32_t>(Clamp(TimerGameCalendar::year, ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR); *value = static_cast<int32_t>(Clamp(TimerGameCalendar::year, CalendarTime::ORIGINAL_BASE_YEAR, CalendarTime::ORIGINAL_MAX_YEAR) - CalendarTime::ORIGINAL_BASE_YEAR);
return true; return true;
case 0x02: { // detailed date information: month of year (bit 0-7), day of month (bit 8-12), leap year (bit 15), day of year (bit 16-24) case 0x02: { // detailed date information: month of year (bit 0-7), day of month (bit 8-12), leap year (bit 15), day of year (bit 16-24)
@ -7228,7 +7228,7 @@ static uint32_t GetPatchVariable(uint8_t param)
{ {
switch (param) { switch (param) {
/* start year - 1920 */ /* start year - 1920 */
case 0x0B: return static_cast<int32_t>(std::max(_settings_game.game_creation.starting_year, ORIGINAL_BASE_YEAR) - ORIGINAL_BASE_YEAR); case 0x0B: return static_cast<int32_t>(std::max(_settings_game.game_creation.starting_year, CalendarTime::ORIGINAL_BASE_YEAR) - CalendarTime::ORIGINAL_BASE_YEAR);
/* freight trains weight factor */ /* freight trains weight factor */
case 0x0E: return _settings_game.vehicle.freight_trains; case 0x0E: return _settings_game.vehicle.freight_trains;
@ -9237,7 +9237,7 @@ static bool IsHouseSpecValid(HouseSpec *hs, const HouseSpec *next1, const HouseS
*/ */
static void EnsureEarlyHouse(HouseZones bitmask) static void EnsureEarlyHouse(HouseZones bitmask)
{ {
TimerGameCalendar::Year min_year = MAX_YEAR; TimerGameCalendar::Year min_year = CalendarTime::MAX_YEAR;
for (int i = 0; i < NUM_HOUSES; i++) { for (int i = 0; i < NUM_HOUSES; i++) {
HouseSpec *hs = HouseSpec::Get(i); HouseSpec *hs = HouseSpec::Get(i);

View File

@ -212,7 +212,7 @@ void AirportOverrideManager::SetEntitySpec(AirportSpec *as)
case 0x7C: return (this->st->airport.psa != nullptr) ? this->st->airport.psa->GetValue(parameter) : 0; case 0x7C: return (this->st->airport.psa != nullptr) ? this->st->airport.psa->GetValue(parameter) : 0;
case 0xF0: return this->st->facilities; case 0xF0: return this->st->facilities;
case 0xFA: return ClampTo<uint16_t>(this->st->build_date - DAYS_TILL_ORIGINAL_BASE_YEAR); case 0xFA: return ClampTo<uint16_t>(this->st->build_date - CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR);
} }
return this->st->GetNewGRFVariable(this->ro, variable, parameter, available); return this->st->GetNewGRFVariable(this->ro, variable, parameter, available);

View File

@ -11,7 +11,6 @@
#define NEWGRF_AIRPORT_H #define NEWGRF_AIRPORT_H
#include "airport.h" #include "airport.h"
#include "date_type.h"
#include "timer/timer_game_calendar.h" #include "timer/timer_game_calendar.h"
#include "newgrf_class.h" #include "newgrf_class.h"
#include "newgrf_commons.h" #include "newgrf_commons.h"

View File

@ -767,8 +767,8 @@ static uint32_t VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *objec
} }
return (variable - 0x80) == 0x10 ? ticks : GB(ticks, 8, 8); return (variable - 0x80) == 0x10 ? ticks : GB(ticks, 8, 8);
} }
case 0x12: return ClampTo<uint16_t>(v->date_of_last_service_newgrf - DAYS_TILL_ORIGINAL_BASE_YEAR); case 0x12: return ClampTo<uint16_t>(v->date_of_last_service_newgrf - CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR);
case 0x13: return GB(ClampTo<uint16_t>(v->date_of_last_service_newgrf - DAYS_TILL_ORIGINAL_BASE_YEAR), 8, 8); case 0x13: return GB(ClampTo<uint16_t>(v->date_of_last_service_newgrf - CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR), 8, 8);
case 0x14: return v->GetServiceInterval(); case 0x14: return v->GetServiceInterval();
case 0x15: return GB(v->GetServiceInterval(), 8, 8); case 0x15: return GB(v->GetServiceInterval(), 8, 8);
case 0x16: return v->last_station_visited; case 0x16: return v->last_station_visited;
@ -829,7 +829,7 @@ static uint32_t VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *objec
case 0x41: return GB(ClampTo<uint16_t>(v->age), 8, 8); case 0x41: return GB(ClampTo<uint16_t>(v->age), 8, 8);
case 0x42: return ClampTo<uint16_t>(v->max_age); case 0x42: return ClampTo<uint16_t>(v->max_age);
case 0x43: return GB(ClampTo<uint16_t>(v->max_age), 8, 8); case 0x43: return GB(ClampTo<uint16_t>(v->max_age), 8, 8);
case 0x44: return static_cast<int32_t>(Clamp(v->build_year, ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR); case 0x44: return static_cast<int32_t>(Clamp(v->build_year, CalendarTime::ORIGINAL_BASE_YEAR, CalendarTime::ORIGINAL_MAX_YEAR) - CalendarTime::ORIGINAL_BASE_YEAR);
case 0x45: return v->unitnumber; case 0x45: return v->unitnumber;
case 0x46: return v->GetEngine()->grf_prop.local_id; case 0x46: return v->GetEngine()->grf_prop.local_id;
case 0x47: return GB(v->GetEngine()->grf_prop.local_id, 8, 8); case 0x47: return GB(v->GetEngine()->grf_prop.local_id, 8, 8);
@ -974,9 +974,9 @@ static uint32_t VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *objec
case 0x48: return Engine::Get(this->self_type)->flags; // Vehicle Type Info case 0x48: return Engine::Get(this->self_type)->flags; // Vehicle Type Info
case 0x49: return static_cast<int32_t>(TimerGameCalendar::year); // 'Long' format build year case 0x49: return static_cast<int32_t>(TimerGameCalendar::year); // 'Long' format build year
case 0x4B: return static_cast<int32_t>(TimerGameCalendar::date); // Long date of last service case 0x4B: return static_cast<int32_t>(TimerGameCalendar::date); // Long date of last service
case 0x92: return ClampTo<uint16_t>(TimerGameCalendar::date - DAYS_TILL_ORIGINAL_BASE_YEAR); // Date of last service case 0x92: return ClampTo<uint16_t>(TimerGameCalendar::date - CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR); // Date of last service
case 0x93: return GB(ClampTo<uint16_t>(TimerGameCalendar::date - DAYS_TILL_ORIGINAL_BASE_YEAR), 8, 8); case 0x93: return GB(ClampTo<uint16_t>(TimerGameCalendar::date - CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR), 8, 8);
case 0xC4: return static_cast<int32_t>(Clamp(TimerGameCalendar::year, ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR); // Build year case 0xC4: return static_cast<int32_t>(Clamp(TimerGameCalendar::year, CalendarTime::ORIGINAL_BASE_YEAR, CalendarTime::ORIGINAL_MAX_YEAR) - CalendarTime::ORIGINAL_BASE_YEAR); // Build year
case 0xC6: return Engine::Get(this->self_type)->grf_prop.local_id; case 0xC6: return Engine::Get(this->self_type)->grf_prop.local_id;
case 0xC7: return GB(Engine::Get(this->self_type)->grf_prop.local_id, 8, 8); case 0xC7: return GB(Engine::Get(this->self_type)->grf_prop.local_id, 8, 8);
case 0xDA: return INVALID_VEHICLE; // Next vehicle case 0xDA: return INVALID_VEHICLE; // Next vehicle

View File

@ -396,16 +396,16 @@ static uint32_t GetCountAndDistanceOfClosestInstance(byte param_setID, byte layo
case 0xA6: return indspec->grf_prop.local_id; case 0xA6: return indspec->grf_prop.local_id;
case 0xA7: return this->industry->founder; case 0xA7: return this->industry->founder;
case 0xA8: return this->industry->random_colour; case 0xA8: return this->industry->random_colour;
case 0xA9: return ClampTo<uint8_t>(this->industry->last_prod_year - ORIGINAL_BASE_YEAR); case 0xA9: return ClampTo<uint8_t>(this->industry->last_prod_year - CalendarTime::ORIGINAL_BASE_YEAR);
case 0xAA: return this->industry->counter; case 0xAA: return this->industry->counter;
case 0xAB: return GB(this->industry->counter, 8, 8); case 0xAB: return GB(this->industry->counter, 8, 8);
case 0xAC: return this->industry->was_cargo_delivered; case 0xAC: return this->industry->was_cargo_delivered;
case 0xB0: return ClampTo<uint16_t>(this->industry->construction_date - DAYS_TILL_ORIGINAL_BASE_YEAR); // Date when built since 1920 (in days) case 0xB0: return ClampTo<uint16_t>(this->industry->construction_date - CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR); // Date when built since 1920 (in days)
case 0xB3: return this->industry->construction_type; // Construction type case 0xB3: return this->industry->construction_type; // Construction type
case 0xB4: { case 0xB4: {
auto it = std::max_element(std::begin(this->industry->accepted), std::end(this->industry->accepted), [](const auto &a, const auto &b) { return a.last_accepted < b.last_accepted; }); auto it = std::max_element(std::begin(this->industry->accepted), std::end(this->industry->accepted), [](const auto &a, const auto &b) { return a.last_accepted < b.last_accepted; });
return ClampTo<uint16_t>(it->last_accepted - DAYS_TILL_ORIGINAL_BASE_YEAR); // Date last cargo accepted since 1920 (in days) return ClampTo<uint16_t>(it->last_accepted - CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR); // Date last cargo accepted since 1920 (in days)
} }
} }

View File

@ -11,7 +11,6 @@
#define NEWGRF_PROFILING_H #define NEWGRF_PROFILING_H
#include "stdafx.h" #include "stdafx.h"
#include "date_type.h"
#include "timer/timer_game_calendar.h" #include "timer/timer_game_calendar.h"
#include "newgrf.h" #include "newgrf.h"
#include "newgrf_callbacks.h" #include "newgrf_callbacks.h"

View File

@ -173,7 +173,7 @@ uint32_t RoadStopScopeResolver::GetVariable(byte variable, uint32_t parameter, b
case 0xF0: return this->st == nullptr ? 0 : this->st->facilities; // facilities case 0xF0: return this->st == nullptr ? 0 : this->st->facilities; // facilities
case 0xFA: return ClampTo<uint16_t>((this->st == nullptr ? TimerGameCalendar::date : this->st->build_date) - DAYS_TILL_ORIGINAL_BASE_YEAR); // build date case 0xFA: return ClampTo<uint16_t>((this->st == nullptr ? TimerGameCalendar::date : this->st->build_date) - CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR); // build date
} }
if (this->st != nullptr) return this->st->GetNewGRFVariable(this->ro, variable, parameter, available); if (this->st != nullptr) return this->st->GetNewGRFVariable(this->ro, variable, parameter, available);

View File

@ -291,7 +291,7 @@ TownScopeResolver *StationResolverObject::GetTown()
} }
break; break;
case 0xFA: return ClampTo<uint16_t>(TimerGameCalendar::date - DAYS_TILL_ORIGINAL_BASE_YEAR); // Build date, clamped to a 16 bit value case 0xFA: return ClampTo<uint16_t>(TimerGameCalendar::date - CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR); // Build date, clamped to a 16 bit value
} }
*available = false; *available = false;
@ -381,7 +381,7 @@ TownScopeResolver *StationResolverObject::GetTown()
case 0x84: return this->st->string_id; case 0x84: return this->st->string_id;
case 0x86: return 0; case 0x86: return 0;
case 0xF0: return this->st->facilities; case 0xF0: return this->st->facilities;
case 0xFA: return ClampTo<uint16_t>(this->st->build_date - DAYS_TILL_ORIGINAL_BASE_YEAR); case 0xFA: return ClampTo<uint16_t>(this->st->build_date - CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR);
} }
return this->st->GetNewGRFVariable(this->ro, variable, parameter, available); return this->st->GetNewGRFVariable(this->ro, variable, parameter, available);

View File

@ -23,7 +23,7 @@
#include "newgrf_text.h" #include "newgrf_text.h"
#include "newgrf_cargo.h" #include "newgrf_cargo.h"
#include "string_func.h" #include "string_func.h"
#include "date_type.h" #include "timer/timer_game_calendar.h"
#include "debug.h" #include "debug.h"
#include "core/alloc_type.hpp" #include "core/alloc_type.hpp"
#include "language.h" #include "language.h"
@ -912,7 +912,7 @@ uint RemapNewGRFStringControlCode(uint scc, const char **str, StringParameters &
/* Dates from NewGRFs have 1920-01-01 as their zero point, convert it to OpenTTD's epoch. */ /* Dates from NewGRFs have 1920-01-01 as their zero point, convert it to OpenTTD's epoch. */
case SCC_NEWGRF_PRINT_WORD_DATE_LONG: case SCC_NEWGRF_PRINT_WORD_DATE_LONG:
case SCC_NEWGRF_PRINT_WORD_DATE_SHORT: parameters.SetParam(0, _newgrf_textrefstack.PopUnsignedWord() + DAYS_TILL_ORIGINAL_BASE_YEAR); break; case SCC_NEWGRF_PRINT_WORD_DATE_SHORT: parameters.SetParam(0, _newgrf_textrefstack.PopUnsignedWord() + CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR); break;
case SCC_NEWGRF_DISCARD_WORD: _newgrf_textrefstack.PopUnsignedWord(); break; case SCC_NEWGRF_DISCARD_WORD: _newgrf_textrefstack.PopUnsignedWord(); break;

View File

@ -11,6 +11,7 @@
#include "debug.h" #include "debug.h"
#include "town.h" #include "town.h"
#include "newgrf_town.h" #include "newgrf_town.h"
#include "timer/timer_game_tick.h"
#include "safeguards.h" #include "safeguards.h"
@ -47,7 +48,7 @@
case 0x81: return GB(static_cast<uint32_t>(this->t->xy), 8, 8); case 0x81: return GB(static_cast<uint32_t>(this->t->xy), 8, 8);
case 0x82: return ClampTo<uint16_t>(this->t->cache.population); case 0x82: return ClampTo<uint16_t>(this->t->cache.population);
case 0x83: return GB(ClampTo<uint16_t>(this->t->cache.population), 8, 8); case 0x83: return GB(ClampTo<uint16_t>(this->t->cache.population), 8, 8);
case 0x8A: return this->t->grow_counter / TOWN_GROWTH_TICKS; case 0x8A: return this->t->grow_counter / Ticks::TOWN_GROWTH_TICKS;
case 0x92: return this->t->flags; // In original game, 0x92 and 0x93 are really one word. Since flags is a byte, this is to adjust case 0x92: return this->t->flags; // In original game, 0x92 and 0x93 are really one word. Since flags is a byte, this is to adjust
case 0x93: return 0; case 0x93: return 0;
case 0x94: return ClampTo<uint16_t>(this->t->cache.squared_town_zone_radius[0]); case 0x94: return ClampTo<uint16_t>(this->t->cache.squared_town_zone_radius[0]);
@ -79,7 +80,7 @@
case 0xAE: return this->t->have_ratings; case 0xAE: return this->t->have_ratings;
case 0xB2: return this->t->statues; case 0xB2: return this->t->statues;
case 0xB6: return ClampTo<uint16_t>(this->t->cache.num_houses); case 0xB6: return ClampTo<uint16_t>(this->t->cache.num_houses);
case 0xB9: return this->t->growth_rate / TOWN_GROWTH_TICKS; case 0xB9: return this->t->growth_rate / Ticks::TOWN_GROWTH_TICKS;
case 0xBA: return ClampTo<uint16_t>(this->t->supplied[CT_PASSENGERS].new_max); case 0xBA: return ClampTo<uint16_t>(this->t->supplied[CT_PASSENGERS].new_max);
case 0xBB: return GB(ClampTo<uint16_t>(this->t->supplied[CT_PASSENGERS].new_max), 8, 8); case 0xBB: return GB(ClampTo<uint16_t>(this->t->supplied[CT_PASSENGERS].new_max), 8, 8);
case 0xBC: return ClampTo<uint16_t>(this->t->supplied[CT_MAIL].new_max); case 0xBC: return ClampTo<uint16_t>(this->t->supplied[CT_MAIL].new_max);

View File

@ -1134,7 +1134,7 @@ struct MessageHistoryWindow : Window {
/* Months are off-by-one, so it's actually 8. Not using /* Months are off-by-one, so it's actually 8. Not using
* month 12 because the 1 is usually less wide. */ * month 12 because the 1 is usually less wide. */
SetDParam(0, TimerGameCalendar::ConvertYMDToDate(ORIGINAL_MAX_YEAR, 7, 30)); SetDParam(0, TimerGameCalendar::ConvertYMDToDate(CalendarTime::ORIGINAL_MAX_YEAR, 7, 30));
this->date_width = GetStringBoundingBox(STR_JUST_DATE_TINY).width + WidgetDimensions::scaled.hsep_wide; this->date_width = GetStringBoundingBox(STR_JUST_DATE_TINY).width + WidgetDimensions::scaled.hsep_wide;
size->height = 4 * resize->height + WidgetDimensions::scaled.framerect.Vertical(); // At least 4 lines are visible. size->height = 4 * resize->height + WidgetDimensions::scaled.framerect.Vertical(); // At least 4 lines are visible.

View File

@ -380,7 +380,7 @@ void OpenBrowser(const char *url)
/** Callback structure of statements to be executed after the NewGRF scan. */ /** Callback structure of statements to be executed after the NewGRF scan. */
struct AfterNewGRFScan : NewGRFScanCallback { struct AfterNewGRFScan : NewGRFScanCallback {
TimerGameCalendar::Year startyear = INVALID_YEAR; ///< The start year. TimerGameCalendar::Year startyear = CalendarTime::INVALID_YEAR; ///< The start year.
uint32_t generation_seed = GENERATE_NEW_SEED; ///< Seed for the new game. uint32_t generation_seed = GENERATE_NEW_SEED; ///< Seed for the new game.
std::string dedicated_host; ///< Hostname for the dedicated server. std::string dedicated_host; ///< Hostname for the dedicated server.
uint16_t dedicated_port = 0; ///< Port for the dedicated server. uint16_t dedicated_port = 0; ///< Port for the dedicated server.
@ -429,7 +429,7 @@ struct AfterNewGRFScan : NewGRFScanCallback {
MusicDriver::GetInstance()->SetVolume(_settings_client.music.music_vol); MusicDriver::GetInstance()->SetVolume(_settings_client.music.music_vol);
SetEffectVolume(_settings_client.music.effect_vol); SetEffectVolume(_settings_client.music.effect_vol);
if (startyear != INVALID_YEAR) IConsoleSetSetting("game_creation.starting_year", static_cast<int32_t>(startyear)); if (startyear != CalendarTime::INVALID_YEAR) IConsoleSetSetting("game_creation.starting_year", static_cast<int32_t>(startyear));
if (generation_seed != GENERATE_NEW_SEED) _settings_newgame.game_creation.generation_seed = generation_seed; if (generation_seed != GENERATE_NEW_SEED) _settings_newgame.game_creation.generation_seed = generation_seed;
if (!dedicated_host.empty()) { if (!dedicated_host.empty()) {

View File

@ -17,7 +17,7 @@
#include "depot_type.h" #include "depot_type.h"
#include "station_type.h" #include "station_type.h"
#include "vehicle_type.h" #include "vehicle_type.h"
#include "date_type.h" #include "timer/timer_game_tick.h"
#include "saveload/saveload.h" #include "saveload/saveload.h"
typedef Pool<Order, OrderID, 256, 0xFF0000> OrderPool; typedef Pool<Order, OrderID, 256, 0xFF0000> OrderPool;
@ -268,8 +268,8 @@ private:
uint num_vehicles; ///< NOSAVE: Number of vehicles that share this order list. uint num_vehicles; ///< NOSAVE: Number of vehicles that share this order list.
Vehicle *first_shared; ///< NOSAVE: pointer to the first vehicle in the shared order chain. Vehicle *first_shared; ///< NOSAVE: pointer to the first vehicle in the shared order chain.
Ticks timetable_duration; ///< NOSAVE: Total timetabled duration of the order list. TimerGameTick::Ticks timetable_duration; ///< NOSAVE: Total timetabled duration of the order list.
Ticks total_duration; ///< NOSAVE: Total (timetabled or not) duration of the order list. TimerGameTick::Ticks total_duration; ///< NOSAVE: Total (timetabled or not) duration of the order list.
public: public:
/** Default constructor producing an invalid order list. */ /** Default constructor producing an invalid order list. */
@ -366,34 +366,34 @@ public:
bool IsCompleteTimetable() const; bool IsCompleteTimetable() const;
/** /**
* Gets the total duration of the vehicles timetable or INVALID_TICKS is the timetable is not complete. * Gets the total duration of the vehicles timetable or Ticks::INVALID_TICKS is the timetable is not complete.
* @return total timetable duration or INVALID_TICKS for incomplete timetables * @return total timetable duration or Ticks::INVALID_TICKS for incomplete timetables
*/ */
inline Ticks GetTimetableTotalDuration() const { return this->IsCompleteTimetable() ? this->timetable_duration : INVALID_TICKS; } inline TimerGameTick::Ticks GetTimetableTotalDuration() const { return this->IsCompleteTimetable() ? this->timetable_duration : Ticks::INVALID_TICKS; }
/** /**
* Gets the known duration of the vehicles timetable even if the timetable is not complete. * Gets the known duration of the vehicles timetable even if the timetable is not complete.
* @return known timetable duration * @return known timetable duration
*/ */
inline Ticks GetTimetableDurationIncomplete() const { return this->timetable_duration; } inline TimerGameTick::Ticks GetTimetableDurationIncomplete() const { return this->timetable_duration; }
/** /**
* Gets the known duration of the vehicles orders, timetabled or not. * Gets the known duration of the vehicles orders, timetabled or not.
* @return known order duration. * @return known order duration.
*/ */
inline Ticks GetTotalDuration() const { return this->total_duration; } inline TimerGameTick::Ticks GetTotalDuration() const { return this->total_duration; }
/** /**
* Must be called if an order's timetable is changed to update internal book keeping. * Must be called if an order's timetable is changed to update internal book keeping.
* @param delta By how many ticks has the timetable duration changed * @param delta By how many ticks has the timetable duration changed
*/ */
void UpdateTimetableDuration(Ticks delta) { this->timetable_duration += delta; } void UpdateTimetableDuration(TimerGameTick::Ticks delta) { this->timetable_duration += delta; }
/** /**
* Must be called if an order's timetable is changed to update internal book keeping. * Must be called if an order's timetable is changed to update internal book keeping.
* @param delta By how many ticks has the total duration changed * @param delta By how many ticks has the total duration changed
*/ */
void UpdateTotalDuration(Ticks delta) { this->total_duration += delta; } void UpdateTotalDuration(TimerGameTick::Ticks delta) { this->total_duration += delta; }
void FreeChain(bool keep_orderlist = false); void FreeChain(bool keep_orderlist = false);

View File

@ -619,8 +619,8 @@ void OrderList::DebugCheckSanity() const
VehicleOrderID check_num_orders = 0; VehicleOrderID check_num_orders = 0;
VehicleOrderID check_num_manual_orders = 0; VehicleOrderID check_num_manual_orders = 0;
uint check_num_vehicles = 0; uint check_num_vehicles = 0;
Ticks check_timetable_duration = 0; TimerGameTick::Ticks check_timetable_duration = 0;
Ticks check_total_duration = 0; TimerGameTick::Ticks check_total_duration = 0;
Debug(misc, 6, "Checking OrderList {} for sanity...", this->index); Debug(misc, 6, "Checking OrderList {} for sanity...", this->index);
@ -1947,10 +1947,10 @@ VehicleOrderID ProcessConditionalOrder(const Order *order, const Vehicle *v)
case OCV_RELIABILITY: skip_order = OrderConditionCompare(occ, ToPercent16(v->reliability), value); break; case OCV_RELIABILITY: skip_order = OrderConditionCompare(occ, ToPercent16(v->reliability), value); break;
case OCV_MAX_RELIABILITY: skip_order = OrderConditionCompare(occ, ToPercent16(v->GetEngine()->reliability), value); break; case OCV_MAX_RELIABILITY: skip_order = OrderConditionCompare(occ, ToPercent16(v->GetEngine()->reliability), value); break;
case OCV_MAX_SPEED: skip_order = OrderConditionCompare(occ, v->GetDisplayMaxSpeed() * 10 / 16, value); break; case OCV_MAX_SPEED: skip_order = OrderConditionCompare(occ, v->GetDisplayMaxSpeed() * 10 / 16, value); break;
case OCV_AGE: skip_order = OrderConditionCompare(occ, DateToYear(v->age), value); break; case OCV_AGE: skip_order = OrderConditionCompare(occ, TimerGameCalendar::DateToYear(v->age), value); break;
case OCV_REQUIRES_SERVICE: skip_order = OrderConditionCompare(occ, v->NeedsServicing(), value); break; case OCV_REQUIRES_SERVICE: skip_order = OrderConditionCompare(occ, v->NeedsServicing(), value); break;
case OCV_UNCONDITIONALLY: skip_order = true; break; case OCV_UNCONDITIONALLY: skip_order = true; break;
case OCV_REMAINING_LIFETIME: skip_order = OrderConditionCompare(occ, std::max(DateToYear(v->max_age - v->age + DAYS_IN_LEAP_YEAR - 1), TimerGameCalendar::Year(0)), value); break; case OCV_REMAINING_LIFETIME: skip_order = OrderConditionCompare(occ, std::max(TimerGameCalendar::DateToYear(v->max_age - v->age + CalendarTime::DAYS_IN_LEAP_YEAR - 1), TimerGameCalendar::Year(0)), value); break;
default: NOT_REACHED(); default: NOT_REACHED();
} }

View File

@ -225,7 +225,7 @@ RailTypes AddDateIntroducedRailTypes(RailTypes current, TimerGameCalendar::Date
if (rti->label == 0) continue; if (rti->label == 0) continue;
/* Not date introduced. */ /* Not date introduced. */
if (!IsInsideMM(rti->introduction_date, 0, static_cast<int32_t>(MAX_DATE))) continue; if (!IsInsideMM(rti->introduction_date, 0, static_cast<int32_t>(CalendarTime::MAX_DATE))) continue;
/* Not yet introduced at this date. */ /* Not yet introduced at this date. */
if (rti->introduction_date > date) continue; if (rti->introduction_date > date) continue;
@ -256,7 +256,7 @@ RailTypes GetCompanyRailtypes(CompanyID company, bool introduces)
const EngineInfo *ei = &e->info; const EngineInfo *ei = &e->info;
if (HasBit(ei->climates, _settings_game.game_creation.landscape) && if (HasBit(ei->climates, _settings_game.game_creation.landscape) &&
(HasBit(e->company_avail, company) || TimerGameCalendar::date >= e->intro_date + DAYS_IN_YEAR)) { (HasBit(e->company_avail, company) || TimerGameCalendar::date >= e->intro_date + CalendarTime::DAYS_IN_YEAR)) {
const RailVehicleInfo *rvi = &e->u.rail; const RailVehicleInfo *rvi = &e->u.rail;
if (rvi->railveh_type != RAILVEH_WAGON) { if (rvi->railveh_type != RAILVEH_WAGON) {
@ -298,7 +298,7 @@ RailTypes GetRailTypes(bool introduces)
} }
} }
if (introduces) return AddDateIntroducedRailTypes(rts, MAX_DATE); if (introduces) return AddDateIntroducedRailTypes(rts, CalendarTime::MAX_DATE);
return rts; return rts;
} }

View File

@ -17,7 +17,6 @@
#include "economy_func.h" #include "economy_func.h"
#include "slope_type.h" #include "slope_type.h"
#include "strings_type.h" #include "strings_type.h"
#include "date_type.h"
#include "timer/timer_game_calendar.h" #include "timer/timer_game_calendar.h"
#include "signal_type.h" #include "signal_type.h"
#include "settings_type.h" #include "settings_type.h"

View File

@ -115,7 +115,7 @@ bool HasRoadTypeAvail(const CompanyID company, RoadType roadtype)
if (rti->label == 0) return false; if (rti->label == 0) return false;
/* Not yet introduced at this date. */ /* Not yet introduced at this date. */
if (IsInsideMM(rti->introduction_date, 0, static_cast<int32_t>(MAX_DATE)) && rti->introduction_date > TimerGameCalendar::date) return false; if (IsInsideMM(rti->introduction_date, 0, static_cast<int32_t>(CalendarTime::MAX_DATE)) && rti->introduction_date > TimerGameCalendar::date) return false;
/* /*
* Do not allow building hidden road types, except when a town may build it. * Do not allow building hidden road types, except when a town may build it.
@ -173,7 +173,7 @@ RoadTypes AddDateIntroducedRoadTypes(RoadTypes current, TimerGameCalendar::Date
if (rti->label == 0) continue; if (rti->label == 0) continue;
/* Not date introduced. */ /* Not date introduced. */
if (!IsInsideMM(rti->introduction_date, 0, static_cast<int32_t>(MAX_DATE))) continue; if (!IsInsideMM(rti->introduction_date, 0, static_cast<int32_t>(CalendarTime::MAX_DATE))) continue;
/* Not yet introduced at this date. */ /* Not yet introduced at this date. */
if (rti->introduction_date > date) continue; if (rti->introduction_date > date) continue;
@ -204,7 +204,7 @@ RoadTypes GetCompanyRoadTypes(CompanyID company, bool introduces)
const EngineInfo *ei = &e->info; const EngineInfo *ei = &e->info;
if (HasBit(ei->climates, _settings_game.game_creation.landscape) && if (HasBit(ei->climates, _settings_game.game_creation.landscape) &&
(HasBit(e->company_avail, company) || TimerGameCalendar::date >= e->intro_date + DAYS_IN_YEAR)) { (HasBit(e->company_avail, company) || TimerGameCalendar::date >= e->intro_date + CalendarTime::DAYS_IN_YEAR)) {
const RoadVehicleInfo *rvi = &e->u.road; const RoadVehicleInfo *rvi = &e->u.road;
assert(rvi->roadtype < ROADTYPE_END); assert(rvi->roadtype < ROADTYPE_END);
if (introduces) { if (introduces) {
@ -241,7 +241,7 @@ RoadTypes GetRoadTypes(bool introduces)
} }
} }
if (introduces) return AddDateIntroducedRoadTypes(rts, MAX_DATE); if (introduces) return AddDateIntroducedRoadTypes(rts, CalendarTime::MAX_DATE);
return rts; return rts;
} }
@ -302,7 +302,7 @@ RoadTypes ExistingRoadTypes(CompanyID c)
} }
/* Get the date introduced roadtypes as well. */ /* Get the date introduced roadtypes as well. */
known_roadtypes = AddDateIntroducedRoadTypes(known_roadtypes, MAX_DATE); known_roadtypes = AddDateIntroducedRoadTypes(known_roadtypes, CalendarTime::MAX_DATE);
return known_roadtypes; return known_roadtypes;
} }

View File

@ -150,7 +150,7 @@ RoadType AllocateRoadType(RoadTypeLabel label, RoadTramType rtt)
rti->label = label; rti->label = label;
rti->alternate_labels.clear(); rti->alternate_labels.clear();
rti->flags = ROTFB_NONE; rti->flags = ROTFB_NONE;
rti->introduction_date = INVALID_DATE; rti->introduction_date = CalendarTime::INVALID_DATE;
/* Make us compatible with ourself. */ /* Make us compatible with ourself. */
rti->powered_roadtypes = (RoadTypes)(1ULL << rt); rti->powered_roadtypes = (RoadTypes)(1ULL << rt);

View File

@ -1720,7 +1720,7 @@ void RoadVehicle::OnNewDay()
if (this->running_ticks == 0) return; if (this->running_ticks == 0) return;
CommandCost cost(EXPENSES_ROADVEH_RUN, this->GetRunningCost() * this->running_ticks / (DAYS_IN_YEAR * DAY_TICKS)); CommandCost cost(EXPENSES_ROADVEH_RUN, this->GetRunningCost() * this->running_ticks / (CalendarTime::DAYS_IN_YEAR * Ticks::DAY_TICKS));
this->profit_this_year -= cost.GetCost(); this->profit_this_year -= cost.GetCost();
this->running_ticks = 0; this->running_ticks = 0;

View File

@ -259,7 +259,7 @@ static void InitializeWindowsAndCaches()
/* For each company, verify (while loading a scenario) that the inauguration date is the current year and set it /* For each company, verify (while loading a scenario) that the inauguration date is the current year and set it
* accordingly if it is not the case. No need to set it on companies that are not been used already, * accordingly if it is not the case. No need to set it on companies that are not been used already,
* thus the MIN_YEAR (which is really nothing more than Zero, initialized value) test */ * thus the MIN_YEAR (which is really nothing more than Zero, initialized value) test */
if (_file_to_saveload.abstract_ftype == FT_SCENARIO && c->inaugurated_year != MIN_YEAR) { if (_file_to_saveload.abstract_ftype == FT_SCENARIO && c->inaugurated_year != CalendarTime::MIN_YEAR) {
c->inaugurated_year = TimerGameCalendar::year; c->inaugurated_year = TimerGameCalendar::year;
} }
} }
@ -727,7 +727,7 @@ bool AfterLoadGame()
} }
/* The value of TimerGameCalendar::date_fract got divided, so make sure that old games are converted correctly. */ /* The value of TimerGameCalendar::date_fract got divided, so make sure that old games are converted correctly. */
if (IsSavegameVersionBefore(SLV_11, 1) || (IsSavegameVersionBefore(SLV_147) && TimerGameCalendar::date_fract > DAY_TICKS)) TimerGameCalendar::date_fract /= 885; if (IsSavegameVersionBefore(SLV_11, 1) || (IsSavegameVersionBefore(SLV_147) && TimerGameCalendar::date_fract > Ticks::DAY_TICKS)) TimerGameCalendar::date_fract /= 885;
/* Update current year /* Update current year
* must be done before loading sprites as some newgrfs check it */ * must be done before loading sprites as some newgrfs check it */
@ -776,13 +776,13 @@ bool AfterLoadGame()
} }
if (IsSavegameVersionBefore(SLV_ENDING_YEAR)) { if (IsSavegameVersionBefore(SLV_ENDING_YEAR)) {
_settings_game.game_creation.ending_year = DEF_END_YEAR; _settings_game.game_creation.ending_year = CalendarTime::DEF_END_YEAR;
} }
/* Convert linkgraph update settings from days to seconds. */ /* Convert linkgraph update settings from days to seconds. */
if (IsSavegameVersionBefore(SLV_LINKGRAPH_SECONDS)) { if (IsSavegameVersionBefore(SLV_LINKGRAPH_SECONDS)) {
_settings_game.linkgraph.recalc_interval *= SECONDS_PER_DAY; _settings_game.linkgraph.recalc_interval *= CalendarTime::SECONDS_PER_DAY;
_settings_game.linkgraph.recalc_time *= SECONDS_PER_DAY; _settings_game.linkgraph.recalc_time *= CalendarTime::SECONDS_PER_DAY;
} }
/* Load the sprites */ /* Load the sprites */
@ -1422,18 +1422,18 @@ bool AfterLoadGame()
/* Time starts at 0 instead of 1920. /* Time starts at 0 instead of 1920.
* Account for this in older games by adding an offset */ * Account for this in older games by adding an offset */
if (IsSavegameVersionBefore(SLV_31)) { if (IsSavegameVersionBefore(SLV_31)) {
TimerGameCalendar::date += DAYS_TILL_ORIGINAL_BASE_YEAR; TimerGameCalendar::date += CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR;
TimerGameCalendar::year += ORIGINAL_BASE_YEAR; TimerGameCalendar::year += CalendarTime::ORIGINAL_BASE_YEAR;
for (Station *st : Station::Iterate()) st->build_date += DAYS_TILL_ORIGINAL_BASE_YEAR; for (Station *st : Station::Iterate()) st->build_date += CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR;
for (Waypoint *wp : Waypoint::Iterate()) wp->build_date += DAYS_TILL_ORIGINAL_BASE_YEAR; for (Waypoint *wp : Waypoint::Iterate()) wp->build_date += CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR;
for (Engine *e : Engine::Iterate()) e->intro_date += DAYS_TILL_ORIGINAL_BASE_YEAR; for (Engine *e : Engine::Iterate()) e->intro_date += CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR;
for (Company *c : Company::Iterate()) c->inaugurated_year += ORIGINAL_BASE_YEAR; for (Company *c : Company::Iterate()) c->inaugurated_year += CalendarTime::ORIGINAL_BASE_YEAR;
for (Industry *i : Industry::Iterate()) i->last_prod_year += ORIGINAL_BASE_YEAR; for (Industry *i : Industry::Iterate()) i->last_prod_year += CalendarTime::ORIGINAL_BASE_YEAR;
for (Vehicle *v : Vehicle::Iterate()) { for (Vehicle *v : Vehicle::Iterate()) {
v->date_of_last_service += DAYS_TILL_ORIGINAL_BASE_YEAR; v->date_of_last_service += CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR;
v->build_year += ORIGINAL_BASE_YEAR; v->build_year += CalendarTime::ORIGINAL_BASE_YEAR;
} }
} }
@ -1925,7 +1925,7 @@ bool AfterLoadGame()
/* Replace "house construction year" with "house age" */ /* Replace "house construction year" with "house age" */
if (IsTileType(t, MP_HOUSE) && IsHouseCompleted(t)) { if (IsTileType(t, MP_HOUSE) && IsHouseCompleted(t)) {
t.m5() = ClampTo<uint8_t>(TimerGameCalendar::year - (t.m5() + ORIGINAL_BASE_YEAR)); t.m5() = ClampTo<uint8_t>(TimerGameCalendar::year - (t.m5() + CalendarTime::ORIGINAL_BASE_YEAR));
} }
} }
} }
@ -2999,7 +2999,7 @@ bool AfterLoadGame()
t->growth_rate = TownTicksToGameTicks(t->growth_rate & ~0x8000); t->growth_rate = TownTicksToGameTicks(t->growth_rate & ~0x8000);
} }
/* Add t->index % TOWN_GROWTH_TICKS to spread growth across ticks. */ /* Add t->index % TOWN_GROWTH_TICKS to spread growth across ticks. */
t->grow_counter = TownTicksToGameTicks(t->grow_counter) + t->index % TOWN_GROWTH_TICKS; t->grow_counter = TownTicksToGameTicks(t->grow_counter) + t->index % Ticks::TOWN_GROWTH_TICKS;
} }
} }

View File

@ -20,7 +20,6 @@
#include "../gfx_func.h" #include "../gfx_func.h"
#include "../core/random_func.hpp" #include "../core/random_func.hpp"
#include "../fios.h" #include "../fios.h"
#include "../date_type.h"
#include "../timer/timer.h" #include "../timer/timer.h"
#include "../timer/timer_game_tick.h" #include "../timer/timer_game_tick.h"
@ -135,7 +134,7 @@ struct DATEChunkHandler : ChunkHandler {
this->LoadCommon(_date_check_desc, _date_check_sl_compat); this->LoadCommon(_date_check_desc, _date_check_sl_compat);
if (IsSavegameVersionBefore(SLV_31)) { if (IsSavegameVersionBefore(SLV_31)) {
_load_check_data.current_date += DAYS_TILL_ORIGINAL_BASE_YEAR; _load_check_data.current_date += CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR;
} }
} }
}; };

View File

@ -398,7 +398,7 @@ static bool FixTTOEngines()
for (uint i = 0; i < lengthof(_orig_aircraft_vehicle_info); i++, j++) new (GetTempDataEngine(j)) Engine(VEH_AIRCRAFT, i); for (uint i = 0; i < lengthof(_orig_aircraft_vehicle_info); i++, j++) new (GetTempDataEngine(j)) Engine(VEH_AIRCRAFT, i);
} }
TimerGameCalendar::Date aging_date = std::min(TimerGameCalendar::date + DAYS_TILL_ORIGINAL_BASE_YEAR, TimerGameCalendar::ConvertYMDToDate(2050, 0, 1)); TimerGameCalendar::Date aging_date = std::min(TimerGameCalendar::date + CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR, TimerGameCalendar::ConvertYMDToDate(2050, 0, 1));
for (EngineID i = 0; i < 256; i++) { for (EngineID i = 0; i < 256; i++) {
int oi = ttd_to_tto[i]; int oi = ttd_to_tto[i];
@ -406,11 +406,11 @@ static bool FixTTOEngines()
if (oi == 255) { if (oi == 255) {
/* Default engine is used */ /* Default engine is used */
TimerGameCalendar::date += DAYS_TILL_ORIGINAL_BASE_YEAR; TimerGameCalendar::date += CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR;
StartupOneEngine(e, aging_date, 0); StartupOneEngine(e, aging_date, 0);
CalcEngineReliability(e, false); CalcEngineReliability(e, false);
e->intro_date -= DAYS_TILL_ORIGINAL_BASE_YEAR; e->intro_date -= CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR;
TimerGameCalendar::date -= DAYS_TILL_ORIGINAL_BASE_YEAR; TimerGameCalendar::date -= CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR;
/* Make sure for example monorail and maglev are available when they should be */ /* Make sure for example monorail and maglev are available when they should be */
if (TimerGameCalendar::date >= e->intro_date && HasBit(e->info.climates, 0)) { if (TimerGameCalendar::date >= e->intro_date && HasBit(e->info.climates, 0)) {
@ -1020,7 +1020,7 @@ static bool LoadOldCompany(LoadgameState *ls, int num)
} }
_company_colours[num] = (Colours)c->colour; _company_colours[num] = (Colours)c->colour;
c->inaugurated_year -= ORIGINAL_BASE_YEAR; c->inaugurated_year -= CalendarTime::ORIGINAL_BASE_YEAR;
return true; return true;
} }
@ -1353,7 +1353,7 @@ bool LoadOldVehicle(LoadgameState *ls, int num)
if (_cargo_count != 0 && CargoPacket::CanAllocateItem()) { if (_cargo_count != 0 && CargoPacket::CanAllocateItem()) {
StationID source = (_cargo_source == 0xFF) ? INVALID_STATION : _cargo_source; StationID source = (_cargo_source == 0xFF) ? INVALID_STATION : _cargo_source;
TileIndex source_xy = (source != INVALID_STATION) ? Station::Get(source)->xy : (TileIndex)0; TileIndex source_xy = (source != INVALID_STATION) ? Station::Get(source)->xy : (TileIndex)0;
v->cargo.Append(new CargoPacket(_cargo_count, _cargo_periods, source, source_xy)); v->cargo.Append(new CargoPacket(_cargo_count, _cargo_periods, source, INVALID_STATION, source_xy));
} }
} }

View File

@ -449,7 +449,7 @@ public:
assert(CargoPacket::CanAllocateItem()); assert(CargoPacket::CanAllocateItem());
/* Don't construct the packet with station here, because that'll fail with old savegames */ /* Don't construct the packet with station here, because that'll fail with old savegames */
CargoPacket *cp = new CargoPacket(GB(_waiting_acceptance, 0, 12), _cargo_periods, source, _cargo_source_xy, _cargo_feeder_share); CargoPacket *cp = new CargoPacket(GB(_waiting_acceptance, 0, 12), _cargo_periods, source, INVALID_STATION, _cargo_source_xy, _cargo_feeder_share);
ge->cargo.Append(cp, INVALID_STATION); ge->cargo.Append(cp, INVALID_STATION);
SB(ge->status, GoodsEntry::GES_RATING, 1, 1); SB(ge->status, GoodsEntry::GES_RATING, 1, 1);
} }

View File

@ -1041,7 +1041,7 @@ struct VEHSChunkHandler : ChunkHandler {
if (_cargo_count != 0 && IsCompanyBuildableVehicleType(v) && CargoPacket::CanAllocateItem()) { if (_cargo_count != 0 && IsCompanyBuildableVehicleType(v) && CargoPacket::CanAllocateItem()) {
/* Don't construct the packet with station here, because that'll fail with old savegames */ /* Don't construct the packet with station here, because that'll fail with old savegames */
CargoPacket *cp = new CargoPacket(_cargo_count, _cargo_periods, _cargo_source, _cargo_source_xy, _cargo_feeder_share); CargoPacket *cp = new CargoPacket(_cargo_count, _cargo_periods, _cargo_source, INVALID_STATION, _cargo_source_xy, _cargo_feeder_share);
v->cargo.Append(cp); v->cargo.Append(cp);
} }

View File

@ -56,7 +56,7 @@
{ {
if (month < 1 || month > 12) return DATE_INVALID; if (month < 1 || month > 12) return DATE_INVALID;
if (day_of_month < 1 || day_of_month > 31) return DATE_INVALID; if (day_of_month < 1 || day_of_month > 31) return DATE_INVALID;
if (year < 0 || year > MAX_YEAR) return DATE_INVALID; if (year < 0 || year > CalendarTime::MAX_YEAR) return DATE_INVALID;
return (ScriptDate::Date)(int32_t)::TimerGameCalendar::ConvertYMDToDate(year, month - 1, day_of_month); return (ScriptDate::Date)(int32_t)::TimerGameCalendar::ConvertYMDToDate(year, month - 1, day_of_month);
} }

View File

@ -11,7 +11,7 @@
#define SCRIPT_DATE_HPP #define SCRIPT_DATE_HPP
#include "script_object.hpp" #include "script_object.hpp"
#include "../../date_type.h" #include "timer/timer_game_calendar.h"
/** /**
* Class that handles all date related (calculation) functions. * Class that handles all date related (calculation) functions.
@ -31,7 +31,7 @@ public:
* compose valid date values for a known year, month and day. * compose valid date values for a known year, month and day.
*/ */
enum Date { enum Date {
DATE_INVALID = (int32_t)::INVALID_DATE, ///< A value representing an invalid date. DATE_INVALID = (int32_t)::CalendarTime::INVALID_DATE, ///< A value representing an invalid date.
}; };
/** /**

View File

@ -171,9 +171,9 @@
break; break;
default: default:
EnforcePrecondition(false, (days_between_town_growth * DAY_TICKS / TOWN_GROWTH_TICKS) <= MAX_TOWN_GROWTH_TICKS); EnforcePrecondition(false, (days_between_town_growth * ::Ticks::DAY_TICKS / ::Ticks::TOWN_GROWTH_TICKS) <= MAX_TOWN_GROWTH_TICKS);
/* Don't use growth_rate 0 as it means GROWTH_NORMAL */ /* Don't use growth_rate 0 as it means GROWTH_NORMAL */
growth_rate = std::max<SQInteger>(days_between_town_growth * DAY_TICKS, 2u) - 1; growth_rate = std::max<SQInteger>(days_between_town_growth * ::Ticks::DAY_TICKS, 2u) - 1;
break; break;
} }
@ -188,7 +188,7 @@
if (t->growth_rate == TOWN_GROWTH_RATE_NONE) return TOWN_GROWTH_NONE; if (t->growth_rate == TOWN_GROWTH_RATE_NONE) return TOWN_GROWTH_NONE;
return RoundDivSU(t->growth_rate + 1, DAY_TICKS); return RoundDivSU(t->growth_rate + 1, ::Ticks::DAY_TICKS);
} }
/* static */ SQInteger ScriptTown::GetDistanceManhattanToTile(TownID town_id, TileIndex tile) /* static */ SQInteger ScriptTown::GetDistanceManhattanToTile(TownID town_id, TileIndex tile)

View File

@ -45,7 +45,6 @@
#include "fios.h" #include "fios.h"
#include "fileio_func.h" #include "fileio_func.h"
#include "settings_cmd.h" #include "settings_cmd.h"
#include "date_type.h"
#include "table/strings.h" #include "table/strings.h"
@ -1283,8 +1282,8 @@ void LoadFromConfig(bool startup)
/* Load basic settings only during bootstrap, load other settings not during bootstrap */ /* Load basic settings only during bootstrap, load other settings not during bootstrap */
if (!startup) { if (!startup) {
if (generic_version < IFV_LINKGRAPH_SECONDS) { if (generic_version < IFV_LINKGRAPH_SECONDS) {
_settings_newgame.linkgraph.recalc_interval *= SECONDS_PER_DAY; _settings_newgame.linkgraph.recalc_interval *= CalendarTime::SECONDS_PER_DAY;
_settings_newgame.linkgraph.recalc_time *= SECONDS_PER_DAY; _settings_newgame.linkgraph.recalc_time *= CalendarTime::SECONDS_PER_DAY;
} }
/* Move no_http_content_downloads and use_relay_service from generic_ini to private_ini. */ /* Move no_http_content_downloads and use_relay_service from generic_ini to private_ini. */

View File

@ -2751,7 +2751,7 @@ struct CustomCurrencyWindow : Window {
this->SetWidgetDisabledState(WID_CC_RATE_DOWN, _custom_currency.rate == 1); this->SetWidgetDisabledState(WID_CC_RATE_DOWN, _custom_currency.rate == 1);
this->SetWidgetDisabledState(WID_CC_RATE_UP, _custom_currency.rate == UINT16_MAX); this->SetWidgetDisabledState(WID_CC_RATE_UP, _custom_currency.rate == UINT16_MAX);
this->SetWidgetDisabledState(WID_CC_YEAR_DOWN, _custom_currency.to_euro == CF_NOEURO); this->SetWidgetDisabledState(WID_CC_YEAR_DOWN, _custom_currency.to_euro == CF_NOEURO);
this->SetWidgetDisabledState(WID_CC_YEAR_UP, _custom_currency.to_euro == MAX_YEAR); this->SetWidgetDisabledState(WID_CC_YEAR_UP, _custom_currency.to_euro == CalendarTime::MAX_YEAR);
} }
void SetStringParameters(int widget) const override void SetStringParameters(int widget) const override
@ -2850,8 +2850,8 @@ struct CustomCurrencyWindow : Window {
break; break;
case WID_CC_YEAR_UP: case WID_CC_YEAR_UP:
_custom_currency.to_euro = Clamp(_custom_currency.to_euro + 1, MIN_EURO_YEAR, MAX_YEAR); _custom_currency.to_euro = Clamp(_custom_currency.to_euro + 1, MIN_EURO_YEAR, CalendarTime::MAX_YEAR);
if (_custom_currency.to_euro == MAX_YEAR) this->DisableWidget(WID_CC_YEAR_UP); if (_custom_currency.to_euro == CalendarTime::MAX_YEAR) this->DisableWidget(WID_CC_YEAR_UP);
this->EnableWidget(WID_CC_YEAR_DOWN); this->EnableWidget(WID_CC_YEAR_DOWN);
break; break;
@ -2897,7 +2897,7 @@ struct CustomCurrencyWindow : Window {
case WID_CC_YEAR: { // Year to switch to euro case WID_CC_YEAR: { // Year to switch to euro
TimerGameCalendar::Year val = atoi(str); TimerGameCalendar::Year val = atoi(str);
_custom_currency.to_euro = (val < MIN_EURO_YEAR ? CF_NOEURO : std::min(val, MAX_YEAR)); _custom_currency.to_euro = (val < MIN_EURO_YEAR ? CF_NOEURO : std::min(val, CalendarTime::MAX_YEAR));
break; break;
} }
} }

View File

@ -236,7 +236,7 @@ void Ship::OnNewDay()
if (this->running_ticks == 0) return; if (this->running_ticks == 0) return;
CommandCost cost(EXPENSES_SHIP_RUN, this->GetRunningCost() * this->running_ticks / (DAYS_IN_YEAR * DAY_TICKS)); CommandCost cost(EXPENSES_SHIP_RUN, this->GetRunningCost() * this->running_ticks / (CalendarTime::DAYS_IN_YEAR * Ticks::DAY_TICKS));
this->profit_this_year -= cost.GetCost(); this->profit_this_year -= cost.GetCost();
this->running_ticks = 0; this->running_ticks = 0;

View File

@ -13,7 +13,7 @@
#include "core/enum_type.hpp" #include "core/enum_type.hpp"
#include "core/bitmath_func.hpp" #include "core/bitmath_func.hpp"
#include "core/mem_func.hpp" #include "core/mem_func.hpp"
#include "date_type.h" #include "timer/timer_game_tick.h"
/** Flags of the sort list. */ /** Flags of the sort list. */
enum SortListFlags { enum SortListFlags {
@ -72,7 +72,7 @@ protected:
void ResetResortTimer() void ResetResortTimer()
{ {
/* Resort every 10 days */ /* Resort every 10 days */
this->resort_timer = DAY_TICKS * 10; this->resort_timer = Ticks::DAY_TICKS * 10;
} }
public: public:

View File

@ -105,7 +105,7 @@ Station::~Station()
for (NodeID node = 0; node < lg->Size(); ++node) { for (NodeID node = 0; node < lg->Size(); ++node) {
Station *st = Station::Get((*lg)[node].station); Station *st = Station::Get((*lg)[node].station);
st->goods[c].flows.erase(this->index); st->goods[c].flows.erase(this->index);
if ((*lg)[node].HasEdgeTo(this->goods[c].node) && (*lg)[node][this->goods[c].node].LastUpdate() != INVALID_DATE) { if ((*lg)[node].HasEdgeTo(this->goods[c].node) && (*lg)[node][this->goods[c].node].LastUpdate() != CalendarTime::INVALID_DATE) {
st->goods[c].flows.DeleteFlows(this->index); st->goods[c].flows.DeleteFlows(this->index);
RerouteCargo(st, c, this->index, st->index); RerouteCargo(st, c, this->index, st->index);
} }

View File

@ -3863,11 +3863,11 @@ void DeleteStaleLinks(Station *from)
ge.flows.DeleteFlows(to->index); ge.flows.DeleteFlows(to->index);
RerouteCargo(from, c, to->index, from->index); RerouteCargo(from, c, to->index, from->index);
} }
} else if (edge.last_unrestricted_update != INVALID_DATE && TimerGameCalendar::date - edge.last_unrestricted_update > timeout) { } else if (edge.last_unrestricted_update != CalendarTime::INVALID_DATE && TimerGameCalendar::date - edge.last_unrestricted_update > timeout) {
edge.Restrict(); edge.Restrict();
ge.flows.RestrictFlows(to->index); ge.flows.RestrictFlows(to->index);
RerouteCargo(from, c, to->index, from->index); RerouteCargo(from, c, to->index, from->index);
} else if (edge.last_restricted_update != INVALID_DATE && TimerGameCalendar::date - edge.last_restricted_update > timeout) { } else if (edge.last_restricted_update != CalendarTime::INVALID_DATE && TimerGameCalendar::date - edge.last_restricted_update > timeout) {
edge.Release(); edge.Release();
} }
} }
@ -3964,7 +3964,7 @@ static void StationHandleSmallTick(BaseStation *st)
if ((st->facilities & FACIL_WAYPOINT) != 0 || !st->IsInUse()) return; if ((st->facilities & FACIL_WAYPOINT) != 0 || !st->IsInUse()) return;
byte b = st->delete_ctr + 1; byte b = st->delete_ctr + 1;
if (b >= STATION_RATING_TICKS) b = 0; if (b >= Ticks::STATION_RATING_TICKS) b = 0;
st->delete_ctr = b; st->delete_ctr = b;
if (b == 0) UpdateStationRating(Station::From(st)); if (b == 0) UpdateStationRating(Station::From(st));
@ -3978,18 +3978,18 @@ void OnTick_Station()
StationHandleSmallTick(st); StationHandleSmallTick(st);
/* Clean up the link graph about once a week. */ /* Clean up the link graph about once a week. */
if (Station::IsExpected(st) && (TimerGameTick::counter + st->index) % STATION_LINKGRAPH_TICKS == 0) { if (Station::IsExpected(st) && (TimerGameTick::counter + st->index) % Ticks::STATION_LINKGRAPH_TICKS == 0) {
DeleteStaleLinks(Station::From(st)); DeleteStaleLinks(Station::From(st));
}; };
/* Spread out big-tick over STATION_ACCEPTANCE_TICKS ticks. */ /* Spread out big-tick over STATION_ACCEPTANCE_TICKS ticks. */
if ((TimerGameTick::counter + st->index) % STATION_ACCEPTANCE_TICKS == 0) { if ((TimerGameTick::counter + st->index) % Ticks::STATION_ACCEPTANCE_TICKS == 0) {
/* Stop processing this station if it was deleted */ /* Stop processing this station if it was deleted */
if (!StationHandleBigTick(st)) continue; if (!StationHandleBigTick(st)) continue;
} }
/* Spread out station animation over STATION_ACCEPTANCE_TICKS ticks. */ /* Spread out station animation over STATION_ACCEPTANCE_TICKS ticks. */
if ((TimerGameTick::counter + st->index) % STATION_ACCEPTANCE_TICKS == 0) { if ((TimerGameTick::counter + st->index) % Ticks::STATION_ACCEPTANCE_TICKS == 0) {
TriggerStationAnimation(st, st->xy, SAT_250_TICKS); TriggerStationAnimation(st, st->xy, SAT_250_TICKS);
TriggerRoadStopAnimation(st, st->xy, SAT_250_TICKS); TriggerRoadStopAnimation(st, st->xy, SAT_250_TICKS);
if (Station::IsExpected(st)) AirportAnimationTrigger(Station::From(st), AAT_STATION_250_TICKS); if (Station::IsExpected(st)) AirportAnimationTrigger(Station::From(st), AAT_STATION_250_TICKS);

View File

@ -25,7 +25,6 @@
#include "toolbar_gui.h" #include "toolbar_gui.h"
#include "core/geometry_func.hpp" #include "core/geometry_func.hpp"
#include "zoom_func.h" #include "zoom_func.h"
#include "date_type.h"
#include "timer/timer.h" #include "timer/timer.h"
#include "timer/timer_game_calendar.h" #include "timer/timer_game_calendar.h"
#include "timer/timer_window.h" #include "timer/timer_window.h"
@ -89,7 +88,7 @@ struct StatusBarWindow : Window {
Dimension d; Dimension d;
switch (widget) { switch (widget) {
case WID_S_LEFT: case WID_S_LEFT:
SetDParamMaxValue(0, DateAtStartOfYear(MAX_YEAR)); SetDParamMaxValue(0, TimerGameCalendar::DateAtStartOfYear(CalendarTime::MAX_YEAR));
d = GetStringBoundingBox(STR_JUST_DATE_LONG); d = GetStringBoundingBox(STR_JUST_DATE_LONG);
break; break;

View File

@ -12,7 +12,6 @@
#include "command_type.h" #include "command_type.h"
#include "company_type.h" #include "company_type.h"
#include "date_type.h"
#include "story_type.h" #include "story_type.h"
#include "vehicle_type.h" #include "vehicle_type.h"

View File

@ -699,7 +699,7 @@ public:
int y_offset = -scrollpos; int y_offset = -scrollpos;
/* Date */ /* Date */
if (page->date != INVALID_DATE) { if (page->date != CalendarTime::INVALID_DATE) {
SetDParam(0, page->date); SetDParam(0, page->date);
DrawString(0, fr.right, y_offset, STR_JUST_DATE_LONG, TC_BLACK); DrawString(0, fr.right, y_offset, STR_JUST_DATE_LONG, TC_BLACK);
} }

View File

@ -45,7 +45,7 @@ void Subsidy::AwardTo(CompanyID company)
assert(!this->IsAwarded()); assert(!this->IsAwarded());
this->awarded = company; this->awarded = company;
this->remaining = _settings_game.difficulty.subsidy_duration * MONTHS_IN_YEAR; this->remaining = _settings_game.difficulty.subsidy_duration * CalendarTime::MONTHS_IN_YEAR;
SetDParam(0, company); SetDParam(0, company);
NewsStringData *company_name = new NewsStringData(GetString(STR_COMPANY_NAME)); NewsStringData *company_name = new NewsStringData(GetString(STR_COMPANY_NAME));

View File

@ -10,7 +10,7 @@
#ifndef AIRPORT_DEFAULTS_H #ifndef AIRPORT_DEFAULTS_H
#define AIRPORT_DEFAULTS_H #define AIRPORT_DEFAULTS_H
#include "date_type.h" #include "timer/timer_game_calendar.h"
/** /**
* Definition of an airport tiles layout. * Definition of an airport tiles layout.
@ -397,20 +397,20 @@ static const Direction _default_airports_rotation[] = {
/* The helidepot and helistation have ATP_TTDP_SMALL because they are at ground level */ /* The helidepot and helistation have ATP_TTDP_SMALL because they are at ground level */
extern const AirportSpec _origin_airport_specs[] = { extern const AirportSpec _origin_airport_specs[] = {
AS(country, 4, 3, 0, 1959, 4, 3, 7, ATP_TTDP_SMALL, APC_SMALL, STR_AIRPORT_SMALL, SPR_AIRPORT_PREVIEW_SMALL), AS(country, 4, 3, 0, 1959, 4, 3, 7, ATP_TTDP_SMALL, APC_SMALL, STR_AIRPORT_SMALL, SPR_AIRPORT_PREVIEW_SMALL),
AS(city, 6, 6, 1955, MAX_YEAR, 5, 5, 24, ATP_TTDP_LARGE, APC_LARGE, STR_AIRPORT_CITY, SPR_AIRPORT_PREVIEW_LARGE), AS(city, 6, 6, 1955, CalendarTime::MAX_YEAR, 5, 5, 24, ATP_TTDP_LARGE, APC_LARGE, STR_AIRPORT_CITY, SPR_AIRPORT_PREVIEW_LARGE),
AS_ND(heliport, 1, 1, 1963, MAX_YEAR, 4, 1, 4, ATP_TTDP_HELIPORT, APC_HELIPORT, STR_AIRPORT_HELIPORT, SPR_AIRPORT_PREVIEW_HELIPORT), AS_ND(heliport, 1, 1, 1963, CalendarTime::MAX_YEAR, 4, 1, 4, ATP_TTDP_HELIPORT, APC_HELIPORT, STR_AIRPORT_HELIPORT, SPR_AIRPORT_PREVIEW_HELIPORT),
AS(metropolitan, 6, 6, 1980, MAX_YEAR, 6, 8, 28, ATP_TTDP_LARGE, APC_LARGE, STR_AIRPORT_METRO, SPR_AIRPORT_PREVIEW_METROPOLITAN), AS(metropolitan, 6, 6, 1980, CalendarTime::MAX_YEAR, 6, 8, 28, ATP_TTDP_LARGE, APC_LARGE, STR_AIRPORT_METRO, SPR_AIRPORT_PREVIEW_METROPOLITAN),
AS(international, 7, 7, 1990, MAX_YEAR, 8, 17, 42, ATP_TTDP_LARGE, APC_HUB, STR_AIRPORT_INTERNATIONAL, SPR_AIRPORT_PREVIEW_INTERNATIONAL), AS(international, 7, 7, 1990, CalendarTime::MAX_YEAR, 8, 17, 42, ATP_TTDP_LARGE, APC_HUB, STR_AIRPORT_INTERNATIONAL, SPR_AIRPORT_PREVIEW_INTERNATIONAL),
AS(commuter, 5, 4, 1983, MAX_YEAR, 4, 4, 20, ATP_TTDP_SMALL, APC_SMALL, STR_AIRPORT_COMMUTER, SPR_AIRPORT_PREVIEW_COMMUTER), AS(commuter, 5, 4, 1983, CalendarTime::MAX_YEAR, 4, 4, 20, ATP_TTDP_SMALL, APC_SMALL, STR_AIRPORT_COMMUTER, SPR_AIRPORT_PREVIEW_COMMUTER),
AS(helidepot, 2, 2, 1976, MAX_YEAR, 4, 2, 7, ATP_TTDP_SMALL, APC_HELIPORT, STR_AIRPORT_HELIDEPOT, SPR_AIRPORT_PREVIEW_HELIDEPOT), AS(helidepot, 2, 2, 1976, CalendarTime::MAX_YEAR, 4, 2, 7, ATP_TTDP_SMALL, APC_HELIPORT, STR_AIRPORT_HELIDEPOT, SPR_AIRPORT_PREVIEW_HELIDEPOT),
AS(intercontinental, 9, 11, 2002, MAX_YEAR, 10, 25, 72, ATP_TTDP_LARGE, APC_HUB, STR_AIRPORT_INTERCONTINENTAL, SPR_AIRPORT_PREVIEW_INTERCONTINENTAL), AS(intercontinental, 9, 11, 2002, CalendarTime::MAX_YEAR, 10, 25, 72, ATP_TTDP_LARGE, APC_HUB, STR_AIRPORT_INTERCONTINENTAL, SPR_AIRPORT_PREVIEW_INTERCONTINENTAL),
AS(helistation, 4, 2, 1980, MAX_YEAR, 4, 3, 14, ATP_TTDP_SMALL, APC_HELIPORT, STR_AIRPORT_HELISTATION, SPR_AIRPORT_PREVIEW_HELISTATION), AS(helistation, 4, 2, 1980, CalendarTime::MAX_YEAR, 4, 3, 14, ATP_TTDP_SMALL, APC_HELIPORT, STR_AIRPORT_HELISTATION, SPR_AIRPORT_PREVIEW_HELISTATION),
AS_GENERIC(&_airportfta_oilrig, nullptr, _default_airports_rotation, 0, nullptr, 0, 1, 1, 0, 4, 0, 0, 0, ATP_TTDP_OILRIG, APC_HELIPORT, STR_NULL, 0, false), AS_GENERIC(&_airportfta_oilrig, nullptr, _default_airports_rotation, 0, nullptr, 0, 1, 1, 0, 4, 0, 0, 0, ATP_TTDP_OILRIG, APC_HELIPORT, STR_NULL, 0, false),
}; };
static_assert(NEW_AIRPORT_OFFSET == lengthof(_origin_airport_specs)); static_assert(NEW_AIRPORT_OFFSET == lengthof(_origin_airport_specs));
const AirportSpec AirportSpec::dummy = AS_GENERIC(&_airportfta_dummy, nullptr, _default_airports_rotation, 0, nullptr, 0, 0, 0, 0, 0, MIN_YEAR, MIN_YEAR, 0, ATP_TTDP_LARGE, APC_BEGIN, STR_NULL, 0, false); const AirportSpec AirportSpec::dummy = AS_GENERIC(&_airportfta_dummy, nullptr, _default_airports_rotation, 0, nullptr, 0, 0, 0, 0, 0, CalendarTime::MIN_YEAR, CalendarTime::MIN_YEAR, 0, ATP_TTDP_LARGE, APC_BEGIN, STR_NULL, 0, false);
#undef AS #undef AS
#undef AS_ND #undef AS_ND

View File

@ -24,7 +24,7 @@
* @param f Bitmask of the climates * @param f Bitmask of the climates
* @note the 5 between b and f is the load amount * @note the 5 between b and f is the load amount
*/ */
#define MT(a, b, c, d, e, f) { DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 5, f, e, 0, 8, 0, 0, 0, STR_EMPTY, CARGO_AGING_TICKS, INVALID_ENGINE, ExtraEngineFlags::None } #define MT(a, b, c, d, e, f) { CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 5, f, e, 0, 8, 0, 0, 0, STR_EMPTY, Ticks::CARGO_AGING_TICKS, INVALID_ENGINE, ExtraEngineFlags::None }
/** /**
* Writes the properties of a multiple-unit train into the EngineInfo struct. * Writes the properties of a multiple-unit train into the EngineInfo struct.
@ -37,7 +37,7 @@
* @param f Bitmask of the climates * @param f Bitmask of the climates
* @note the 5 between b and f is the load amount * @note the 5 between b and f is the load amount
*/ */
#define MM(a, b, c, d, e, f) { DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 5, f, e, 0, 8, 1 << EF_RAIL_IS_MU, 0, 0, STR_EMPTY, CARGO_AGING_TICKS, INVALID_ENGINE, ExtraEngineFlags::None } #define MM(a, b, c, d, e, f) { CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 5, f, e, 0, 8, 1 << EF_RAIL_IS_MU, 0, 0, STR_EMPTY, Ticks::CARGO_AGING_TICKS, INVALID_ENGINE, ExtraEngineFlags::None }
/** /**
* Writes the properties of a train carriage into the EngineInfo struct. * Writes the properties of a train carriage into the EngineInfo struct.
@ -50,7 +50,7 @@
* @see MT * @see MT
* @note the 5 between b and f is the load amount * @note the 5 between b and f is the load amount
*/ */
#define MW(a, b, c, d, e, f) { DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 5, f, e, 0, 8, 0, 0, 0, STR_EMPTY, CARGO_AGING_TICKS, INVALID_ENGINE, ExtraEngineFlags::None } #define MW(a, b, c, d, e, f) { CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 5, f, e, 0, 8, 0, 0, 0, STR_EMPTY, Ticks::CARGO_AGING_TICKS, INVALID_ENGINE, ExtraEngineFlags::None }
/** /**
* Writes the properties of a road vehicle into the EngineInfo struct. * Writes the properties of a road vehicle into the EngineInfo struct.
@ -63,7 +63,7 @@
* @param f Bitmask of the climates * @param f Bitmask of the climates
* @note the 5 between b and f is the load amount * @note the 5 between b and f is the load amount
*/ */
#define MR(a, b, c, d, e, f) { DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 5, f, e, 0, 8, 0, 0, 0, STR_EMPTY, CARGO_AGING_TICKS, INVALID_ENGINE, ExtraEngineFlags::None } #define MR(a, b, c, d, e, f) { CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 5, f, e, 0, 8, 0, 0, 0, STR_EMPTY, Ticks::CARGO_AGING_TICKS, INVALID_ENGINE, ExtraEngineFlags::None }
/** /**
* Writes the properties of a ship into the EngineInfo struct. * Writes the properties of a ship into the EngineInfo struct.
@ -75,7 +75,7 @@
* @param f Bitmask of the climates * @param f Bitmask of the climates
* @note the 10 between b and f is the load amount * @note the 10 between b and f is the load amount
*/ */
#define MS(a, b, c, d, e, f) { DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 10, f, e, 0, 8, 0, 0, 0, STR_EMPTY, CARGO_AGING_TICKS, INVALID_ENGINE, ExtraEngineFlags::None } #define MS(a, b, c, d, e, f) { CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 10, f, e, 0, 8, 0, 0, 0, STR_EMPTY, Ticks::CARGO_AGING_TICKS, INVALID_ENGINE, ExtraEngineFlags::None }
/** /**
* Writes the properties of an aeroplane into the EngineInfo struct. * Writes the properties of an aeroplane into the EngineInfo struct.
@ -86,7 +86,7 @@
* @param e Bitmask of the climates * @param e Bitmask of the climates
* @note the 20 between b and e is the load amount * @note the 20 between b and e is the load amount
*/ */
#define MA(a, b, c, d, e) { DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 20, e, CT_INVALID, 0, 8, 0, 0, 0, STR_EMPTY, CARGO_AGING_TICKS, INVALID_ENGINE, ExtraEngineFlags::None } #define MA(a, b, c, d, e) { CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 20, e, CT_INVALID, 0, 8, 0, 0, 0, STR_EMPTY, Ticks::CARGO_AGING_TICKS, INVALID_ENGINE, ExtraEngineFlags::None }
/* Climates /* Climates
* T = Temperate * T = Temperate

View File

@ -121,7 +121,7 @@ static const DrawTileSprites _object_hq[] = {
#undef TILE_SPRITE_LINE #undef TILE_SPRITE_LINE
#define M(name, size, build_cost_multiplier, clear_cost_multiplier, height, climate, gen_amount, flags) { GRFFilePropsBase<2>(), {0, 0, 0, 0}, INVALID_OBJECT_CLASS, name, climate, size, build_cost_multiplier, clear_cost_multiplier, 0, MAX_DATE + 1, flags, 0, height, 1, gen_amount } #define M(name, size, build_cost_multiplier, clear_cost_multiplier, height, climate, gen_amount, flags) { GRFFilePropsBase<2>(), {0, 0, 0, 0}, INVALID_OBJECT_CLASS, name, climate, size, build_cost_multiplier, clear_cost_multiplier, 0, CalendarTime::MAX_DATE + 1, flags, 0, height, 1, gen_amount }
/* Climates /* Climates
* T = Temperate * T = Temperate

View File

@ -99,7 +99,7 @@ static const RailtypeInfo _original_railtypes[] = {
0x0A, 0x0A,
/* introduction date */ /* introduction date */
INVALID_DATE, CalendarTime::INVALID_DATE,
/* railtypes required for this to be introduced */ /* railtypes required for this to be introduced */
RAILTYPES_NONE, RAILTYPES_NONE,
@ -200,7 +200,7 @@ static const RailtypeInfo _original_railtypes[] = {
0x0A, 0x0A,
/* introduction date */ /* introduction date */
INVALID_DATE, CalendarTime::INVALID_DATE,
/* railtypes required for this to be introduced */ /* railtypes required for this to be introduced */
RAILTYPES_NONE, RAILTYPES_NONE,
@ -297,7 +297,7 @@ static const RailtypeInfo _original_railtypes[] = {
0x0A, 0x0A,
/* introduction date */ /* introduction date */
INVALID_DATE, CalendarTime::INVALID_DATE,
/* railtypes required for this to be introduced */ /* railtypes required for this to be introduced */
RAILTYPES_NONE, RAILTYPES_NONE,
@ -394,7 +394,7 @@ static const RailtypeInfo _original_railtypes[] = {
0x0A, 0x0A,
/* introduction date */ /* introduction date */
INVALID_DATE, CalendarTime::INVALID_DATE,
/* railtypes required for this to be introduced */ /* railtypes required for this to be introduced */
RAILTYPES_NONE, RAILTYPES_NONE,

View File

@ -82,7 +82,7 @@ static const RoadTypeInfo _original_roadtypes[] = {
0x01, 0x01,
/* introduction date */ /* introduction date */
static_cast<int32_t>(MIN_YEAR), static_cast<int32_t>(CalendarTime::MIN_YEAR),
/* roadtypes required for this to be introduced */ /* roadtypes required for this to be introduced */
ROADTYPES_NONE, ROADTYPES_NONE,
@ -162,7 +162,7 @@ static const RoadTypeInfo _original_roadtypes[] = {
0x01, 0x01,
/* introduction date */ /* introduction date */
INVALID_DATE, CalendarTime::INVALID_DATE,
/* roadtypes required for this to be introduced */ /* roadtypes required for this to be introduced */
ROADTYPES_NONE, ROADTYPES_NONE,

View File

@ -50,8 +50,8 @@ cat = SC_BASIC
var = to_euro var = to_euro
type = SLE_INT32 type = SLE_INT32
def = 0 def = 0
min = MIN_YEAR min = CalendarTime::MIN_YEAR
max = MAX_YEAR max = CalendarTime::MAX_YEAR
[SDT_SSTR] [SDT_SSTR]
var = prefix var = prefix

View File

@ -496,8 +496,8 @@ var = gui.coloured_news_year
type = SLE_INT32 type = SLE_INT32
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
def = 2000 def = 2000
min = MIN_YEAR min = CalendarTime::MIN_YEAR
max = MAX_YEAR max = CalendarTime::MAX_YEAR
interval = 1 interval = 1
str = STR_CONFIG_SETTING_COLOURED_NEWS_YEAR str = STR_CONFIG_SETTING_COLOURED_NEWS_YEAR
strhelp = STR_CONFIG_SETTING_COLOURED_NEWS_YEAR_HELPTEXT strhelp = STR_CONFIG_SETTING_COLOURED_NEWS_YEAR_HELPTEXT
@ -543,8 +543,8 @@ var = gui.semaphore_build_before
type = SLE_INT32 type = SLE_INT32
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
def = 1950 def = 1950
min = MIN_YEAR min = CalendarTime::MIN_YEAR
max = MAX_YEAR max = CalendarTime::MAX_YEAR
interval = 1 interval = 1
str = STR_CONFIG_SETTING_SEMAPHORE_BUILD_BEFORE_DATE str = STR_CONFIG_SETTING_SEMAPHORE_BUILD_BEFORE_DATE
strhelp = STR_CONFIG_SETTING_SEMAPHORE_BUILD_BEFORE_DATE_HELPTEXT strhelp = STR_CONFIG_SETTING_SEMAPHORE_BUILD_BEFORE_DATE_HELPTEXT

View File

@ -237,8 +237,8 @@ var = network.restart_game_year
type = SLE_INT32 type = SLE_INT32
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_GUI_0_IS_SPECIAL | SF_NETWORK_ONLY flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_GUI_0_IS_SPECIAL | SF_NETWORK_ONLY
def = 0 def = 0
min = MIN_YEAR min = CalendarTime::MIN_YEAR
max = MAX_YEAR max = CalendarTime::MAX_YEAR
interval = 1 interval = 1
[SDTC_VAR] [SDTC_VAR]

View File

@ -122,9 +122,9 @@ cat = SC_BASIC
[SDT_VAR] [SDT_VAR]
var = game_creation.starting_year var = game_creation.starting_year
type = SLE_INT32 type = SLE_INT32
def = DEF_START_YEAR def = CalendarTime::DEF_START_YEAR
min = MIN_YEAR min = CalendarTime::MIN_YEAR
max = MAX_YEAR max = CalendarTime::MAX_YEAR
interval = 1 interval = 1
str = STR_CONFIG_SETTING_STARTING_YEAR str = STR_CONFIG_SETTING_STARTING_YEAR
strval = STR_JUST_INT strval = STR_JUST_INT
@ -135,9 +135,9 @@ var = game_creation.ending_year
type = SLE_INT32 type = SLE_INT32
from = SLV_ENDING_YEAR from = SLV_ENDING_YEAR
flags = SF_GUI_0_IS_SPECIAL flags = SF_GUI_0_IS_SPECIAL
def = DEF_END_YEAR def = CalendarTime::DEF_END_YEAR
min = MIN_YEAR min = CalendarTime::MIN_YEAR
max = MAX_YEAR - 1 max = CalendarTime::MAX_YEAR - 1
interval = 1 interval = 1
str = STR_CONFIG_SETTING_ENDING_YEAR str = STR_CONFIG_SETTING_ENDING_YEAR
strhelp = STR_CONFIG_SETTING_ENDING_YEAR_HELPTEXT strhelp = STR_CONFIG_SETTING_ENDING_YEAR_HELPTEXT

View File

@ -1821,7 +1821,7 @@ static const HouseSpec _original_house_specs[] = {
* remove_rating_decrease * remove_rating_decrease
* | mail_generation * | mail_generation
* min_year | | 1st CargoID acceptance * min_year | | 1st CargoID acceptance
* | max_year | | | 2nd CargoID acceptance * | CalendarTime::MAX_YEAR | | | 2nd CargoID acceptance
* | | population | | | | 3th CargoID acceptance * | | population | | | | 3th CargoID acceptance
* | | | removal_cost | | | | | * | | | removal_cost | | | | |
* | | | | building_name | | | | | * | | | | building_name | | | | |
@ -1832,59 +1832,59 @@ static const HouseSpec _original_house_specs[] = {
* +-cargoID accepted | | | | | | | | * +-cargoID accepted | | | | | | | |
* | | | | | | | | | | | * | | | | | | | | | | |
*/ */
MS(1963, MAX_YEAR, 187, 150, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 140, 70, 8, 3, 4, MS(1963, CalendarTime::MAX_YEAR, 187, 150, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 140, 70, 8, 3, 4,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TEMP | HZ_ZON5, HZ_TEMP | HZ_ZON5,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 00 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 00
MS(1957, MAX_YEAR, 85, 140, STR_TOWN_BUILDING_NAME_OFFICE_BLOCK_1, 130, 55, 8, 3, 4, MS(1957, CalendarTime::MAX_YEAR, 85, 140, STR_TOWN_BUILDING_NAME_OFFICE_BLOCK_1, 130, 55, 8, 3, 4,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TEMP | HZ_ZON5 | HZ_ZON4, HZ_TEMP | HZ_ZON5 | HZ_ZON4,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 01 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 01
MS(1968, MAX_YEAR, 40, 100, STR_TOWN_BUILDING_NAME_SMALL_BLOCK_OF_FLATS_1, 90, 20, 8, 3, 1, MS(1968, CalendarTime::MAX_YEAR, 40, 100, STR_TOWN_BUILDING_NAME_SMALL_BLOCK_OF_FLATS_1, 90, 20, 8, 3, 1,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TEMP | HZ_ZON4 | HZ_ZON3 | HZ_ZON2, HZ_TEMP | HZ_ZON4 | HZ_ZON3 | HZ_ZON2,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 02 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 02
MS( 0, MAX_YEAR, 5, 90, STR_TOWN_BUILDING_NAME_CHURCH_1, 230, 2, 2, 0, 0, MS( 0, CalendarTime::MAX_YEAR, 5, 90, STR_TOWN_BUILDING_NAME_CHURCH_1, 230, 2, 2, 0, 0,
BUILDING_IS_CHURCH | TILE_SIZE_1x1, BUILDING_IS_CHURCH | TILE_SIZE_1x1,
HZ_TEMP | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1, HZ_TEMP | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 03 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 03
MS(1975, MAX_YEAR, 220, 160, STR_TOWN_BUILDING_NAME_LARGE_OFFICE_BLOCK_1, 160, 85, 10, 4, 6, MS(1975, CalendarTime::MAX_YEAR, 220, 160, STR_TOWN_BUILDING_NAME_LARGE_OFFICE_BLOCK_1, 160, 85, 10, 4, 6,
BUILDING_IS_ANIMATED | TILE_SIZE_1x1, BUILDING_IS_ANIMATED | TILE_SIZE_1x1,
HZ_TEMP | HZ_SUBARTC_BELOW | HZ_SUBTROPIC | HZ_ZON5, HZ_TEMP | HZ_SUBARTC_BELOW | HZ_SUBTROPIC | HZ_ZON5,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 04 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 04
MS(1975, MAX_YEAR, 220, 160, STR_TOWN_BUILDING_NAME_LARGE_OFFICE_BLOCK_1, 160, 85, 10, 4, 6, MS(1975, CalendarTime::MAX_YEAR, 220, 160, STR_TOWN_BUILDING_NAME_LARGE_OFFICE_BLOCK_1, 160, 85, 10, 4, 6,
BUILDING_IS_ANIMATED | TILE_SIZE_1x1, BUILDING_IS_ANIMATED | TILE_SIZE_1x1,
HZ_SUBARTC_ABOVE | HZ_ZON5, HZ_SUBARTC_ABOVE | HZ_ZON5,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 05 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 05
MS( 0, MAX_YEAR, 30, 80, STR_TOWN_BUILDING_NAME_TOWN_HOUSES_1, 80, 12, 4, 1, 0, MS( 0, CalendarTime::MAX_YEAR, 30, 80, STR_TOWN_BUILDING_NAME_TOWN_HOUSES_1, 80, 12, 4, 1, 0,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TEMP | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1, HZ_TEMP | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 06 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 06
MS(1959, MAX_YEAR, 140, 180, STR_TOWN_BUILDING_NAME_HOTEL_1, 150, 22, 6, 1, 2, MS(1959, CalendarTime::MAX_YEAR, 140, 180, STR_TOWN_BUILDING_NAME_HOTEL_1, 150, 22, 6, 1, 2,
TILE_SIZE_1x2, TILE_SIZE_1x2,
HZ_TEMP | HZ_ZON5 | HZ_ZON3, HZ_TEMP | HZ_ZON5 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 07 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 07
MS(1959, MAX_YEAR, 0, 180, STR_TOWN_BUILDING_NAME_HOTEL_1, 150, 22, 6, 1, 2, MS(1959, CalendarTime::MAX_YEAR, 0, 180, STR_TOWN_BUILDING_NAME_HOTEL_1, 150, 22, 6, 1, 2,
TILE_NO_FLAG, TILE_NO_FLAG,
HZ_NOZNS, HZ_NOZNS,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 08 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 08
MS(1945, MAX_YEAR, 0, 65, STR_TOWN_BUILDING_NAME_STATUE_1, 40, 0, 2, 0, 0, MS(1945, CalendarTime::MAX_YEAR, 0, 65, STR_TOWN_BUILDING_NAME_STATUE_1, 40, 0, 2, 0, 0,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TEMP | HZ_SUBARTC_BELOW | HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4, HZ_TEMP | HZ_SUBARTC_BELOW | HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 09 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 09
MS(1945, MAX_YEAR, 0, 65, STR_TOWN_BUILDING_NAME_FOUNTAIN_1, 40, 0, 2, 0, 0, MS(1945, CalendarTime::MAX_YEAR, 0, 65, STR_TOWN_BUILDING_NAME_FOUNTAIN_1, 40, 0, 2, 0, 0,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TEMP | HZ_SUBARTC_BELOW | HZ_SUBTROPIC | HZ_ZON5, HZ_TEMP | HZ_SUBARTC_BELOW | HZ_SUBTROPIC | HZ_ZON5,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 0A CT_PASSENGERS, CT_MAIL, CT_GOODS), // 0A
MS( 0, MAX_YEAR, 0, 60, STR_TOWN_BUILDING_NAME_PARK_1, 75, 0, 2, 0, 0, MS( 0, CalendarTime::MAX_YEAR, 0, 60, STR_TOWN_BUILDING_NAME_PARK_1, 75, 0, 2, 0, 0,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TEMP | HZ_ZON3, HZ_TEMP | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 0B CT_PASSENGERS, CT_MAIL, CT_GOODS), // 0B
MS(1935, MAX_YEAR, 0, 60, STR_TOWN_BUILDING_NAME_PARK_1, 75, 0, 2, 0, 0, MS(1935, CalendarTime::MAX_YEAR, 0, 60, STR_TOWN_BUILDING_NAME_PARK_1, 75, 0, 2, 0, 0,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TEMP | HZ_ZON4, HZ_TEMP | HZ_ZON4,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 0C CT_PASSENGERS, CT_MAIL, CT_GOODS), // 0C
MS(1951, MAX_YEAR, 150, 130, STR_TOWN_BUILDING_NAME_OFFICE_BLOCK_2, 110, 65, 8, 2, 4, MS(1951, CalendarTime::MAX_YEAR, 150, 130, STR_TOWN_BUILDING_NAME_OFFICE_BLOCK_2, 110, 65, 8, 2, 4,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TEMP | HZ_ZON5 | HZ_ZON4, HZ_TEMP | HZ_ZON5 | HZ_ZON4,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 0D CT_PASSENGERS, CT_MAIL, CT_GOODS), // 0D
@ -1900,31 +1900,31 @@ static const HouseSpec _original_house_specs[] = {
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TEMP | HZ_ZON5 | HZ_ZON4 | HZ_ZON3, HZ_TEMP | HZ_ZON5 | HZ_ZON4 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 10 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 10
MS(1977, MAX_YEAR, 130, 200, STR_TOWN_BUILDING_NAME_MODERN_OFFICE_BUILDING_1, 150, 50, 10, 3, 6, MS(1977, CalendarTime::MAX_YEAR, 130, 200, STR_TOWN_BUILDING_NAME_MODERN_OFFICE_BUILDING_1, 150, 50, 10, 3, 6,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TEMP | HZ_SUBARTC_BELOW | HZ_SUBTROPIC | HZ_ZON5, HZ_TEMP | HZ_SUBARTC_BELOW | HZ_SUBTROPIC | HZ_ZON5,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 11 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 11
MS(1983, MAX_YEAR, 6, 145, STR_TOWN_BUILDING_NAME_WAREHOUSE_1, 110, 10, 6, 3, 8, MS(1983, CalendarTime::MAX_YEAR, 6, 145, STR_TOWN_BUILDING_NAME_WAREHOUSE_1, 110, 10, 6, 3, 8,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TEMP | HZ_ZON5, HZ_TEMP | HZ_ZON5,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 12 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 12
MS(1985, MAX_YEAR, 110, 155, STR_TOWN_BUILDING_NAME_OFFICE_BLOCK_3, 110, 55, 6, 2, 6, MS(1985, CalendarTime::MAX_YEAR, 110, 155, STR_TOWN_BUILDING_NAME_OFFICE_BLOCK_3, 110, 55, 6, 2, 6,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TEMP | HZ_ZON5, HZ_TEMP | HZ_ZON5,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 13 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 13
MS( 0, MAX_YEAR, 65, 250, STR_TOWN_BUILDING_NAME_STADIUM_1, 300, 5, 4, 0, 0, MS( 0, CalendarTime::MAX_YEAR, 65, 250, STR_TOWN_BUILDING_NAME_STADIUM_1, 300, 5, 4, 0, 0,
BUILDING_IS_STADIUM | TILE_SIZE_2x2, BUILDING_IS_STADIUM | TILE_SIZE_2x2,
HZ_TEMP | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1, HZ_TEMP | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 14 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 14
MS( 0, MAX_YEAR, 0, 250, STR_TOWN_BUILDING_NAME_STADIUM_1, 300, 5, 4, 0, 0, MS( 0, CalendarTime::MAX_YEAR, 0, 250, STR_TOWN_BUILDING_NAME_STADIUM_1, 300, 5, 4, 0, 0,
TILE_NO_FLAG, TILE_NO_FLAG,
HZ_NOZNS, HZ_NOZNS,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 15 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 15
MS( 0, MAX_YEAR, 0, 250, STR_TOWN_BUILDING_NAME_STADIUM_1, 300, 5, 4, 0, 0, MS( 0, CalendarTime::MAX_YEAR, 0, 250, STR_TOWN_BUILDING_NAME_STADIUM_1, 300, 5, 4, 0, 0,
TILE_NO_FLAG, TILE_NO_FLAG,
HZ_NOZNS, HZ_NOZNS,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 16 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 16
MS( 0, MAX_YEAR, 0, 250, STR_TOWN_BUILDING_NAME_STADIUM_1, 300, 5, 4, 0, 0, MS( 0, CalendarTime::MAX_YEAR, 0, 250, STR_TOWN_BUILDING_NAME_STADIUM_1, 300, 5, 4, 0, 0,
TILE_NO_FLAG, TILE_NO_FLAG,
HZ_NOZNS, HZ_NOZNS,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 17 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 17
@ -1936,15 +1936,15 @@ static const HouseSpec _original_house_specs[] = {
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TEMP | HZ_ZON1, HZ_TEMP | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 19 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 19
MS(1931, MAX_YEAR, 13, 71, STR_TOWN_BUILDING_NAME_HOUSES_1, 75, 8, 3, 1, 0, MS(1931, CalendarTime::MAX_YEAR, 13, 71, STR_TOWN_BUILDING_NAME_HOUSES_1, 75, 8, 3, 1, 0,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TEMP | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1, HZ_TEMP | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 1A CT_PASSENGERS, CT_MAIL, CT_GOODS), // 1A
MS(1935, MAX_YEAR, 100, 135, STR_TOWN_BUILDING_NAME_FLATS_1, 100, 35, 7, 2, 2, MS(1935, CalendarTime::MAX_YEAR, 100, 135, STR_TOWN_BUILDING_NAME_FLATS_1, 100, 35, 7, 2, 2,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TEMP | HZ_ZON5 | HZ_ZON4 | HZ_ZON3, HZ_TEMP | HZ_ZON5 | HZ_ZON4 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 1B CT_PASSENGERS, CT_MAIL, CT_GOODS), // 1B
MS(1963, MAX_YEAR, 170, 145, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_2, 170, 50, 8, 3, 3, MS(1963, CalendarTime::MAX_YEAR, 170, 145, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_2, 170, 50, 8, 3, 3,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TEMP | HZ_ZON5 | HZ_ZON4 | HZ_ZON3, HZ_TEMP | HZ_ZON5 | HZ_ZON4 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 1C CT_PASSENGERS, CT_MAIL, CT_GOODS), // 1C
@ -1952,31 +1952,31 @@ static const HouseSpec _original_house_specs[] = {
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TEMP | HZ_ZON5 | HZ_ZON4 | HZ_ZON3, HZ_TEMP | HZ_ZON5 | HZ_ZON4 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 1D CT_PASSENGERS, CT_MAIL, CT_GOODS), // 1D
MS(1973, MAX_YEAR, 180, 155, STR_TOWN_BUILDING_NAME_SHOPS_AND_OFFICES_3, 180, 64, 8, 3, 3, MS(1973, CalendarTime::MAX_YEAR, 180, 155, STR_TOWN_BUILDING_NAME_SHOPS_AND_OFFICES_3, 180, 64, 8, 3, 3,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TEMP | HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON3, HZ_TEMP | HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 1E CT_PASSENGERS, CT_MAIL, CT_GOODS), // 1E
MS( 0, MAX_YEAR, 35, 220, STR_TOWN_BUILDING_NAME_THEATER_1, 230, 23, 8, 2, 2, MS( 0, CalendarTime::MAX_YEAR, 35, 220, STR_TOWN_BUILDING_NAME_THEATER_1, 230, 23, 8, 2, 2,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TEMP | HZ_ZON5 | HZ_ZON4, HZ_TEMP | HZ_ZON5 | HZ_ZON4,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 1F CT_PASSENGERS, CT_MAIL, CT_GOODS), // 1F
MS(1958, MAX_YEAR, 65, 250, STR_TOWN_BUILDING_NAME_STADIUM_2, 300, 5, 4, 0, 0, MS(1958, CalendarTime::MAX_YEAR, 65, 250, STR_TOWN_BUILDING_NAME_STADIUM_2, 300, 5, 4, 0, 0,
BUILDING_IS_STADIUM | TILE_SIZE_2x2, BUILDING_IS_STADIUM | TILE_SIZE_2x2,
HZ_TEMP | HZ_SUBARTC_BELOW | HZ_SUBTROPIC | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1, HZ_TEMP | HZ_SUBARTC_BELOW | HZ_SUBTROPIC | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 20 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 20
MS(1958, MAX_YEAR, 0, 250, STR_TOWN_BUILDING_NAME_STADIUM_2, 300, 5, 4, 0, 0, MS(1958, CalendarTime::MAX_YEAR, 0, 250, STR_TOWN_BUILDING_NAME_STADIUM_2, 300, 5, 4, 0, 0,
TILE_NO_FLAG, TILE_NO_FLAG,
HZ_NOZNS, HZ_NOZNS,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 21 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 21
MS(1958, MAX_YEAR, 0, 250, STR_TOWN_BUILDING_NAME_STADIUM_2, 300, 5, 4, 0, 0, MS(1958, CalendarTime::MAX_YEAR, 0, 250, STR_TOWN_BUILDING_NAME_STADIUM_2, 300, 5, 4, 0, 0,
TILE_NO_FLAG, TILE_NO_FLAG,
HZ_NOZNS, HZ_NOZNS,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 22 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 22
MS(1958, MAX_YEAR, 0, 250, STR_TOWN_BUILDING_NAME_STADIUM_2, 300, 5, 4, 0, 0, MS(1958, CalendarTime::MAX_YEAR, 0, 250, STR_TOWN_BUILDING_NAME_STADIUM_2, 300, 5, 4, 0, 0,
TILE_NO_FLAG, TILE_NO_FLAG,
HZ_NOZNS, HZ_NOZNS,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 23 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 23
MS(2000, MAX_YEAR, 140, 170, STR_TOWN_BUILDING_NAME_OFFICES_1, 250, 65, 8, 3, 2, MS(2000, CalendarTime::MAX_YEAR, 140, 170, STR_TOWN_BUILDING_NAME_OFFICES_1, 250, 65, 8, 3, 2,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TEMP | HZ_SUBARTC_BELOW | HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4, HZ_TEMP | HZ_SUBARTC_BELOW | HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 24 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 24
@ -1988,39 +1988,39 @@ static const HouseSpec _original_house_specs[] = {
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBARTC_ABOVE | HZ_ZON2 | HZ_ZON1, HZ_SUBARTC_ABOVE | HZ_ZON2 | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_FOOD), // 26 CT_PASSENGERS, CT_MAIL, CT_FOOD), // 26
MS(1945, MAX_YEAR, 35, 210, STR_TOWN_BUILDING_NAME_CINEMA_1, 230, 23, 8, 2, 2, MS(1945, CalendarTime::MAX_YEAR, 35, 210, STR_TOWN_BUILDING_NAME_CINEMA_1, 230, 23, 8, 2, 2,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TEMP | HZ_ZON5 | HZ_ZON4 | HZ_ZON3, HZ_TEMP | HZ_ZON5 | HZ_ZON4 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 27 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 27
MS(1983, MAX_YEAR, 180, 250, STR_TOWN_BUILDING_NAME_SHOPPING_MALL_1, 300, 5, 8, 2, 3, MS(1983, CalendarTime::MAX_YEAR, 180, 250, STR_TOWN_BUILDING_NAME_SHOPPING_MALL_1, 300, 5, 8, 2, 3,
TILE_SIZE_2x2, TILE_SIZE_2x2,
HZ_TEMP | HZ_ZON5 | HZ_ZON4 | HZ_ZON3 |HZ_ZON2, HZ_TEMP | HZ_ZON5 | HZ_ZON4 | HZ_ZON3 |HZ_ZON2,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 28 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 28
MS(1983, MAX_YEAR, 0, 250, STR_TOWN_BUILDING_NAME_SHOPPING_MALL_1, 300, 5, 8, 2, 3, MS(1983, CalendarTime::MAX_YEAR, 0, 250, STR_TOWN_BUILDING_NAME_SHOPPING_MALL_1, 300, 5, 8, 2, 3,
TILE_NO_FLAG, TILE_NO_FLAG,
HZ_NOZNS, HZ_NOZNS,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 29 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 29
MS(1983, MAX_YEAR, 0, 250, STR_TOWN_BUILDING_NAME_SHOPPING_MALL_1, 300, 5, 8, 2, 3, MS(1983, CalendarTime::MAX_YEAR, 0, 250, STR_TOWN_BUILDING_NAME_SHOPPING_MALL_1, 300, 5, 8, 2, 3,
TILE_NO_FLAG, TILE_NO_FLAG,
HZ_NOZNS, HZ_NOZNS,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 2A CT_PASSENGERS, CT_MAIL, CT_GOODS), // 2A
MS(1983, MAX_YEAR, 0, 250, STR_TOWN_BUILDING_NAME_SHOPPING_MALL_1, 300, 5, 8, 2, 3, MS(1983, CalendarTime::MAX_YEAR, 0, 250, STR_TOWN_BUILDING_NAME_SHOPPING_MALL_1, 300, 5, 8, 2, 3,
TILE_NO_FLAG, TILE_NO_FLAG,
HZ_NOZNS, HZ_NOZNS,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 2B CT_PASSENGERS, CT_MAIL, CT_GOODS), // 2B
MS( 0, MAX_YEAR, 80, 100, STR_TOWN_BUILDING_NAME_FLATS_1, 90, 20, 5, 2, 2, MS( 0, CalendarTime::MAX_YEAR, 80, 100, STR_TOWN_BUILDING_NAME_FLATS_1, 90, 20, 5, 2, 2,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBARTC_BELOW | HZ_ZON5 | HZ_ZON4 | HZ_ZON3, HZ_SUBARTC_BELOW | HZ_ZON5 | HZ_ZON4 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_FOOD), // 2C CT_PASSENGERS, CT_MAIL, CT_FOOD), // 2C
MS( 0, MAX_YEAR, 80, 100, STR_TOWN_BUILDING_NAME_FLATS_1, 90, 20, 5, 2, 2, MS( 0, CalendarTime::MAX_YEAR, 80, 100, STR_TOWN_BUILDING_NAME_FLATS_1, 90, 20, 5, 2, 2,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBARTC_ABOVE | HZ_ZON5 | HZ_ZON4 | HZ_ZON3, HZ_SUBARTC_ABOVE | HZ_ZON5 | HZ_ZON4 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_FOOD), // 2D CT_PASSENGERS, CT_MAIL, CT_FOOD), // 2D
MS( 0, MAX_YEAR, 16, 70, STR_TOWN_BUILDING_NAME_HOUSES_2, 70, 6, 3, 1, 2, MS( 0, CalendarTime::MAX_YEAR, 16, 70, STR_TOWN_BUILDING_NAME_HOUSES_2, 70, 6, 3, 1, 2,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBARTC_BELOW | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1, HZ_SUBARTC_BELOW | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_FOOD), // 2E CT_PASSENGERS, CT_MAIL, CT_FOOD), // 2E
MS( 0, MAX_YEAR, 16, 70, STR_TOWN_BUILDING_NAME_HOUSES_2, 70, 6, 3, 1, 2, MS( 0, CalendarTime::MAX_YEAR, 16, 70, STR_TOWN_BUILDING_NAME_HOUSES_2, 70, 6, 3, 1, 2,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBARTC_ABOVE | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1, HZ_SUBARTC_ABOVE | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_FOOD), // 2F CT_PASSENGERS, CT_MAIL, CT_FOOD), // 2F
@ -2032,59 +2032,59 @@ static const HouseSpec _original_house_specs[] = {
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBARTC_ABOVE | HZ_ZON3 | HZ_ZON2 | HZ_ZON1, HZ_SUBARTC_ABOVE | HZ_ZON3 | HZ_ZON2 | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_FOOD), // 31 CT_PASSENGERS, CT_MAIL, CT_FOOD), // 31
MS(1966, MAX_YEAR, 135, 150, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 120, 60, 8, 3, 4, MS(1966, CalendarTime::MAX_YEAR, 135, 150, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 120, 60, 8, 3, 4,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBARTC_BELOW | HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4, HZ_SUBARTC_BELOW | HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 32 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 32
MS(1966, MAX_YEAR, 135, 150, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 120, 60, 8, 3, 4, MS(1966, CalendarTime::MAX_YEAR, 135, 150, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 120, 60, 8, 3, 4,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBARTC_ABOVE | HZ_ZON5 | HZ_ZON4, HZ_SUBARTC_ABOVE | HZ_ZON5 | HZ_ZON4,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 33 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 33
MS(1970, MAX_YEAR, 170, 170, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 130, 70, 9, 3, 4, MS(1970, CalendarTime::MAX_YEAR, 170, 170, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 130, 70, 9, 3, 4,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBARTC_BELOW | HZ_ZON5 | HZ_ZON4, HZ_SUBARTC_BELOW | HZ_ZON5 | HZ_ZON4,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 34 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 34
MS(1970, MAX_YEAR, 170, 170, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 130, 70, 9, 3, 4, MS(1970, CalendarTime::MAX_YEAR, 170, 170, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 130, 70, 9, 3, 4,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBARTC_ABOVE | HZ_ZON5 | HZ_ZON4, HZ_SUBARTC_ABOVE | HZ_ZON5 | HZ_ZON4,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 35 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 35
MS(1974, MAX_YEAR, 210, 200, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 140, 80, 10, 3, 5, MS(1974, CalendarTime::MAX_YEAR, 210, 200, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 140, 80, 10, 3, 5,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBARTC_BELOW | HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4, HZ_SUBARTC_BELOW | HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 36 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 36
MS(1974, MAX_YEAR, 210, 200, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 140, 80, 10, 3, 5, MS(1974, CalendarTime::MAX_YEAR, 210, 200, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 140, 80, 10, 3, 5,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBARTC_ABOVE | HZ_ZON5 | HZ_ZON4, HZ_SUBARTC_ABOVE | HZ_ZON5 | HZ_ZON4,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 37 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 37
MS( 0, MAX_YEAR, 10, 60, STR_TOWN_BUILDING_NAME_HOUSES_2, 60, 5, 2, 1, 1, MS( 0, CalendarTime::MAX_YEAR, 10, 60, STR_TOWN_BUILDING_NAME_HOUSES_2, 60, 5, 2, 1, 1,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBARTC_BELOW | HZ_ZON1, HZ_SUBARTC_BELOW | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_FOOD), // 38 CT_PASSENGERS, CT_MAIL, CT_FOOD), // 38
MS( 0, MAX_YEAR, 10, 60, STR_TOWN_BUILDING_NAME_HOUSES_2, 60, 5, 2, 1, 1, MS( 0, CalendarTime::MAX_YEAR, 10, 60, STR_TOWN_BUILDING_NAME_HOUSES_2, 60, 5, 2, 1, 1,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBARTC_ABOVE | HZ_ZON1, HZ_SUBARTC_ABOVE | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_FOOD), // 39 CT_PASSENGERS, CT_MAIL, CT_FOOD), // 39
MS( 0, MAX_YEAR, 25, 100, STR_TOWN_BUILDING_NAME_SHOPS_AND_OFFICES_1, 80, 20, 3, 1, 1, MS( 0, CalendarTime::MAX_YEAR, 25, 100, STR_TOWN_BUILDING_NAME_SHOPS_AND_OFFICES_1, 80, 20, 3, 1, 1,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBARTC_BELOW | HZ_ZON5 | HZ_ZON4 | HZ_ZON3 | HZ_ZON2, HZ_SUBARTC_BELOW | HZ_ZON5 | HZ_ZON4 | HZ_ZON3 | HZ_ZON2,
CT_PASSENGERS, CT_MAIL, CT_FOOD), // 3A CT_PASSENGERS, CT_MAIL, CT_FOOD), // 3A
MS( 0, MAX_YEAR, 25, 100, STR_TOWN_BUILDING_NAME_SHOPS_AND_OFFICES_1, 80, 20, 3, 1, 1, MS( 0, CalendarTime::MAX_YEAR, 25, 100, STR_TOWN_BUILDING_NAME_SHOPS_AND_OFFICES_1, 80, 20, 3, 1, 1,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBARTC_ABOVE | HZ_ZON5 | HZ_ZON4 | HZ_ZON3 | HZ_ZON2, HZ_SUBARTC_ABOVE | HZ_ZON5 | HZ_ZON4 | HZ_ZON3 | HZ_ZON2,
CT_PASSENGERS, CT_MAIL, CT_FOOD), // 3B CT_PASSENGERS, CT_MAIL, CT_FOOD), // 3B
MS( 0, MAX_YEAR, 6, 85, STR_TOWN_BUILDING_NAME_CHURCH_1, 230, 2, 2, 0, 0, MS( 0, CalendarTime::MAX_YEAR, 6, 85, STR_TOWN_BUILDING_NAME_CHURCH_1, 230, 2, 2, 0, 0,
BUILDING_IS_CHURCH | TILE_SIZE_1x1, BUILDING_IS_CHURCH | TILE_SIZE_1x1,
HZ_SUBARTC_BELOW | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1, HZ_SUBARTC_BELOW | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 3C CT_PASSENGERS, CT_MAIL, CT_GOODS), // 3C
MS( 0, MAX_YEAR, 6, 85, STR_TOWN_BUILDING_NAME_CHURCH_1, 230, 2, 2, 0, 0, MS( 0, CalendarTime::MAX_YEAR, 6, 85, STR_TOWN_BUILDING_NAME_CHURCH_1, 230, 2, 2, 0, 0,
BUILDING_IS_CHURCH | TILE_SIZE_1x1, BUILDING_IS_CHURCH | TILE_SIZE_1x1,
HZ_SUBARTC_ABOVE | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1, HZ_SUBARTC_ABOVE | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 3D CT_PASSENGERS, CT_MAIL, CT_GOODS), // 3D
MS( 0, MAX_YEAR, 17, 80, STR_TOWN_BUILDING_NAME_HOUSES_2, 80, 7, 3, 1, 1, MS( 0, CalendarTime::MAX_YEAR, 17, 80, STR_TOWN_BUILDING_NAME_HOUSES_2, 80, 7, 3, 1, 1,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBARTC_BELOW | HZ_ZON3 | HZ_ZON2 | HZ_ZON1, HZ_SUBARTC_BELOW | HZ_ZON3 | HZ_ZON2 | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_FOOD), // 3E CT_PASSENGERS, CT_MAIL, CT_FOOD), // 3E
MS( 0, MAX_YEAR, 17, 80, STR_TOWN_BUILDING_NAME_HOUSES_2, 80, 7, 3, 1, 1, MS( 0, CalendarTime::MAX_YEAR, 17, 80, STR_TOWN_BUILDING_NAME_HOUSES_2, 80, 7, 3, 1, 1,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBARTC_ABOVE | HZ_ZON3 | HZ_ZON2 | HZ_ZON1, HZ_SUBARTC_ABOVE | HZ_ZON3 | HZ_ZON2 | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_FOOD), // 3F CT_PASSENGERS, CT_MAIL, CT_FOOD), // 3F
@ -2096,179 +2096,179 @@ static const HouseSpec _original_house_specs[] = {
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBARTC_ABOVE| HZ_ZON5 | HZ_ZON4 | HZ_ZON3, HZ_SUBARTC_ABOVE| HZ_ZON5 | HZ_ZON4 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 41 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 41
MS(1972, MAX_YEAR, 140, 160, STR_TOWN_BUILDING_NAME_HOTEL_1, 160, 25, 6, 1, 3, MS(1972, CalendarTime::MAX_YEAR, 140, 160, STR_TOWN_BUILDING_NAME_HOTEL_1, 160, 25, 6, 1, 3,
TILE_SIZE_1x2, TILE_SIZE_1x2,
HZ_SUBARTC_BELOW| HZ_ZON5 | HZ_ZON4 | HZ_ZON3, HZ_SUBARTC_BELOW| HZ_ZON5 | HZ_ZON4 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_FOOD), // 42 CT_PASSENGERS, CT_MAIL, CT_FOOD), // 42
MS(1972, MAX_YEAR, 0, 160, STR_TOWN_BUILDING_NAME_HOTEL_1, 160, 25, 6, 1, 2, MS(1972, CalendarTime::MAX_YEAR, 0, 160, STR_TOWN_BUILDING_NAME_HOTEL_1, 160, 25, 6, 1, 2,
TILE_NO_FLAG, TILE_NO_FLAG,
HZ_NOZNS, HZ_NOZNS,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 43 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 43
MS(1972, MAX_YEAR, 140, 160, STR_TOWN_BUILDING_NAME_HOTEL_1, 160, 25, 6, 1, 3, MS(1972, CalendarTime::MAX_YEAR, 140, 160, STR_TOWN_BUILDING_NAME_HOTEL_1, 160, 25, 6, 1, 3,
TILE_SIZE_1x2, TILE_SIZE_1x2,
HZ_SUBARTC_ABOVE| HZ_ZON5 | HZ_ZON4 | HZ_ZON3, HZ_SUBARTC_ABOVE| HZ_ZON5 | HZ_ZON4 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_FOOD), // 44 CT_PASSENGERS, CT_MAIL, CT_FOOD), // 44
MS(1972, MAX_YEAR, 0, 160, STR_TOWN_BUILDING_NAME_HOTEL_1, 160, 25, 6, 1, 2, MS(1972, CalendarTime::MAX_YEAR, 0, 160, STR_TOWN_BUILDING_NAME_HOTEL_1, 160, 25, 6, 1, 2,
TILE_NO_FLAG, TILE_NO_FLAG,
HZ_NOZNS, HZ_NOZNS,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 45 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 45
MS(1963, MAX_YEAR, 105, 130, STR_TOWN_BUILDING_NAME_SHOPS_AND_OFFICES_1, 105, 50, 7, 2, 3, MS(1963, CalendarTime::MAX_YEAR, 105, 130, STR_TOWN_BUILDING_NAME_SHOPS_AND_OFFICES_1, 105, 50, 7, 2, 3,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBARTC_BELOW | HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4 | HZ_ZON3, HZ_SUBARTC_BELOW | HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 46 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 46
MS(1963, MAX_YEAR, 105, 130, STR_TOWN_BUILDING_NAME_SHOPS_AND_OFFICES_1, 105, 50, 7, 2, 3, MS(1963, CalendarTime::MAX_YEAR, 105, 130, STR_TOWN_BUILDING_NAME_SHOPS_AND_OFFICES_1, 105, 50, 7, 2, 3,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBARTC_ABOVE| HZ_ZON5 | HZ_ZON4 | HZ_ZON3, HZ_SUBARTC_ABOVE| HZ_ZON5 | HZ_ZON4 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 47 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 47
MS(1978, MAX_YEAR, 190, 190, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 135, 75, 9, 3, 4, MS(1978, CalendarTime::MAX_YEAR, 190, 190, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 135, 75, 9, 3, 4,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBARTC_BELOW | HZ_ZON5 | HZ_ZON4, HZ_SUBARTC_BELOW | HZ_ZON5 | HZ_ZON4,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 48 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 48
MS(1978, MAX_YEAR, 190, 190, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 135, 75, 9, 3, 4, MS(1978, CalendarTime::MAX_YEAR, 190, 190, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 135, 75, 9, 3, 4,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBARTC_ABOVE | HZ_ZON5 | HZ_ZON4, HZ_SUBARTC_ABOVE | HZ_ZON5 | HZ_ZON4,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 49 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 49
MS(1967, MAX_YEAR, 250, 140, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 200, 60, 7, 2, 2, MS(1967, CalendarTime::MAX_YEAR, 250, 140, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 200, 60, 7, 2, 2,
TILE_SIZE_2x1, TILE_SIZE_2x1,
HZ_SUBARTC_BELOW| HZ_ZON5 | HZ_ZON4 | HZ_ZON3, HZ_SUBARTC_BELOW| HZ_ZON5 | HZ_ZON4 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 4A CT_PASSENGERS, CT_MAIL, CT_GOODS), // 4A
MS(1967, MAX_YEAR, 0, 140, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 200, 60, 7, 2, 2, MS(1967, CalendarTime::MAX_YEAR, 0, 140, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 200, 60, 7, 2, 2,
TILE_NO_FLAG, TILE_NO_FLAG,
HZ_NOZNS, HZ_NOZNS,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 4B CT_PASSENGERS, CT_MAIL, CT_GOODS), // 4B
MS(1967, MAX_YEAR, 250, 140, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 200, 60, 7, 2, 2, MS(1967, CalendarTime::MAX_YEAR, 250, 140, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 200, 60, 7, 2, 2,
TILE_SIZE_2x1, TILE_SIZE_2x1,
HZ_SUBARTC_ABOVE | HZ_ZON5 | HZ_ZON4 | HZ_ZON3, HZ_SUBARTC_ABOVE | HZ_ZON5 | HZ_ZON4 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 4C CT_PASSENGERS, CT_MAIL, CT_GOODS), // 4C
MS(1967, MAX_YEAR, 0, 140, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 200, 60, 7, 2, 2, MS(1967, CalendarTime::MAX_YEAR, 0, 140, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 200, 60, 7, 2, 2,
TILE_NO_FLAG, TILE_NO_FLAG,
HZ_NOZNS, HZ_NOZNS,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 4D CT_PASSENGERS, CT_MAIL, CT_GOODS), // 4D
MS( 0, MAX_YEAR, 16, 80, STR_TOWN_BUILDING_NAME_HOUSES_2, 80, 6, 3, 1, 2, MS( 0, CalendarTime::MAX_YEAR, 16, 80, STR_TOWN_BUILDING_NAME_HOUSES_2, 80, 6, 3, 1, 2,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4 | HZ_ZON3 | HZ_ZON2, HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4 | HZ_ZON3 | HZ_ZON2,
CT_PASSENGERS, CT_MAIL, CT_FOOD), // 4E CT_PASSENGERS, CT_MAIL, CT_FOOD), // 4E
MS( 0, MAX_YEAR, 16, 80, STR_TOWN_BUILDING_NAME_HOUSES_2, 80, 6, 3, 1, 2, MS( 0, CalendarTime::MAX_YEAR, 16, 80, STR_TOWN_BUILDING_NAME_HOUSES_2, 80, 6, 3, 1, 2,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4 | HZ_ZON3 | HZ_ZON2, HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4 | HZ_ZON3 | HZ_ZON2,
CT_PASSENGERS, CT_MAIL, CT_FOOD), // 4F CT_PASSENGERS, CT_MAIL, CT_FOOD), // 4F
MS( 0, MAX_YEAR, 16, 80, STR_TOWN_BUILDING_NAME_HOUSES_2, 80, 5, 3, 1, 2, MS( 0, CalendarTime::MAX_YEAR, 16, 80, STR_TOWN_BUILDING_NAME_HOUSES_2, 80, 5, 3, 1, 2,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4 | HZ_ZON3 | HZ_ZON2, HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4 | HZ_ZON3 | HZ_ZON2,
CT_PASSENGERS, CT_MAIL, CT_FOOD), // 50 CT_PASSENGERS, CT_MAIL, CT_FOOD), // 50
MS( 0, MAX_YEAR, 7, 30, STR_TOWN_BUILDING_NAME_HOUSES_2, 30, 4, 3, 1, 1, MS( 0, CalendarTime::MAX_YEAR, 7, 30, STR_TOWN_BUILDING_NAME_HOUSES_2, 30, 4, 3, 1, 1,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBTROPIC | HZ_ZON1, HZ_SUBTROPIC | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_FOOD), // 51 CT_PASSENGERS, CT_MAIL, CT_FOOD), // 51
MS( 0, MAX_YEAR, 45, 130, STR_TOWN_BUILDING_NAME_FLATS_1, 95, 15, 6, 2, 1, MS( 0, CalendarTime::MAX_YEAR, 45, 130, STR_TOWN_BUILDING_NAME_FLATS_1, 95, 15, 6, 2, 1,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4 | HZ_ZON3, HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 52 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 52
MS( 0, MAX_YEAR, 8, 90, STR_TOWN_BUILDING_NAME_CHURCH_1, 200, 3, 2, 0, 0, MS( 0, CalendarTime::MAX_YEAR, 8, 90, STR_TOWN_BUILDING_NAME_CHURCH_1, 200, 3, 2, 0, 0,
BUILDING_IS_CHURCH | TILE_SIZE_1x1, BUILDING_IS_CHURCH | TILE_SIZE_1x1,
HZ_SUBTROPIC | HZ_ZON4 | HZ_ZON3 | HZ_ZON2, HZ_SUBTROPIC | HZ_ZON4 | HZ_ZON3 | HZ_ZON2,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 53 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 53
MS( 0, MAX_YEAR, 18, 80, STR_TOWN_BUILDING_NAME_HOUSES_2, 80, 7, 3, 1, 2, MS( 0, CalendarTime::MAX_YEAR, 18, 80, STR_TOWN_BUILDING_NAME_HOUSES_2, 80, 7, 3, 1, 2,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4 | HZ_ZON3 | HZ_ZON2, HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4 | HZ_ZON3 | HZ_ZON2,
CT_PASSENGERS, CT_MAIL, CT_FOOD), // 54 CT_PASSENGERS, CT_MAIL, CT_FOOD), // 54
MS(1973, MAX_YEAR, 90, 110, STR_TOWN_BUILDING_NAME_FLATS_1, 95, 24, 6, 2, 1, MS(1973, CalendarTime::MAX_YEAR, 90, 110, STR_TOWN_BUILDING_NAME_FLATS_1, 95, 24, 6, 2, 1,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4 | HZ_ZON3, HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 55 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 55
MS(1962, MAX_YEAR, 120, 120, STR_TOWN_BUILDING_NAME_FLATS_1, 95, 25, 6, 2, 1, MS(1962, CalendarTime::MAX_YEAR, 120, 120, STR_TOWN_BUILDING_NAME_FLATS_1, 95, 25, 6, 2, 1,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4 | HZ_ZON3, HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 56 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 56
MS(1984, MAX_YEAR, 250, 190, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 140, 80, 8, 3, 4, MS(1984, CalendarTime::MAX_YEAR, 250, 190, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 140, 80, 8, 3, 4,
TILE_SIZE_2x1, TILE_SIZE_2x1,
HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4, HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 57 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 57
MS(1984, MAX_YEAR, 0, 190, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 140, 80, 8, 3, 4, MS(1984, CalendarTime::MAX_YEAR, 0, 190, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 140, 80, 8, 3, 4,
TILE_NO_FLAG, TILE_NO_FLAG,
HZ_SUBTROPIC, HZ_SUBTROPIC,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 58 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 58
MS( 0, MAX_YEAR, 80, 110, STR_TOWN_BUILDING_NAME_FLATS_1, 95, 23, 6, 2, 1, MS( 0, CalendarTime::MAX_YEAR, 80, 110, STR_TOWN_BUILDING_NAME_FLATS_1, 95, 23, 6, 2, 1,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4 | HZ_ZON3, HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 59 CT_PASSENGERS, CT_MAIL, CT_GOODS), // 59
MS(1993, MAX_YEAR, 180, 180, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 150, 90, 8, 3, 4, MS(1993, CalendarTime::MAX_YEAR, 180, 180, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 150, 90, 8, 3, 4,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4 | HZ_ZON3, HZ_SUBTROPIC | HZ_ZON5 | HZ_ZON4 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_GOODS), // 5A CT_PASSENGERS, CT_MAIL, CT_GOODS), // 5A
MS( 0, MAX_YEAR, 8, 90, STR_TOWN_BUILDING_NAME_CHURCH_1, 200, 3, 2, 0, 0, MS( 0, CalendarTime::MAX_YEAR, 8, 90, STR_TOWN_BUILDING_NAME_CHURCH_1, 200, 3, 2, 0, 0,
BUILDING_IS_CHURCH | TILE_SIZE_1x1, BUILDING_IS_CHURCH | TILE_SIZE_1x1,
HZ_TOYLND | HZ_ZON5 | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1, HZ_TOYLND | HZ_ZON5 | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_CANDY), // 5B CT_PASSENGERS, CT_MAIL, CT_CANDY), // 5B
MS( 0, MAX_YEAR, 18, 90, STR_TOWN_BUILDING_NAME_HOUSES_2, 90, 5, 6, 2, 2, MS( 0, CalendarTime::MAX_YEAR, 18, 90, STR_TOWN_BUILDING_NAME_HOUSES_2, 90, 5, 6, 2, 2,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TOYLND | HZ_ZON5 | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1, HZ_TOYLND | HZ_ZON5 | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_CANDY), // 5C CT_PASSENGERS, CT_MAIL, CT_CANDY), // 5C
MS( 0, MAX_YEAR, 7, 70, STR_TOWN_BUILDING_NAME_HOUSES_2, 50, 3, 3, 1, 1, MS( 0, CalendarTime::MAX_YEAR, 7, 70, STR_TOWN_BUILDING_NAME_HOUSES_2, 50, 3, 3, 1, 1,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TOYLND | HZ_ZON2 | HZ_ZON1, HZ_TOYLND | HZ_ZON2 | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_CANDY), // 5D CT_PASSENGERS, CT_MAIL, CT_CANDY), // 5D
MS( 0, MAX_YEAR, 15, 80, STR_TOWN_BUILDING_NAME_HOUSES_2, 75, 6, 3, 1, 2, MS( 0, CalendarTime::MAX_YEAR, 15, 80, STR_TOWN_BUILDING_NAME_HOUSES_2, 75, 6, 3, 1, 2,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TOYLND | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1, HZ_TOYLND | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_CANDY), // 5E CT_PASSENGERS, CT_MAIL, CT_CANDY), // 5E
MS( 0, MAX_YEAR, 17, 80, STR_TOWN_BUILDING_NAME_HOUSES_2, 75, 6, 3, 1, 2, MS( 0, CalendarTime::MAX_YEAR, 17, 80, STR_TOWN_BUILDING_NAME_HOUSES_2, 75, 6, 3, 1, 2,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TOYLND | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1, HZ_TOYLND | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_CANDY), // 5F CT_PASSENGERS, CT_MAIL, CT_CANDY), // 5F
MS( 0, MAX_YEAR, 19, 80, STR_TOWN_BUILDING_NAME_HOUSES_2, 75, 6, 3, 1, 2, MS( 0, CalendarTime::MAX_YEAR, 19, 80, STR_TOWN_BUILDING_NAME_HOUSES_2, 75, 6, 3, 1, 2,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TOYLND | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1, HZ_TOYLND | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_CANDY), // 60 CT_PASSENGERS, CT_MAIL, CT_CANDY), // 60
MS( 0, MAX_YEAR, 21, 80, STR_TOWN_BUILDING_NAME_HOUSES_2, 75, 6, 3, 1, 2, MS( 0, CalendarTime::MAX_YEAR, 21, 80, STR_TOWN_BUILDING_NAME_HOUSES_2, 75, 6, 3, 1, 2,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TOYLND | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1, HZ_TOYLND | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_CANDY), // 61 CT_PASSENGERS, CT_MAIL, CT_CANDY), // 61
MS( 0, MAX_YEAR, 75, 160, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 130, 20, 8, 4, 2, MS( 0, CalendarTime::MAX_YEAR, 75, 160, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 130, 20, 8, 4, 2,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TOYLND | HZ_ZON5 | HZ_ZON4 | HZ_ZON3, HZ_TOYLND | HZ_ZON5 | HZ_ZON4 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_CANDY), // 62 CT_PASSENGERS, CT_MAIL, CT_CANDY), // 62
MS( 0, MAX_YEAR, 35, 90, STR_TOWN_BUILDING_NAME_HOUSES_2, 80, 9, 4, 1, 2, MS( 0, CalendarTime::MAX_YEAR, 35, 90, STR_TOWN_BUILDING_NAME_HOUSES_2, 80, 9, 4, 1, 2,
TILE_SIZE_1x2, TILE_SIZE_1x2,
HZ_TOYLND | HZ_ZON5 | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1, HZ_TOYLND | HZ_ZON5 | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_CANDY), // 63 CT_PASSENGERS, CT_MAIL, CT_CANDY), // 63
MS( 0, MAX_YEAR, 0, 90, STR_TOWN_BUILDING_NAME_HOUSES_2, 80, 0, 4, 1, 2, MS( 0, CalendarTime::MAX_YEAR, 0, 90, STR_TOWN_BUILDING_NAME_HOUSES_2, 80, 0, 4, 1, 2,
TILE_NO_FLAG, TILE_NO_FLAG,
HZ_NOZNS, HZ_NOZNS,
CT_PASSENGERS, CT_MAIL, CT_CANDY), // 64 CT_PASSENGERS, CT_MAIL, CT_CANDY), // 64
MS( 0, MAX_YEAR, 85, 150, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 130, 18, 8, 4, 2, MS( 0, CalendarTime::MAX_YEAR, 85, 150, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 130, 18, 8, 4, 2,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TOYLND | HZ_ZON5 | HZ_ZON4 | HZ_ZON3, HZ_TOYLND | HZ_ZON5 | HZ_ZON4 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_CANDY), // 65 CT_PASSENGERS, CT_MAIL, CT_CANDY), // 65
MS( 0, MAX_YEAR, 11, 60, STR_TOWN_BUILDING_NAME_IGLOO_1, 45, 3, 3, 1, 1, MS( 0, CalendarTime::MAX_YEAR, 11, 60, STR_TOWN_BUILDING_NAME_IGLOO_1, 45, 3, 3, 1, 1,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TOYLND | HZ_ZON1, HZ_TOYLND | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_CANDY), // 66 CT_PASSENGERS, CT_MAIL, CT_CANDY), // 66
MS( 0, MAX_YEAR, 10, 60, STR_TOWN_BUILDING_NAME_TEPEES_1, 45, 3, 3, 1, 1, MS( 0, CalendarTime::MAX_YEAR, 10, 60, STR_TOWN_BUILDING_NAME_TEPEES_1, 45, 3, 3, 1, 1,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TOYLND | HZ_ZON1, HZ_TOYLND | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_CANDY), // 67 CT_PASSENGERS, CT_MAIL, CT_CANDY), // 67
MS( 0, MAX_YEAR, 67, 140, STR_TOWN_BUILDING_NAME_SHOPS_AND_OFFICES_1, 130, 22, 8, 4, 4, MS( 0, CalendarTime::MAX_YEAR, 67, 140, STR_TOWN_BUILDING_NAME_SHOPS_AND_OFFICES_1, 130, 22, 8, 4, 4,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TOYLND | HZ_ZON5 | HZ_ZON4 | HZ_ZON3, HZ_TOYLND | HZ_ZON5 | HZ_ZON4 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_FIZZY_DRINKS), // 68 CT_PASSENGERS, CT_MAIL, CT_FIZZY_DRINKS), // 68
MS( 0, MAX_YEAR, 86, 145, STR_TOWN_BUILDING_NAME_SHOPS_AND_OFFICES_1, 130, 23, 8, 4, 4, MS( 0, CalendarTime::MAX_YEAR, 86, 145, STR_TOWN_BUILDING_NAME_SHOPS_AND_OFFICES_1, 130, 23, 8, 4, 4,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TOYLND | HZ_ZON5 | HZ_ZON4 | HZ_ZON3, HZ_TOYLND | HZ_ZON5 | HZ_ZON4 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_FIZZY_DRINKS), // 69 CT_PASSENGERS, CT_MAIL, CT_FIZZY_DRINKS), // 69
MS( 0, MAX_YEAR, 95, 165, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 130, 28, 8, 4, 2, MS( 0, CalendarTime::MAX_YEAR, 95, 165, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1, 130, 28, 8, 4, 2,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TOYLND | HZ_ZON5 | HZ_ZON4 | HZ_ZON3, HZ_TOYLND | HZ_ZON5 | HZ_ZON4 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_CANDY), // 6A CT_PASSENGERS, CT_MAIL, CT_CANDY), // 6A
MS( 0, MAX_YEAR, 30, 90, STR_TOWN_BUILDING_NAME_STATUE_1, 70, 10, 4, 1, 2, MS( 0, CalendarTime::MAX_YEAR, 30, 90, STR_TOWN_BUILDING_NAME_STATUE_1, 70, 10, 4, 1, 2,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TOYLND | HZ_ZON5 | HZ_ZON4 | HZ_ZON3, HZ_TOYLND | HZ_ZON5 | HZ_ZON4 | HZ_ZON3,
CT_PASSENGERS, CT_MAIL, CT_CANDY), // 6B CT_PASSENGERS, CT_MAIL, CT_CANDY), // 6B
MS( 0, MAX_YEAR, 25, 75, STR_TOWN_BUILDING_NAME_TEAPOT_HOUSE_1, 65, 8, 3, 1, 2, MS( 0, CalendarTime::MAX_YEAR, 25, 75, STR_TOWN_BUILDING_NAME_TEAPOT_HOUSE_1, 65, 8, 3, 1, 2,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TOYLND | HZ_ZON5 | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1, HZ_TOYLND | HZ_ZON5 | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_CANDY), // 6C CT_PASSENGERS, CT_MAIL, CT_CANDY), // 6C
MS( 0, MAX_YEAR, 18, 85, STR_TOWN_BUILDING_NAME_PIGGY_BANK_1, 95, 7, 3, 2, 4, MS( 0, CalendarTime::MAX_YEAR, 18, 85, STR_TOWN_BUILDING_NAME_PIGGY_BANK_1, 95, 7, 3, 2, 4,
TILE_SIZE_1x1, TILE_SIZE_1x1,
HZ_TOYLND | HZ_ZON5 | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1, HZ_TOYLND | HZ_ZON5 | HZ_ZON4 | HZ_ZON3 | HZ_ZON2 | HZ_ZON1,
CT_PASSENGERS, CT_MAIL, CT_FIZZY_DRINKS), // 6D CT_PASSENGERS, CT_MAIL, CT_FIZZY_DRINKS), // 6D

View File

@ -68,42 +68,42 @@ static const uint16_t _accum_days_for_month[] = {
* @param date the date to convert from * @param date the date to convert from
* @param ymd the year, month and day to write to * @param ymd the year, month and day to write to
*/ */
/* static */ void TimerGameCalendar::ConvertDateToYMD(TimerGameCalendar::Date date, YearMonthDay *ymd) /* static */ void TimerGameCalendar::ConvertDateToYMD(TimerGameCalendar::Date date, TimerGameCalendar::YearMonthDay *ymd)
{ {
/* Year determination in multiple steps to account for leap /* Year determination in multiple steps to account for leap
* years. First do the large steps, then the smaller ones. * years. First do the large steps, then the smaller ones.
*/ */
/* There are 97 leap years in 400 years */ /* There are 97 leap years in 400 years */
TimerGameCalendar::Year yr = 400 * (static_cast<int32_t>(date) / (DAYS_IN_YEAR * 400 + 97)); TimerGameCalendar::Year yr = 400 * (static_cast<int32_t>(date) / (CalendarTime::DAYS_IN_YEAR * 400 + 97));
int rem = static_cast<int32_t>(date) % (DAYS_IN_YEAR * 400 + 97); int rem = static_cast<int32_t>(date) % (CalendarTime::DAYS_IN_YEAR * 400 + 97);
uint16_t x; uint16_t x;
if (rem >= DAYS_IN_YEAR * 100 + 25) { if (rem >= CalendarTime::DAYS_IN_YEAR * 100 + 25) {
/* There are 25 leap years in the first 100 years after /* There are 25 leap years in the first 100 years after
* every 400th year, as every 400th year is a leap year */ * every 400th year, as every 400th year is a leap year */
yr += 100; yr += 100;
rem -= DAYS_IN_YEAR * 100 + 25; rem -= CalendarTime::DAYS_IN_YEAR * 100 + 25;
/* There are 24 leap years in the next couple of 100 years */ /* There are 24 leap years in the next couple of 100 years */
yr += 100 * (rem / (DAYS_IN_YEAR * 100 + 24)); yr += 100 * (rem / (CalendarTime::DAYS_IN_YEAR * 100 + 24));
rem = (rem % (DAYS_IN_YEAR * 100 + 24)); rem = (rem % (CalendarTime::DAYS_IN_YEAR * 100 + 24));
} }
if (!TimerGameCalendar::IsLeapYear(yr) && rem >= DAYS_IN_YEAR * 4) { if (!TimerGameCalendar::IsLeapYear(yr) && rem >= CalendarTime::DAYS_IN_YEAR * 4) {
/* The first 4 year of the century are not always a leap year */ /* The first 4 year of the century are not always a leap year */
yr += 4; yr += 4;
rem -= DAYS_IN_YEAR * 4; rem -= CalendarTime::DAYS_IN_YEAR * 4;
} }
/* There is 1 leap year every 4 years */ /* There is 1 leap year every 4 years */
yr += 4 * (rem / (DAYS_IN_YEAR * 4 + 1)); yr += 4 * (rem / (CalendarTime::DAYS_IN_YEAR * 4 + 1));
rem = rem % (DAYS_IN_YEAR * 4 + 1); rem = rem % (CalendarTime::DAYS_IN_YEAR * 4 + 1);
/* The last (max 3) years to account for; the first one /* The last (max 3) years to account for; the first one
* can be, but is not necessarily a leap year */ * can be, but is not necessarily a leap year */
while (rem >= (TimerGameCalendar::IsLeapYear(yr) ? DAYS_IN_LEAP_YEAR : DAYS_IN_YEAR)) { while (rem >= (TimerGameCalendar::IsLeapYear(yr) ? CalendarTime::DAYS_IN_LEAP_YEAR : CalendarTime::DAYS_IN_YEAR)) {
rem -= TimerGameCalendar::IsLeapYear(yr) ? DAYS_IN_LEAP_YEAR : DAYS_IN_YEAR; rem -= TimerGameCalendar::IsLeapYear(yr) ? CalendarTime::DAYS_IN_LEAP_YEAR : CalendarTime::DAYS_IN_YEAR;
yr++; yr++;
} }
@ -131,7 +131,7 @@ static const uint16_t _accum_days_for_month[] = {
/* Account for the missing of the 29th of February in non-leap years */ /* Account for the missing of the 29th of February in non-leap years */
if (!TimerGameCalendar::IsLeapYear(year) && days >= ACCUM_MAR) days--; if (!TimerGameCalendar::IsLeapYear(year) && days >= ACCUM_MAR) days--;
return DateAtStartOfYear(year) + days; return TimerGameCalendar::DateAtStartOfYear(year) + days;
} }
/** /**
@ -151,9 +151,9 @@ static const uint16_t _accum_days_for_month[] = {
*/ */
/* static */ void TimerGameCalendar::SetDate(TimerGameCalendar::Date date, TimerGameCalendar::DateFract fract) /* static */ void TimerGameCalendar::SetDate(TimerGameCalendar::Date date, TimerGameCalendar::DateFract fract)
{ {
assert(fract < DAY_TICKS); assert(fract < Ticks::DAY_TICKS);
YearMonthDay ymd; TimerGameCalendar::YearMonthDay ymd;
TimerGameCalendar::date = date; TimerGameCalendar::date = date;
TimerGameCalendar::date_fract = fract; TimerGameCalendar::date_fract = fract;
@ -189,7 +189,7 @@ void TimerManager<TimerGameCalendar>::Elapsed(TimerGameCalendar::TElapsed delta)
if (_game_mode == GM_MENU) return; if (_game_mode == GM_MENU) return;
TimerGameCalendar::date_fract++; TimerGameCalendar::date_fract++;
if (TimerGameCalendar::date_fract < DAY_TICKS) return; if (TimerGameCalendar::date_fract < Ticks::DAY_TICKS) return;
TimerGameCalendar::date_fract = 0; TimerGameCalendar::date_fract = 0;
/* increase day counter */ /* increase day counter */
@ -240,11 +240,11 @@ void TimerManager<TimerGameCalendar>::Elapsed(TimerGameCalendar::TElapsed delta)
} }
/* check if we reached the maximum year, decrement dates by a year */ /* check if we reached the maximum year, decrement dates by a year */
if (TimerGameCalendar::year == MAX_YEAR + 1) { if (TimerGameCalendar::year == CalendarTime::MAX_YEAR + 1) {
int days_this_year; int days_this_year;
TimerGameCalendar::year--; TimerGameCalendar::year--;
days_this_year = TimerGameCalendar::IsLeapYear(TimerGameCalendar::year) ? DAYS_IN_LEAP_YEAR : DAYS_IN_YEAR; days_this_year = TimerGameCalendar::IsLeapYear(TimerGameCalendar::year) ? CalendarTime::DAYS_IN_LEAP_YEAR : CalendarTime::DAYS_IN_YEAR;
TimerGameCalendar::date -= days_this_year; TimerGameCalendar::date -= days_this_year;
for (Vehicle *v : Vehicle::Iterate()) v->ShiftDates(-days_this_year); for (Vehicle *v : Vehicle::Iterate()) v->ShiftDates(-days_this_year);
for (LinkGraph *lg : LinkGraph::Iterate()) lg->ShiftDates(-days_this_year); for (LinkGraph *lg : LinkGraph::Iterate()) lg->ShiftDates(-days_this_year);

View File

@ -33,6 +33,29 @@
*/ */
class TimerGameCalendar { class TimerGameCalendar {
public: public:
/** The type to store our dates in. */
using Date = StrongType::Typedef<int32_t, struct DateTag, StrongType::Compare, StrongType::Integer>;
/** The fraction of a date we're in, i.e. the number of ticks since the last date changeover. */
using DateFract = uint16_t;
/** Type for the year, note: 0 based, i.e. starts at the year 0. */
using Year = StrongType::Typedef<int32_t, struct YearTag, StrongType::Compare, StrongType::Integer>;
/** Type for the month, note: 0 based, i.e. 0 = January, 11 = December. */
using Month = uint8_t;
/** Type for the day of the month, note: 1 based, first day of a month is 1. */
using Day = uint8_t;
/**
* Data structure to convert between Date and triplet (year, month, and day).
* @see TimerGameCalendar::ConvertDateToYMD(), TimerGameCalendar::ConvertYMDToDate()
*/
struct YearMonthDay {
Year year; ///< Year (0...)
Month month; ///< Month (0..11)
Day day; ///< Day (1..31)
};
enum Trigger { enum Trigger {
DAY, DAY,
WEEK, WEEK,
@ -77,33 +100,35 @@ public:
struct TStorage { struct TStorage {
}; };
/** The type to store our dates in. */ static bool IsLeapYear(Year yr);
using Date = StrongType::Typedef<int32_t, struct DateTag, StrongType::Compare, StrongType::Integer>; static void ConvertDateToYMD(Date date, YearMonthDay * ymd);
static Date ConvertYMDToDate(Year year, Month month, Day day);
/** The fraction of a date we're in, i.e. the number of ticks since the last date changeover. */ static void SetDate(Date date, DateFract fract);
using DateFract = uint16_t;
/** Type for the year, note: 0 based, i.e. starts at the year 0. */
using Year = StrongType::Typedef<int32_t, struct YearTag, StrongType::Compare, StrongType::Integer>;
/** Type for the month, note: 0 based, i.e. 0 = January, 11 = December. */
using Month = uint8_t;
/** Type for the day of the month, note: 1 based, first day of a month is 1. */
using Day = uint8_t;
/** /**
* Data structure to convert between Date and triplet (year, month, and day). * Calculate the year of a given date.
* @see TimerGameCalendar::ConvertDateToYMD(), TimerGameCalendar::ConvertYMDToDate() * @param date The date to consider.
*/ * @return the year.
struct YearMonthDay { */
Year year; ///< Year (0...) static constexpr Year DateToYear(Date date)
Month month; ///< Month (0..11) {
Day day; ///< Day (1..31) /* Hardcode the number of days in a year because we can't access CalendarTime from here. */
}; return static_cast<int32_t>(date) / 366;
}
static bool IsLeapYear(TimerGameCalendar::Year yr); /**
static void ConvertDateToYMD(TimerGameCalendar::Date date, YearMonthDay *ymd); * Calculate the date of the first day of a given year.
static TimerGameCalendar::Date ConvertYMDToDate(TimerGameCalendar::Year year, TimerGameCalendar::Month month, TimerGameCalendar::Day day); * @param year the year to get the first day of.
static void SetDate(TimerGameCalendar::Date date, TimerGameCalendar::DateFract fract); * @return the date.
*/
static constexpr Date DateAtStartOfYear(Year year)
{
int32_t year_as_int = static_cast<int32_t>(year);
uint number_of_leap_years = (year == 0) ? 0 : ((year_as_int - 1) / 4 - (year_as_int - 1) / 100 + (year_as_int - 1) / 400 + 1);
/* Hardcode the number of days in a year because we can't access CalendarTime from here. */
return (365 * year_as_int) + number_of_leap_years;
}
static Year year; ///< Current year, starting at 0. static Year year; ///< Current year, starting at 0.
static Month month; ///< Current month (0..11). static Month month; ///< Current month (0..11).
@ -111,4 +136,53 @@ public:
static DateFract date_fract; ///< Fractional part of the day. static DateFract date_fract; ///< Fractional part of the day.
}; };
/**
* Storage class for Calendar time constants.
*/
class CalendarTime {
public:
static constexpr int DAYS_IN_YEAR = 365; ///< days per year
static constexpr int DAYS_IN_LEAP_YEAR = 366; ///< sometimes, you need one day more...
static constexpr int MONTHS_IN_YEAR = 12; ///< months per year
static constexpr int SECONDS_PER_DAY = 2; ///< approximate seconds per day, not for precise calculations
/*
* ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR and DAYS_TILL_ORIGINAL_BASE_YEAR are
* primarily used for loading newgrf and savegame data and returning some
* newgrf (callback) functions that were in the original (TTD) inherited
* format, where 'TimerGameCalendar::date == 0' meant that it was 1920-01-01.
*/
/** The minimum starting year/base year of the original TTD */
static constexpr TimerGameCalendar::Year ORIGINAL_BASE_YEAR = 1920;
/** The original ending year */
static constexpr TimerGameCalendar::Year ORIGINAL_END_YEAR = 2051;
/** The maximum year of the original TTD */
static constexpr TimerGameCalendar::Year ORIGINAL_MAX_YEAR = 2090;
/** The absolute minimum & maximum years in OTTD */
static constexpr TimerGameCalendar::Year MIN_YEAR = 0;
/** The default starting year */
static constexpr TimerGameCalendar::Year DEF_START_YEAR = 1950;
/** The default scoring end year */
static constexpr TimerGameCalendar::Year DEF_END_YEAR = ORIGINAL_END_YEAR - 1;
/**
* MAX_YEAR, nicely rounded value of the number of years that can
* be encoded in a single 32 bits date, about 2^31 / 366 years.
*/
static constexpr TimerGameCalendar::Year MAX_YEAR = 5000000;
/** The date of the first day of the original base year. */
static constexpr TimerGameCalendar::Date DAYS_TILL_ORIGINAL_BASE_YEAR = TimerGameCalendar::DateAtStartOfYear(ORIGINAL_BASE_YEAR);
/** The date of the last day of the max year. */
static constexpr TimerGameCalendar::Date MAX_DATE = TimerGameCalendar::DateAtStartOfYear(CalendarTime::MAX_YEAR + 1) - 1;
static constexpr TimerGameCalendar::Year INVALID_YEAR = -1; ///< Representation of an invalid year
static constexpr TimerGameCalendar::Date INVALID_DATE = -1; ///< Representation of an invalid date
};
#endif /* TIMER_GAME_CALENDAR_H */ #endif /* TIMER_GAME_CALENDAR_H */

View File

@ -14,9 +14,6 @@
#include <chrono> #include <chrono>
/** Estimation of how many ticks fit in a single second. */
static const uint TICKS_PER_SECOND = 1000 / MILLISECONDS_PER_TICK;
/** /**
* Timer that represents the game-ticks. It will pause when the game is paused. * Timer that represents the game-ticks. It will pause when the game is paused.
* *
@ -24,6 +21,8 @@ static const uint TICKS_PER_SECOND = 1000 / MILLISECONDS_PER_TICK;
*/ */
class TimerGameTick { class TimerGameTick {
public: public:
using Ticks = int32_t; ///< The type to store ticks in
using TPeriod = uint; using TPeriod = uint;
using TElapsed = uint; using TElapsed = uint;
struct TStorage { struct TStorage {
@ -33,4 +32,28 @@ public:
static uint64_t counter; ///< Monotonic counter, in ticks, since start of game. static uint64_t counter; ///< Monotonic counter, in ticks, since start of game.
}; };
/**
* Storage class for Ticks constants.
*/
class Ticks {
public:
static constexpr TimerGameTick::Ticks INVALID_TICKS = -1; ///< Representation of an invalid number of ticks.
/**
* 1 day is 74 ticks; TimerGameCalendar::date_fract used to be uint16_t and incremented by 885. On an overflow the new day begun and 65535 / 885 = 74.
* 1 tick is approximately 27 ms.
* 1 day is thus about 2 seconds (74 * 27 = 1998) on a machine that can run OpenTTD normally
*/
static constexpr TimerGameTick::Ticks DAY_TICKS = 74; ///< ticks per day
static constexpr TimerGameTick::Ticks TICKS_PER_SECOND = 1000 / MILLISECONDS_PER_TICK; ///< Estimation of how many ticks fit in a single second.
static constexpr TimerGameTick::Ticks STATION_RATING_TICKS = 185; ///< Cycle duration for updating station rating.
static constexpr TimerGameTick::Ticks STATION_ACCEPTANCE_TICKS = 250; ///< Cycle duration for updating station acceptance.
static constexpr TimerGameTick::Ticks STATION_LINKGRAPH_TICKS = 504; ///< Cycle duration for cleaning dead links.
static constexpr TimerGameTick::Ticks CARGO_AGING_TICKS = 185; ///< Cycle duration for aging cargo.
static constexpr TimerGameTick::Ticks INDUSTRY_PRODUCE_TICKS = 256; ///< Cycle duration for industry production.
static constexpr TimerGameTick::Ticks TOWN_GROWTH_TICKS = 70; ///< Cycle duration for towns trying to grow (this originates from the size of the town array in TTD).
static constexpr TimerGameTick::Ticks INDUSTRY_CUT_TREE_TICKS = INDUSTRY_PRODUCE_TICKS * 2; ///< Cycle duration for lumber mill's extra action.
};
#endif /* TIMER_GAME_TICK_H */ #endif /* TIMER_GAME_TICK_H */

View File

@ -10,7 +10,7 @@
#ifndef TIMETABLE_H #ifndef TIMETABLE_H
#define TIMETABLE_H #define TIMETABLE_H
#include "date_type.h" #include "timer/timer_game_tick.h"
#include "timer/timer_game_calendar.h" #include "timer/timer_game_calendar.h"
#include "vehicle_type.h" #include "vehicle_type.h"
@ -18,6 +18,6 @@ static const TimerGameCalendar::Year MAX_TIMETABLE_START_YEARS = 15; ///< The ma
void ShowTimetableWindow(const Vehicle *v); void ShowTimetableWindow(const Vehicle *v);
void UpdateVehicleTimetable(Vehicle *v, bool travelling); void UpdateVehicleTimetable(Vehicle *v, bool travelling);
void SetTimetableParams(int param1, int param2, Ticks ticks); void SetTimetableParams(int param1, int param2, TimerGameTick::Ticks ticks);
#endif /* TIMETABLE_H */ #endif /* TIMETABLE_H */

View File

@ -10,6 +10,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "command_func.h" #include "command_func.h"
#include "company_func.h" #include "company_func.h"
#include "timer/timer_game_tick.h"
#include "timer/timer_game_calendar.h" #include "timer/timer_game_calendar.h"
#include "window_func.h" #include "window_func.h"
#include "vehicle_base.h" #include "vehicle_base.h"
@ -303,11 +304,11 @@ CommandCost CmdSetTimetableStart(DoCommandFlag flags, VehicleID veh_id, bool tim
int total_duration = v->orders->GetTimetableTotalDuration(); int total_duration = v->orders->GetTimetableTotalDuration();
/* Don't let a timetable start more than 15 years into the future or 1 year in the past. */ /* Don't let a timetable start more than 15 years into the future or 1 year in the past. */
if (start_date < 0 || start_date > MAX_DATE) return CMD_ERROR; if (start_date < 0 || start_date > CalendarTime::MAX_DATE) return CMD_ERROR;
if (start_date - TimerGameCalendar::date > DateAtStartOfYear(MAX_TIMETABLE_START_YEARS)) return CMD_ERROR; if (start_date - TimerGameCalendar::date > TimerGameCalendar::DateAtStartOfYear(MAX_TIMETABLE_START_YEARS)) return CMD_ERROR;
if (TimerGameCalendar::date - start_date > DAYS_IN_LEAP_YEAR) return CMD_ERROR; if (TimerGameCalendar::date - start_date > CalendarTime::DAYS_IN_LEAP_YEAR) return CMD_ERROR;
if (timetable_all && !v->orders->IsCompleteTimetable()) return CommandCost(STR_ERROR_TIMETABLE_INCOMPLETE); if (timetable_all && !v->orders->IsCompleteTimetable()) return CommandCost(STR_ERROR_TIMETABLE_INCOMPLETE);
if (timetable_all && start_date + total_duration / DAY_TICKS > MAX_DATE) return CMD_ERROR; if (timetable_all && start_date + total_duration / Ticks::DAY_TICKS > CalendarTime::MAX_DATE) return CMD_ERROR;
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
std::vector<Vehicle *> vehs; std::vector<Vehicle *> vehs;
@ -333,7 +334,7 @@ CommandCost CmdSetTimetableStart(DoCommandFlag flags, VehicleID veh_id, bool tim
w->lateness_counter = 0; w->lateness_counter = 0;
ClrBit(w->vehicle_flags, VF_TIMETABLE_STARTED); ClrBit(w->vehicle_flags, VF_TIMETABLE_STARTED);
/* Do multiplication, then division to reduce rounding errors. */ /* Do multiplication, then division to reduce rounding errors. */
w->timetable_start = start_date + idx * total_duration / num_vehs / DAY_TICKS; w->timetable_start = start_date + idx * total_duration / num_vehs / Ticks::DAY_TICKS;
SetWindowDirty(WC_VEHICLE_TIMETABLE, w->index); SetWindowDirty(WC_VEHICLE_TIMETABLE, w->index);
++idx; ++idx;
} }
@ -426,7 +427,7 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling)
just_started = !HasBit(v->vehicle_flags, VF_TIMETABLE_STARTED); just_started = !HasBit(v->vehicle_flags, VF_TIMETABLE_STARTED);
if (v->timetable_start != 0) { if (v->timetable_start != 0) {
v->lateness_counter = static_cast<int32_t>(TimerGameCalendar::date - v->timetable_start) * DAY_TICKS + TimerGameCalendar::date_fract; v->lateness_counter = static_cast<int32_t>(TimerGameCalendar::date - v->timetable_start) * Ticks::DAY_TICKS + TimerGameCalendar::date_fract;
v->timetable_start = 0; v->timetable_start = 0;
} }
@ -460,7 +461,7 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling)
* the timetable entry like is done for road vehicles/ships. * the timetable entry like is done for road vehicles/ships.
* Thus always make sure at least one tick is used between the * Thus always make sure at least one tick is used between the
* processing of different orders when filling the timetable. */ * processing of different orders when filling the timetable. */
uint time_to_set = CeilDiv(std::max(time_taken, 1U), DAY_TICKS) * DAY_TICKS; uint time_to_set = CeilDiv(std::max(time_taken, 1U), Ticks::DAY_TICKS) * Ticks::DAY_TICKS;
if (travelling && (autofilling || !real_current_order->IsTravelTimetabled())) { if (travelling && (autofilling || !real_current_order->IsTravelTimetabled())) {
ChangeTimetable(v, v->cur_real_order_index, time_to_set, MTF_TRAVEL_TIME, autofilling); ChangeTimetable(v, v->cur_real_order_index, time_to_set, MTF_TRAVEL_TIME, autofilling);
@ -493,10 +494,10 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling)
* check how many ticks the (fully filled) timetable has. If a timetable cycle is * check how many ticks the (fully filled) timetable has. If a timetable cycle is
* shorter than the amount of ticks we are late we reduce the lateness by the * shorter than the amount of ticks we are late we reduce the lateness by the
* length of a full cycle till lateness is less than the length of a timetable * length of a full cycle till lateness is less than the length of a timetable
* cycle. When the timetable isn't fully filled the cycle will be INVALID_TICKS. */ * cycle. When the timetable isn't fully filled the cycle will be Ticks::INVALID_TICKS. */
if (v->lateness_counter > (int)timetabled) { if (v->lateness_counter > (int)timetabled) {
Ticks cycle = v->orders->GetTimetableTotalDuration(); TimerGameTick::Ticks cycle = v->orders->GetTimetableTotalDuration();
if (cycle != INVALID_TICKS && v->lateness_counter > cycle) { if (cycle != Ticks::INVALID_TICKS && v->lateness_counter > cycle) {
v->lateness_counter %= cycle; v->lateness_counter %= cycle;
} }
} }

View File

@ -18,6 +18,7 @@
#include "string_func.h" #include "string_func.h"
#include "gfx_func.h" #include "gfx_func.h"
#include "company_func.h" #include "company_func.h"
#include "timer/timer_game_tick.h"
#include "timer/timer_game_calendar.h" #include "timer/timer_game_calendar.h"
#include "date_gui.h" #include "date_gui.h"
#include "vehicle_gui.h" #include "vehicle_gui.h"
@ -34,8 +35,8 @@
/** Container for the arrival/departure dates of a vehicle */ /** Container for the arrival/departure dates of a vehicle */
struct TimetableArrivalDeparture { struct TimetableArrivalDeparture {
Ticks arrival; ///< The arrival time TimerGameTick::Ticks arrival; ///< The arrival time
Ticks departure; ///< The departure time TimerGameTick::Ticks departure; ///< The departure time
}; };
/** /**
@ -44,14 +45,14 @@ struct TimetableArrivalDeparture {
* @param param2 the second DParam to fill * @param param2 the second DParam to fill
* @param ticks the number of ticks to 'draw' * @param ticks the number of ticks to 'draw'
*/ */
void SetTimetableParams(int param1, int param2, Ticks ticks) void SetTimetableParams(int param1, int param2, TimerGameTick::Ticks ticks)
{ {
if (_settings_client.gui.timetable_in_ticks) { if (_settings_client.gui.timetable_in_ticks) {
SetDParam(param1, STR_TIMETABLE_TICKS); SetDParam(param1, STR_TIMETABLE_TICKS);
SetDParam(param2, ticks); SetDParam(param2, ticks);
} else { } else {
SetDParam(param1, STR_TIMETABLE_DAYS); SetDParam(param1, STR_TIMETABLE_DAYS);
SetDParam(param2, ticks / DAY_TICKS); SetDParam(param2, ticks / Ticks::DAY_TICKS);
} }
} }
@ -85,7 +86,7 @@ static bool CanDetermineTimeTaken(const Order *order, bool travelling)
* @param table Fill in arrival and departures including intermediate orders * @param table Fill in arrival and departures including intermediate orders
* @param offset Add this value to result and all arrivals and departures * @param offset Add this value to result and all arrivals and departures
*/ */
static void FillTimetableArrivalDepartureTable(const Vehicle *v, VehicleOrderID start, bool travelling, std::vector<TimetableArrivalDeparture> &table, Ticks offset) static void FillTimetableArrivalDepartureTable(const Vehicle *v, VehicleOrderID start, bool travelling, std::vector<TimetableArrivalDeparture> &table, TimerGameTick::Ticks offset)
{ {
assert(!table.empty()); assert(!table.empty());
assert(v->GetNumOrders() >= 2); assert(v->GetNumOrders() >= 2);
@ -93,10 +94,10 @@ static void FillTimetableArrivalDepartureTable(const Vehicle *v, VehicleOrderID
/* Pre-initialize with unknown time */ /* Pre-initialize with unknown time */
for (int i = 0; i < v->GetNumOrders(); ++i) { for (int i = 0; i < v->GetNumOrders(); ++i) {
table[i].arrival = table[i].departure = INVALID_TICKS; table[i].arrival = table[i].departure = Ticks::INVALID_TICKS;
} }
Ticks sum = offset; TimerGameTick::Ticks sum = offset;
VehicleOrderID i = start; VehicleOrderID i = start;
const Order *order = v->GetOrder(i); const Order *order = v->GetOrder(i);
@ -182,7 +183,7 @@ struct TimetableWindow : Window {
assert(HasBit(v->vehicle_flags, VF_TIMETABLE_STARTED)); assert(HasBit(v->vehicle_flags, VF_TIMETABLE_STARTED));
bool travelling = (!v->current_order.IsType(OT_LOADING) || v->current_order.GetNonStopType() == ONSF_STOP_EVERYWHERE); bool travelling = (!v->current_order.IsType(OT_LOADING) || v->current_order.GetNonStopType() == ONSF_STOP_EVERYWHERE);
Ticks start_time = TimerGameCalendar::date_fract - v->current_order_time; TimerGameTick::Ticks start_time = TimerGameCalendar::date_fract - v->current_order_time;
FillTimetableArrivalDepartureTable(v, v->cur_real_order_index % v->GetNumOrders(), travelling, table, start_time); FillTimetableArrivalDepartureTable(v, v->cur_real_order_index % v->GetNumOrders(), travelling, table, start_time);
@ -193,7 +194,7 @@ struct TimetableWindow : Window {
{ {
switch (widget) { switch (widget) {
case WID_VT_ARRIVAL_DEPARTURE_PANEL: case WID_VT_ARRIVAL_DEPARTURE_PANEL:
SetDParamMaxValue(1, DateAtStartOfYear(MAX_YEAR), 0, FS_SMALL); SetDParamMaxValue(1, TimerGameCalendar::DateAtStartOfYear(CalendarTime::MAX_YEAR), 0, FS_SMALL);
size->width = std::max(GetStringBoundingBox(STR_TIMETABLE_ARRIVAL).width, GetStringBoundingBox(STR_TIMETABLE_DEPARTURE).width) + WidgetDimensions::scaled.hsep_wide + padding.width; size->width = std::max(GetStringBoundingBox(STR_TIMETABLE_ARRIVAL).width, GetStringBoundingBox(STR_TIMETABLE_DEPARTURE).width) + WidgetDimensions::scaled.hsep_wide + padding.width;
FALLTHROUGH; FALLTHROUGH;
@ -425,7 +426,7 @@ struct TimetableWindow : Window {
/* Arrival and departure times are handled in an all-or-nothing approach, /* Arrival and departure times are handled in an all-or-nothing approach,
* i.e. are only shown if we can calculate all times. * i.e. are only shown if we can calculate all times.
* Excluding order lists with only one order makes some things easier. */ * Excluding order lists with only one order makes some things easier. */
Ticks total_time = v->orders != nullptr ? v->orders->GetTimetableDurationIncomplete() : 0; TimerGameTick::Ticks total_time = v->orders != nullptr ? v->orders->GetTimetableDurationIncomplete() : 0;
if (total_time <= 0 || v->GetNumOrders() <= 1 || !HasBit(v->vehicle_flags, VF_TIMETABLE_STARTED)) return; if (total_time <= 0 || v->GetNumOrders() <= 1 || !HasBit(v->vehicle_flags, VF_TIMETABLE_STARTED)) return;
std::vector<TimetableArrivalDeparture> arr_dep(v->GetNumOrders()); std::vector<TimetableArrivalDeparture> arr_dep(v->GetNumOrders());
@ -435,8 +436,8 @@ struct TimetableWindow : Window {
int selected = this->sel_index; int selected = this->sel_index;
Rect tr = r.Shrink(WidgetDimensions::scaled.framerect); Rect tr = r.Shrink(WidgetDimensions::scaled.framerect);
bool show_late = this->show_expected && v->lateness_counter > DAY_TICKS; bool show_late = this->show_expected && v->lateness_counter > Ticks::DAY_TICKS;
Ticks offset = show_late ? 0 : -v->lateness_counter; TimerGameTick::Ticks offset = show_late ? 0 : -v->lateness_counter;
for (int i = this->vscroll->GetPosition(); i / 2 < v->GetNumOrders(); ++i) { // note: i is also incremented in the loop for (int i = this->vscroll->GetPosition(); i / 2 < v->GetNumOrders(); ++i) { // note: i is also incremented in the loop
/* Don't draw anything if it extends past the end of the window. */ /* Don't draw anything if it extends past the end of the window. */
@ -446,9 +447,9 @@ struct TimetableWindow : Window {
SetDParam(0, show_late ? TC_RED : TC_INVALID); SetDParam(0, show_late ? TC_RED : TC_INVALID);
if (i % 2 == 0) { if (i % 2 == 0) {
/* Draw an arrival time. */ /* Draw an arrival time. */
if (arr_dep[i / 2].arrival != INVALID_TICKS) { if (arr_dep[i / 2].arrival != Ticks::INVALID_TICKS) {
/* First set the offset and text colour based on the expected/scheduled mode and some other things. */ /* First set the offset and text colour based on the expected/scheduled mode and some other things. */
Ticks this_offset; TimerGameTick::Ticks this_offset;
if (this->show_expected && i / 2 == earlyID) { if (this->show_expected && i / 2 == earlyID) {
/* Show expected arrival. */ /* Show expected arrival. */
this_offset = 0; this_offset = 0;
@ -459,13 +460,13 @@ struct TimetableWindow : Window {
} }
/* Now actually draw the arrival time. */ /* Now actually draw the arrival time. */
SetDParam(1, TimerGameCalendar::date + (arr_dep[i / 2].arrival + this_offset) / DAY_TICKS); SetDParam(1, TimerGameCalendar::date + (arr_dep[i / 2].arrival + this_offset) / Ticks::DAY_TICKS);
DrawString(tr.left, tr.right, tr.top, STR_TIMETABLE_ARRIVAL, i == selected ? TC_WHITE : TC_BLACK); DrawString(tr.left, tr.right, tr.top, STR_TIMETABLE_ARRIVAL, i == selected ? TC_WHITE : TC_BLACK);
} }
} else { } else {
/* Draw a departure time. */ /* Draw a departure time. */
if (arr_dep[i / 2].departure != INVALID_TICKS) { if (arr_dep[i / 2].departure != Ticks::INVALID_TICKS) {
SetDParam(1, TimerGameCalendar::date + (arr_dep[i / 2].departure + offset) / DAY_TICKS); SetDParam(1, TimerGameCalendar::date + (arr_dep[i / 2].departure + offset) / Ticks::DAY_TICKS);
DrawString(tr.left, tr.right, tr.top, STR_TIMETABLE_DEPARTURE, i == selected ? TC_WHITE : TC_BLACK); DrawString(tr.left, tr.right, tr.top, STR_TIMETABLE_DEPARTURE, i == selected ? TC_WHITE : TC_BLACK);
} }
} }
@ -482,7 +483,7 @@ struct TimetableWindow : Window {
const Vehicle *v = this->vehicle; const Vehicle *v = this->vehicle;
Rect tr = r.Shrink(WidgetDimensions::scaled.framerect); Rect tr = r.Shrink(WidgetDimensions::scaled.framerect);
Ticks total_time = v->orders != nullptr ? v->orders->GetTimetableDurationIncomplete() : 0; TimerGameTick::Ticks total_time = v->orders != nullptr ? v->orders->GetTimetableDurationIncomplete() : 0;
if (total_time != 0) { if (total_time != 0) {
SetTimetableParams(0, 1, total_time); SetTimetableParams(0, 1, total_time);
DrawString(tr, v->orders->IsCompleteTimetable() ? STR_TIMETABLE_TOTAL_TIME : STR_TIMETABLE_TOTAL_TIME_INCOMPLETE); DrawString(tr, v->orders->IsCompleteTimetable() ? STR_TIMETABLE_TOTAL_TIME : STR_TIMETABLE_TOTAL_TIME_INCOMPLETE);
@ -499,7 +500,7 @@ struct TimetableWindow : Window {
/* We aren't running on a timetable yet, so how can we be "on time" /* We aren't running on a timetable yet, so how can we be "on time"
* when we aren't even "on service"/"on duty"? */ * when we aren't even "on service"/"on duty"? */
DrawString(tr, STR_TIMETABLE_STATUS_NOT_STARTED); DrawString(tr, STR_TIMETABLE_STATUS_NOT_STARTED);
} else if (v->lateness_counter == 0 || (!_settings_client.gui.timetable_in_ticks && v->lateness_counter / DAY_TICKS == 0)) { } else if (v->lateness_counter == 0 || (!_settings_client.gui.timetable_in_ticks && v->lateness_counter / Ticks::DAY_TICKS == 0)) {
DrawString(tr, STR_TIMETABLE_STATUS_ON_TIME); DrawString(tr, STR_TIMETABLE_STATUS_ON_TIME);
} else { } else {
SetTimetableParams(0, 1, abs(v->lateness_counter)); SetTimetableParams(0, 1, abs(v->lateness_counter));
@ -570,7 +571,7 @@ struct TimetableWindow : Window {
if (order != nullptr) { if (order != nullptr) {
uint time = (selected % 2 != 0) ? order->GetTravelTime() : order->GetWaitTime(); uint time = (selected % 2 != 0) ? order->GetTravelTime() : order->GetWaitTime();
if (!_settings_client.gui.timetable_in_ticks) time /= DAY_TICKS; if (!_settings_client.gui.timetable_in_ticks) time /= Ticks::DAY_TICKS;
if (time != 0) { if (time != 0) {
SetDParam(0, time); SetDParam(0, time);
@ -666,7 +667,7 @@ struct TimetableWindow : Window {
} }
case WID_VT_CHANGE_TIME: case WID_VT_CHANGE_TIME:
if (!_settings_client.gui.timetable_in_ticks) val *= DAY_TICKS; if (!_settings_client.gui.timetable_in_ticks) val *= Ticks::DAY_TICKS;
if (this->change_timetable_all) { if (this->change_timetable_all) {
Command<CMD_BULK_CHANGE_TIMETABLE>::Post(STR_ERROR_CAN_T_TIMETABLE_VEHICLE, v->index, mtf, ClampTo<uint16_t>(val)); Command<CMD_BULK_CHANGE_TIMETABLE>::Post(STR_ERROR_CAN_T_TIMETABLE_VEHICLE, v->index, mtf, ClampTo<uint16_t>(val));

View File

@ -1148,7 +1148,7 @@ void ToggleDirtyBlocks()
*/ */
void SetStartingYear(TimerGameCalendar::Year year) void SetStartingYear(TimerGameCalendar::Year year)
{ {
_settings_game.game_creation.starting_year = Clamp(year, MIN_YEAR, MAX_YEAR); _settings_game.game_creation.starting_year = Clamp(year, CalendarTime::MIN_YEAR, CalendarTime::MAX_YEAR);
TimerGameCalendar::Date new_date = TimerGameCalendar::ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1); TimerGameCalendar::Date new_date = TimerGameCalendar::ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1);
/* If you open a savegame as scenario there may already be link graphs.*/ /* If you open a savegame as scenario there may already be link graphs.*/
LinkGraphSchedule::instance.ShiftDates(new_date - TimerGameCalendar::date); LinkGraphSchedule::instance.ShiftDates(new_date - TimerGameCalendar::date);
@ -2357,8 +2357,8 @@ struct ScenarioEditorToolbarWindow : Window {
void OnPaint() override void OnPaint() override
{ {
this->SetWidgetDisabledState(WID_TE_DATE_BACKWARD, _settings_game.game_creation.starting_year <= MIN_YEAR); this->SetWidgetDisabledState(WID_TE_DATE_BACKWARD, _settings_game.game_creation.starting_year <= CalendarTime::MIN_YEAR);
this->SetWidgetDisabledState(WID_TE_DATE_FORWARD, _settings_game.game_creation.starting_year >= MAX_YEAR); this->SetWidgetDisabledState(WID_TE_DATE_FORWARD, _settings_game.game_creation.starting_year >= CalendarTime::MAX_YEAR);
this->SetWidgetDisabledState(WID_TE_ROADS, (GetRoadTypes(true) & ~_roadtypes_type) == ROADTYPES_NONE); this->SetWidgetDisabledState(WID_TE_ROADS, (GetRoadTypes(true) & ~_roadtypes_type) == ROADTYPES_NONE);
this->SetWidgetDisabledState(WID_TE_TRAMS, (GetRoadTypes(true) & _roadtypes_type) == ROADTYPES_NONE); this->SetWidgetDisabledState(WID_TE_TRAMS, (GetRoadTypes(true) & _roadtypes_type) == ROADTYPES_NONE);
@ -2398,7 +2398,7 @@ struct ScenarioEditorToolbarWindow : Window {
break; break;
case WID_TE_DATE: case WID_TE_DATE:
SetDParam(0, TimerGameCalendar::ConvertYMDToDate(MAX_YEAR, 0, 1)); SetDParam(0, TimerGameCalendar::ConvertYMDToDate(CalendarTime::MAX_YEAR, 0, 1));
*size = GetStringBoundingBox(STR_JUST_DATE_LONG); *size = GetStringBoundingBox(STR_JUST_DATE_LONG);
break; break;
} }
@ -2512,7 +2512,7 @@ struct ScenarioEditorToolbarWindow : Window {
value = atoi(str); value = atoi(str);
} else { } else {
/* An empty string means revert to the default */ /* An empty string means revert to the default */
value = static_cast<int32_t>(DEF_START_YEAR); value = static_cast<int32_t>(CalendarTime::DEF_START_YEAR);
} }
SetStartingYear(value); SetStartingYear(value);

View File

@ -11,7 +11,7 @@
#define TOWN_H #define TOWN_H
#include "viewport_type.h" #include "viewport_type.h"
#include "date_type.h" #include "timer/timer_game_tick.h"
#include "town_map.h" #include "town_map.h"
#include "subsidy_type.h" #include "subsidy_type.h"
#include "newgrf_storage.h" #include "newgrf_storage.h"
@ -305,7 +305,7 @@ void MakeDefaultName(T *obj)
* tick 0 is a valid tick so actual amount is one more than the counter value. * tick 0 is a valid tick so actual amount is one more than the counter value.
*/ */
static inline uint16_t TownTicksToGameTicks(uint16_t ticks) { static inline uint16_t TownTicksToGameTicks(uint16_t ticks) {
return (std::min(ticks, MAX_TOWN_GROWTH_TICKS) + 1) * TOWN_GROWTH_TICKS - 1; return (std::min(ticks, MAX_TOWN_GROWTH_TICKS) + 1) * Ticks::TOWN_GROWTH_TICKS - 1;
} }

View File

@ -822,7 +822,7 @@ static void TownTickHandler(Town *t)
i = t->growth_rate; i = t->growth_rate;
} else { } else {
/* If growth failed wait a bit before retrying */ /* If growth failed wait a bit before retrying */
i = std::min<uint16_t>(t->growth_rate, TOWN_GROWTH_TICKS - 1); i = std::min<uint16_t>(t->growth_rate, Ticks::TOWN_GROWTH_TICKS - 1);
} }
} }
t->grow_counter = i; t->grow_counter = i;
@ -871,7 +871,7 @@ RoadType GetTownRoadType(const Town *t)
if (!HasBit(rti->flags, ROTF_TOWN_BUILD)) continue; if (!HasBit(rti->flags, ROTF_TOWN_BUILD)) continue;
/* Not yet introduced at this date. */ /* Not yet introduced at this date. */
if (IsInsideMM(rti->introduction_date, 0, static_cast<int32_t>(MAX_DATE)) && rti->introduction_date > TimerGameCalendar::date) continue; if (IsInsideMM(rti->introduction_date, 0, static_cast<int32_t>(CalendarTime::MAX_DATE)) && rti->introduction_date > TimerGameCalendar::date) continue;
if (best != nullptr) { if (best != nullptr) {
if ((rti->max_speed == 0 ? assume_max_speed : rti->max_speed) < (best->max_speed == 0 ? assume_max_speed : best->max_speed)) continue; if ((rti->max_speed == 0 ? assume_max_speed : rti->max_speed) < (best->max_speed == 0 ? assume_max_speed : best->max_speed)) continue;
@ -1868,7 +1868,7 @@ static void DoCreateTown(Town *t, TileIndex tile, uint32_t townnameparts, TownSi
t->cache.population = 0; t->cache.population = 0;
/* Spread growth across ticks so even if there are many /* Spread growth across ticks so even if there are many
* similar towns they're unlikely to grow all in one tick */ * similar towns they're unlikely to grow all in one tick */
t->grow_counter = t->index % TOWN_GROWTH_TICKS; t->grow_counter = t->index % Ticks::TOWN_GROWTH_TICKS;
t->growth_rate = TownTicksToGameTicks(250); t->growth_rate = TownTicksToGameTicks(250);
t->show_zone = false; t->show_zone = false;
@ -3236,7 +3236,7 @@ static CommandCost TownActionFundBuildings(Town *t, DoCommandFlag flags)
* tick-perfect and gives player some time window where they can * tick-perfect and gives player some time window where they can
* spam funding with the exact same efficiency. * spam funding with the exact same efficiency.
*/ */
t->grow_counter = std::min<uint16_t>(t->grow_counter, 2 * TOWN_GROWTH_TICKS - (t->growth_rate - t->grow_counter) % TOWN_GROWTH_TICKS); t->grow_counter = std::min<uint16_t>(t->grow_counter, 2 * Ticks::TOWN_GROWTH_TICKS - (t->growth_rate - t->grow_counter) % Ticks::TOWN_GROWTH_TICKS);
SetWindowDirty(WC_TOWN_VIEW, t->index); SetWindowDirty(WC_TOWN_VIEW, t->index);
} }

View File

@ -453,7 +453,7 @@ public:
} }
if (HasBit(this->town->flags, TOWN_IS_GROWING)) { if (HasBit(this->town->flags, TOWN_IS_GROWING)) {
SetDParam(0, RoundDivSU(this->town->growth_rate + 1, DAY_TICKS)); SetDParam(0, RoundDivSU(this->town->growth_rate + 1, Ticks::DAY_TICKS));
DrawString(tr, this->town->fund_buildings_months == 0 ? STR_TOWN_VIEW_TOWN_GROWS_EVERY : STR_TOWN_VIEW_TOWN_GROWS_EVERY_FUNDED); DrawString(tr, this->town->fund_buildings_months == 0 ? STR_TOWN_VIEW_TOWN_GROWS_EVERY : STR_TOWN_VIEW_TOWN_GROWS_EVERY_FUNDED);
tr.top += FONT_HEIGHT_NORMAL; tr.top += FONT_HEIGHT_NORMAL;
} else { } else {

View File

@ -3353,12 +3353,12 @@ bool TrainController(Train *v, Vehicle *nomove, bool reverse)
v->cur_speed = 0; v->cur_speed = 0;
v->subspeed = 0; v->subspeed = 0;
v->progress = 255; // make sure that every bit of acceleration will hit the signal again, so speed stays 0. v->progress = 255; // make sure that every bit of acceleration will hit the signal again, so speed stays 0.
if (!_settings_game.pf.reverse_at_signals || ++v->wait_counter < _settings_game.pf.wait_oneway_signal * DAY_TICKS * 2) return false; if (!_settings_game.pf.reverse_at_signals || ++v->wait_counter < _settings_game.pf.wait_oneway_signal * Ticks::DAY_TICKS * 2) return false;
} else if (HasSignalOnTrackdir(gp.new_tile, i)) { } else if (HasSignalOnTrackdir(gp.new_tile, i)) {
v->cur_speed = 0; v->cur_speed = 0;
v->subspeed = 0; v->subspeed = 0;
v->progress = 255; // make sure that every bit of acceleration will hit the signal again, so speed stays 0. v->progress = 255; // make sure that every bit of acceleration will hit the signal again, so speed stays 0.
if (!_settings_game.pf.reverse_at_signals || ++v->wait_counter < _settings_game.pf.wait_twoway_signal * DAY_TICKS * 2) { if (!_settings_game.pf.reverse_at_signals || ++v->wait_counter < _settings_game.pf.wait_twoway_signal * Ticks::DAY_TICKS * 2) {
DiagDirection exitdir = TrackdirToExitdir(i); DiagDirection exitdir = TrackdirToExitdir(i);
TileIndex o_tile = TileAddByDiagDir(gp.new_tile, exitdir); TileIndex o_tile = TileAddByDiagDir(gp.new_tile, exitdir);
@ -3978,14 +3978,14 @@ static bool TrainLocoHandler(Train *v, bool mode)
++v->wait_counter; ++v->wait_counter;
/* Should we try reversing this tick if still stuck? */ /* Should we try reversing this tick if still stuck? */
bool turn_around = v->wait_counter % (_settings_game.pf.wait_for_pbs_path * DAY_TICKS) == 0 && _settings_game.pf.reverse_at_signals; bool turn_around = v->wait_counter % (_settings_game.pf.wait_for_pbs_path * Ticks::DAY_TICKS) == 0 && _settings_game.pf.reverse_at_signals;
if (!turn_around && v->wait_counter % _settings_game.pf.path_backoff_interval != 0 && v->force_proceed == TFP_NONE) return true; if (!turn_around && v->wait_counter % _settings_game.pf.path_backoff_interval != 0 && v->force_proceed == TFP_NONE) return true;
if (!TryPathReserve(v)) { if (!TryPathReserve(v)) {
/* Still stuck. */ /* Still stuck. */
if (turn_around) ReverseTrainDirection(v); if (turn_around) ReverseTrainDirection(v);
if (HasBit(v->flags, VRF_TRAIN_STUCK) && v->wait_counter > 2 * _settings_game.pf.wait_for_pbs_path * DAY_TICKS) { if (HasBit(v->flags, VRF_TRAIN_STUCK) && v->wait_counter > 2 * _settings_game.pf.wait_for_pbs_path * Ticks::DAY_TICKS) {
/* Show message to player. */ /* Show message to player. */
if (_settings_client.gui.lost_vehicle_warn && v->owner == _local_company) { if (_settings_client.gui.lost_vehicle_warn && v->owner == _local_company) {
SetDParam(0, v->index); SetDParam(0, v->index);
@ -4179,7 +4179,7 @@ void Train::OnNewDay()
if (this->running_ticks != 0) { if (this->running_ticks != 0) {
/* running costs */ /* running costs */
CommandCost cost(EXPENSES_TRAIN_RUN, this->GetRunningCost() * this->running_ticks / (DAYS_IN_YEAR * DAY_TICKS)); CommandCost cost(EXPENSES_TRAIN_RUN, this->GetRunningCost() * this->running_ticks / (CalendarTime::DAYS_IN_YEAR * Ticks::DAY_TICKS));
this->profit_this_year -= cost.GetCost(); this->profit_this_year -= cost.GetCost();
this->running_ticks = 0; this->running_ticks = 0;

View File

@ -918,7 +918,7 @@ static void RunVehicleDayProc()
if (_game_mode != GM_NORMAL) return; if (_game_mode != GM_NORMAL) return;
/* Run the day_proc for every DAY_TICKS vehicle starting at TimerGameCalendar::date_fract. */ /* Run the day_proc for every DAY_TICKS vehicle starting at TimerGameCalendar::date_fract. */
for (size_t i = TimerGameCalendar::date_fract; i < Vehicle::GetPoolSize(); i += DAY_TICKS) { for (size_t i = TimerGameCalendar::date_fract; i < Vehicle::GetPoolSize(); i += Ticks::DAY_TICKS) {
Vehicle *v = Vehicle::Get(i); Vehicle *v = Vehicle::Get(i);
if (v == nullptr) continue; if (v == nullptr) continue;
@ -1369,7 +1369,7 @@ bool Vehicle::HandleBreakdown()
*/ */
void AgeVehicle(Vehicle *v) void AgeVehicle(Vehicle *v)
{ {
if (v->age < MAX_DATE) { if (v->age < CalendarTime::MAX_DATE) {
v->age++; v->age++;
if (v->IsPrimaryVehicle() && v->age == VEHICLE_PROFIT_MIN_AGE + 1) GroupStatistics::VehicleReachedMinAge(v); if (v->IsPrimaryVehicle() && v->age == VEHICLE_PROFIT_MIN_AGE + 1) GroupStatistics::VehicleReachedMinAge(v);
} }
@ -1378,7 +1378,7 @@ void AgeVehicle(Vehicle *v)
auto age = v->age - v->max_age; auto age = v->age - v->max_age;
for (int32_t i = 0; i <= 4; i++) { for (int32_t i = 0; i <= 4; i++) {
if (age == DateAtStartOfYear(i)) { if (age == TimerGameCalendar::DateAtStartOfYear(i)) {
v->reliability_spd_dec <<= 1; v->reliability_spd_dec <<= 1;
break; break;
} }
@ -1396,11 +1396,11 @@ void AgeVehicle(Vehicle *v)
if (EngineHasReplacementForCompany(c, v->engine_type, v->group_id)) return; if (EngineHasReplacementForCompany(c, v->engine_type, v->group_id)) return;
StringID str; StringID str;
if (age == DateAtStartOfYear(-1)) { if (age == TimerGameCalendar::DateAtStartOfYear(-1)) {
str = STR_NEWS_VEHICLE_IS_GETTING_OLD; str = STR_NEWS_VEHICLE_IS_GETTING_OLD;
} else if (age == DateAtStartOfYear(0)) { } else if (age == TimerGameCalendar::DateAtStartOfYear(0)) {
str = STR_NEWS_VEHICLE_IS_GETTING_VERY_OLD; str = STR_NEWS_VEHICLE_IS_GETTING_VERY_OLD;
} else if (age > DateAtStartOfYear(0) && (static_cast<int32_t>(age) % DAYS_IN_LEAP_YEAR) == 0) { } else if (age > TimerGameCalendar::DateAtStartOfYear(0) && (static_cast<int32_t>(age) % CalendarTime::DAYS_IN_LEAP_YEAR) == 0) {
str = STR_NEWS_VEHICLE_IS_GETTING_VERY_OLD_AND; str = STR_NEWS_VEHICLE_IS_GETTING_VERY_OLD_AND;
} else { } else {
return; return;
@ -2108,7 +2108,7 @@ void Vehicle::BeginLoading()
{ {
assert(IsTileType(this->tile, MP_STATION) || this->type == VEH_SHIP); assert(IsTileType(this->tile, MP_STATION) || this->type == VEH_SHIP);
Ticks travel_time = TimerGameTick::counter - this->last_loading_tick; TimerGameTick::Ticks travel_time = TimerGameTick::counter - this->last_loading_tick;
if (this->current_order.IsType(OT_GOTO_STATION) && if (this->current_order.IsType(OT_GOTO_STATION) &&
this->current_order.GetDestination() == this->last_station_visited) { this->current_order.GetDestination() == this->last_station_visited) {
this->DeleteUnreachedImplicitOrders(); this->DeleteUnreachedImplicitOrders();

View File

@ -11,7 +11,6 @@
#define VEHICLE_FUNC_H #define VEHICLE_FUNC_H
#include "gfx_type.h" #include "gfx_type.h"
#include "date_type.h"
#include "direction_type.h" #include "direction_type.h"
#include "command_type.h" #include "command_type.h"
#include "vehicle_type.h" #include "vehicle_type.h"
@ -25,7 +24,7 @@
#define IS_CUSTOM_FIRSTHEAD_SPRITE(x) (x == 0xFD) #define IS_CUSTOM_FIRSTHEAD_SPRITE(x) (x == 0xFD)
#define IS_CUSTOM_SECONDHEAD_SPRITE(x) (x == 0xFE) #define IS_CUSTOM_SECONDHEAD_SPRITE(x) (x == 0xFE)
static const int VEHICLE_PROFIT_MIN_AGE = DAYS_IN_YEAR * 2; ///< Only vehicles older than this have a meaningful profit. static const int VEHICLE_PROFIT_MIN_AGE = CalendarTime::DAYS_IN_YEAR * 2; ///< Only vehicles older than this have a meaningful profit.
static const Money VEHICLE_PROFIT_THRESHOLD = 10000; ///< Threshold for a vehicle to be considered making good profit. static const Money VEHICLE_PROFIT_THRESHOLD = 10000; ///< Threshold for a vehicle to be considered making good profit.
/** /**

View File

@ -1733,7 +1733,7 @@ void BaseVehicleListWindow::DrawVehicleListItems(VehicleID selected_vehicle, int
if (v->IsChainInDepot()) { if (v->IsChainInDepot()) {
tc = TC_BLUE; tc = TC_BLUE;
} else { } else {
tc = (v->age > v->max_age - DAYS_IN_LEAP_YEAR) ? TC_RED : TC_BLACK; tc = (v->age > v->max_age - CalendarTime::DAYS_IN_LEAP_YEAR) ? TC_RED : TC_BLACK;
} }
SetDParam(0, v->unitnumber); SetDParam(0, v->unitnumber);
@ -2438,7 +2438,7 @@ struct VehicleDetailsWindow : Window {
case WID_VD_SERVICING_INTERVAL: case WID_VD_SERVICING_INTERVAL:
SetDParamMaxValue(0, MAX_SERVINT_DAYS); // Roughly the maximum interval SetDParamMaxValue(0, MAX_SERVINT_DAYS); // Roughly the maximum interval
SetDParamMaxValue(1, DateAtStartOfYear(MAX_YEAR)); // Roughly the maximum year SetDParamMaxValue(1, TimerGameCalendar::DateAtStartOfYear(CalendarTime::MAX_YEAR)); // Roughly the maximum year
size->width = std::max( size->width = std::max(
GetStringBoundingBox(STR_VEHICLE_DETAILS_SERVICING_INTERVAL_PERCENT).width, GetStringBoundingBox(STR_VEHICLE_DETAILS_SERVICING_INTERVAL_PERCENT).width,
GetStringBoundingBox(STR_VEHICLE_DETAILS_SERVICING_INTERVAL_DAYS).width GetStringBoundingBox(STR_VEHICLE_DETAILS_SERVICING_INTERVAL_DAYS).width
@ -2495,9 +2495,9 @@ struct VehicleDetailsWindow : Window {
Rect tr = r.Shrink(WidgetDimensions::scaled.framerect); Rect tr = r.Shrink(WidgetDimensions::scaled.framerect);
/* Draw running cost */ /* Draw running cost */
SetDParam(1, DateToYear(v->age)); SetDParam(1, TimerGameCalendar::DateToYear(v->age));
SetDParam(0, (v->age + DAYS_IN_YEAR < v->max_age) ? STR_VEHICLE_INFO_AGE : STR_VEHICLE_INFO_AGE_RED); SetDParam(0, (v->age + CalendarTime::DAYS_IN_YEAR < v->max_age) ? STR_VEHICLE_INFO_AGE : STR_VEHICLE_INFO_AGE_RED);
SetDParam(2, DateToYear(v->max_age)); SetDParam(2, TimerGameCalendar::DateToYear(v->max_age));
SetDParam(3, v->GetDisplayRunningCost()); SetDParam(3, v->GetDisplayRunningCost());
DrawString(tr, STR_VEHICLE_INFO_AGE_RUNNING_COST_YR); DrawString(tr, STR_VEHICLE_INFO_AGE_RUNNING_COST_YR);
tr.top += FONT_HEIGHT_NORMAL; tr.top += FONT_HEIGHT_NORMAL;
@ -2809,7 +2809,7 @@ void CcStartStopVehicle(Commands cmd, const CommandCost &result, VehicleID veh_i
StringID msg = (v->vehstatus & VS_STOPPED) ? STR_VEHICLE_COMMAND_STOPPED : STR_VEHICLE_COMMAND_STARTED; StringID msg = (v->vehstatus & VS_STOPPED) ? STR_VEHICLE_COMMAND_STOPPED : STR_VEHICLE_COMMAND_STARTED;
Point pt = RemapCoords(v->x_pos, v->y_pos, v->z_pos); Point pt = RemapCoords(v->x_pos, v->y_pos, v->z_pos);
AddTextEffect(msg, pt.x, pt.y, DAY_TICKS, TE_RISING); AddTextEffect(msg, pt.x, pt.y, Ticks::DAY_TICKS, TE_RISING);
} }
/** /**