Index: src/aircraft_cmd.cpp =================================================================== --- src/aircraft_cmd.cpp (revision 10267) +++ src/aircraft_cmd.cpp (working copy) @@ -740,7 +740,7 @@ if (v->vehstatus & VS_STOPPED) return; - CommandCost cost = CommandCost(GetVehicleProperty(v, 0x0E, AircraftVehInfo(v->engine_type)->running_cost) * _price.aircraft_running / 364); + CommandCost cost = CommandCost(GetVehicleProperty(v, 0x0E, AircraftVehInfo(v->engine_type)->running_cost) * _price.aircraft_running * EconomyMultiplier() / 364); v->profit_this_year -= cost.GetCost() >> 8; Index: src/aircraft_gui.cpp =================================================================== --- src/aircraft_gui.cpp (revision 10267) +++ src/aircraft_gui.cpp (working copy) @@ -92,7 +92,7 @@ SetDParam(0, (v->age + 365 < v->max_age) ? STR_AGE : STR_AGE_RED); SetDParam(2, v->max_age / 366); - SetDParam(3, _price.aircraft_running * AircraftVehInfo(v->engine_type)->running_cost >> 8); + SetDParam(3, _price.aircraft_running * AircraftVehInfo(v->engine_type)->running_cost * EconomyMultiplier() >> 8); DrawString(2, 15, STR_A00D_AGE_RUNNING_COST_YR, 0); } Index: src/build_vehicle_gui.cpp =================================================================== --- src/build_vehicle_gui.cpp (revision 10267) +++ src/build_vehicle_gui.cpp (working copy) @@ -483,7 +483,7 @@ } /* Running cost */ - SetDParam(0, (GetEngineProperty(engine_number, 0x0D, rvi->running_cost_base) * _price.running_rail[rvi->running_cost_class] >> 8) << multihead); + SetDParam(0, (GetEngineProperty(engine_number, 0x0D, rvi->running_cost_base) * _price.running_rail[rvi->running_cost_class] * EconomyMultiplier() >> 8) << multihead); DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, 0); y += 10; @@ -510,7 +510,7 @@ y += 10; /* Running cost */ - SetDParam(0, rvi->running_cost * _price.roadveh_running >> 8); + SetDParam(0, rvi->running_cost * _price.roadveh_running * EconomyMultiplier() >> 8); DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, 0); y += 10; @@ -541,7 +541,7 @@ y += 10; /* Running cost */ - SetDParam(0, GetEngineProperty(engine_number, 0x0F, svi->running_cost) * _price.ship_running >> 8); + SetDParam(0, GetEngineProperty(engine_number, 0x0F, svi->running_cost) * _price.ship_running * EconomyMultiplier() >> 8); DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, 0); y += 10; @@ -576,7 +576,7 @@ y += 10; /* Running cost */ - SetDParam(0, GetEngineProperty(engine_number, 0x0E, avi->running_cost) * _price.aircraft_running >> 8); + SetDParam(0, GetEngineProperty(engine_number, 0x0E, avi->running_cost) * _price.aircraft_running * EconomyMultiplier() >> 8); DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, 0); y += 10; Index: src/date.cpp =================================================================== --- src/date.cpp (revision 10267) +++ src/date.cpp (working copy) @@ -214,7 +214,7 @@ uint total = GetMaxVehicleIndex() + 1; uint i; - for (i = daytick; i < total; i += DAY_TICKS) { + for (i = daytick; i < total; i += DaylengthMultiplier()) { Vehicle *v = GetVehicle(i); if (IsValidVehicle(v)) _on_new_vehicle_day_proc[v->type](v); @@ -236,7 +236,7 @@ _tick_counter++; _date_fract++; - if (_date_fract < DAY_TICKS) return; + if (_date_fract < DaylengthMultiplier()) return; _date_fract = 0; /* yeah, increase day counter and call various daily loops */ Index: src/engine_gui.cpp =================================================================== --- src/engine_gui.cpp (revision 10267) +++ src/engine_gui.cpp (working copy) @@ -125,7 +125,7 @@ SetDParam(3, rvi->power << multihead); SetDParam(1, rvi->weight << multihead); - SetDParam(4, rvi->running_cost_base * _price.running_rail[rvi->running_cost_class] >> 8 << multihead); + SetDParam(4, rvi->running_cost_base * _price.running_rail[rvi->running_cost_class] * EconomyMultiplier() >> 8 << multihead); if (rvi->capacity != 0) { SetDParam(5, rvi->cargo_type); @@ -143,7 +143,7 @@ SetDParam(1, avi->max_speed * 10 / 16); SetDParam(2, avi->passenger_capacity); SetDParam(3, avi->mail_capacity); - SetDParam(4, avi->running_cost * _price.aircraft_running >> 8); + SetDParam(4, avi->running_cost * _price.aircraft_running * EconomyMultiplier() >> 8); DrawStringMultiCenter(x, y, STR_A02E_COST_MAX_SPEED_CAPACITY, maxw); } @@ -154,7 +154,7 @@ SetDParam(0, (_price.roadveh_base >> 3) * rvi->base_cost >> 5); SetDParam(1, rvi->max_speed * 10 / 32); - SetDParam(2, rvi->running_cost * _price.roadveh_running >> 8); + SetDParam(2, rvi->running_cost * _price.roadveh_running * EconomyMultiplier() >> 8); SetDParam(3, rvi->cargo_type); SetDParam(4, rvi->capacity); @@ -168,7 +168,7 @@ SetDParam(1, svi->max_speed * 10 / 32); SetDParam(2, svi->cargo_type); SetDParam(3, svi->capacity); - SetDParam(4, svi->running_cost * _price.ship_running >> 8); + SetDParam(4, svi->running_cost * _price.ship_running * EconomyMultiplier() >> 8); DrawStringMultiCenter(x, y, STR_982E_COST_MAX_SPEED_CAPACITY, maxw); } Index: src/graph_gui.cpp =================================================================== --- src/graph_gui.cpp (revision 10267) +++ src/graph_gui.cpp (working copy) @@ -1081,7 +1081,7 @@ if (p2->is_active) UpdateCompanyRatingAndValue(p2, false); } - w->custom[0] = DAY_TICKS; + w->custom[0] = DaylengthMultiplier(); w->custom[1] = 5; if (_performance_rating_detail_player != INVALID_PLAYER) LowerWindowWidget(w, _performance_rating_detail_player + 13); @@ -1093,7 +1093,7 @@ case WE_TICK: /* Update the player score every 5 days */ if (--w->custom[0] == 0) { - w->custom[0] = DAY_TICKS; + w->custom[0] = DaylengthMultiplier(); if (--w->custom[1] == 0) { Player *p2; Index: src/lang/english.txt =================================================================== --- src/lang/english.txt (revision 10267) +++ src/lang/english.txt (working copy) @@ -1163,6 +1163,8 @@ STR_CONFIG_PATCHES_LARGER_TOWNS :{LTBLUE}Proportion of towns that will become cities: {ORANGE}1 in {STRING1} STR_CONFIG_PATCHES_LARGER_TOWNS_DISABLED :{LTBLUE}Proportion of towns that will become cities: {ORANGE}None STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER :{LTBLUE}Initial city size multiplier: {ORANGE}{STRING1} +STR_CONFIG_PATCHES_DAY_LENGTH_MULTIPLIER :{LTBLUE}Length of days (2,22 Sec * Setting): {ORANGE}{STRING1} +STR_CONFIG_PATCHES_DAY_LENGTH_CORRECTION :{LTBLUE}Length of days affects economy STR_CONFIG_PATCHES_GUI :{BLACK}Interface STR_CONFIG_PATCHES_CONSTRUCTION :{BLACK}Construction Index: src/players.cpp =================================================================== --- src/players.cpp (revision 10267) +++ src/players.cpp (working copy) @@ -504,7 +504,7 @@ void StartupPlayers() { /* The AI starts like in the setting with +2 month max */ - _next_competitor_start = _opt.diff.competitor_start_time * 90 * DAY_TICKS + RandomRange(60 * DAY_TICKS) + 1; + _next_competitor_start = _opt.diff.competitor_start_time * 90 * DaylengthMultiplier() + RandomRange(60 * DaylengthMultiplier()) + 1; } static void MaybeStartNewPlayer() @@ -530,8 +530,8 @@ } /* The next AI starts like the difficulty setting said, with +2 month max */ - _next_competitor_start = _opt.diff.competitor_start_time * 90 * DAY_TICKS + 1; - _next_competitor_start += _network_server ? InteractiveRandomRange(60 * DAY_TICKS) : RandomRange(60 * DAY_TICKS); + _next_competitor_start = _opt.diff.competitor_start_time * 90 * DaylengthMultiplier() + 1; + _next_competitor_start += _network_server ? InteractiveRandomRange(60 * DaylengthMultiplier()) : RandomRange(60 * DaylengthMultiplier()); } void InitializePlayers() Index: src/roadveh_cmd.cpp =================================================================== --- src/roadveh_cmd.cpp (revision 10267) +++ src/roadveh_cmd.cpp (working copy) @@ -1969,7 +1969,7 @@ } } - cost = RoadVehInfo(v->engine_type)->running_cost * _price.roadveh_running / 364; + cost = RoadVehInfo(v->engine_type)->running_cost * _price.roadveh_running * EconomyMultiplier() / 364; v->profit_this_year -= cost.GetCost() >> 8; Index: src/roadveh_gui.cpp =================================================================== --- src/roadveh_gui.cpp (revision 10267) +++ src/roadveh_gui.cpp (working copy) @@ -92,7 +92,7 @@ SetDParam(0, (v->age + 365 < v->max_age) ? STR_AGE : STR_AGE_RED); SetDParam(2, v->max_age / 366); - SetDParam(3, RoadVehInfo(v->engine_type)->running_cost * _price.roadveh_running >> 8); + SetDParam(3, RoadVehInfo(v->engine_type)->running_cost * _price.roadveh_running * EconomyMultiplier() >> 8); DrawString(2, 15, STR_900D_AGE_RUNNING_COST_YR, 0); } Index: src/settings.cpp =================================================================== --- src/settings.cpp (revision 10267) +++ src/settings.cpp (working copy) @@ -1429,7 +1429,8 @@ SDT_CONDVAR(Patches, town_growth_rate, SLE_UINT8, 54, SL_MAX_VERSION, 0, MS, 2, 0, 4, 0, STR_CONFIG_PATCHES_TOWN_GROWTH, NULL), SDT_CONDVAR(Patches, larger_towns, SLE_UINT8, 54, SL_MAX_VERSION, 0, D0, 4, 0, 255, 1, STR_CONFIG_PATCHES_LARGER_TOWNS, NULL), SDT_CONDVAR(Patches, initial_city_size, SLE_UINT8, 56, SL_MAX_VERSION, 0, 0, 2, 1, 10, 1, STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER, NULL), - + SDT_VAR(Patches, daylength_multiplier, SLE_UINT8, 0,NC, 1,1,30,1, STR_CONFIG_PATCHES_DAY_LENGTH_MULTIPLIER, NULL), + SDT_BOOL(Patches, daylength_correction, 0, 0, false, STR_CONFIG_PATCHES_DAY_LENGTH_CORRECTION, NULL), /***************************************************************************/ /* AI section of the GUI-configure patches window */ SDT_BOOL(Patches, ainew_active, 0, 0, false, STR_CONFIG_PATCHES_AINEW_ACTIVE, AiNew_PatchActive_Warning), Index: src/settings_gui.cpp =================================================================== --- src/settings_gui.cpp (revision 10267) +++ src/settings_gui.cpp (working copy) @@ -696,6 +696,8 @@ "town_growth_rate", "larger_towns", "initial_city_size", + "daylength_multiplier", + "daylength_correction", }; static const char *_patches_ai[] = { Index: src/ship_cmd.cpp =================================================================== --- src/ship_cmd.cpp (revision 10267) +++ src/ship_cmd.cpp (working copy) @@ -189,7 +189,7 @@ if (v->vehstatus & VS_STOPPED) return; - cost.AddCost(GetVehicleProperty(v, 0x0F, ShipVehInfo(v->engine_type)->running_cost) * _price.ship_running / 364); + cost.AddCost(GetVehicleProperty(v, 0x0F, ShipVehInfo(v->engine_type)->running_cost) * _price.ship_running * EconomyMultiplier() / 364); v->profit_this_year -= cost.GetCost() >> 8; SET_EXPENSES_TYPE(EXPENSES_SHIP_RUN); Index: src/ship_gui.cpp =================================================================== --- src/ship_gui.cpp (revision 10267) +++ src/ship_gui.cpp (working copy) @@ -50,7 +50,7 @@ SetDParam(0, (v->age + 365 < v->max_age) ? STR_AGE : STR_AGE_RED); SetDParam(2, v->max_age / 366); - SetDParam(3, ShipVehInfo(v->engine_type)->running_cost * _price.ship_running >> 8); + SetDParam(3, ShipVehInfo(v->engine_type)->running_cost * _price.ship_running * EconomyMultiplier() >> 8); DrawString(2, 15, STR_9812_AGE_RUNNING_COST_YR, 0); } Index: src/timetable_gui.cpp =================================================================== --- src/timetable_gui.cpp (revision 10267) +++ src/timetable_gui.cpp (working copy) @@ -40,7 +40,7 @@ SetDParam(param2, time); } else { SetDParam(param1, STR_TIMETABLE_DAYS); - SetDParam(param2, time / DAY_TICKS); + SetDParam(param2, time / DaylengthMultiplier()); } } @@ -172,7 +172,7 @@ y = w->widget[5].top + 1; - if (v->lateness_counter == 0 || (!_patches.timetable_in_ticks && v->lateness_counter / DAY_TICKS == 0)) { + if (v->lateness_counter == 0 || (!_patches.timetable_in_ticks && v->lateness_counter / DaylengthMultiplier() == 0)) { DrawString(2, y, STR_TIMETABLE_STATUS_ON_TIME, 0x10); } else { SetTimetableParams(0, 1, abs(v->lateness_counter)); @@ -224,7 +224,7 @@ if (order != NULL) { uint time = (selected % 2 == 1) ? order->travel_time : order->wait_time; - if (!_patches.timetable_in_ticks) time /= DAY_TICKS; + if (!_patches.timetable_in_ticks) time /= DaylengthMultiplier(); if (time != 0) { SetDParam(0, time); @@ -254,7 +254,7 @@ uint32 p1 = PackTimetableArgs(v, WP(w,order_d).sel); uint64 time = StrEmpty(we->we.edittext.str) ? 0 : strtoul(we->we.edittext.str, NULL, 10); - if (!_patches.timetable_in_ticks) time *= DAY_TICKS; + if (!_patches.timetable_in_ticks) time *= DaylengthMultiplier(); uint32 p2 = minu(time, MAX_UVALUE(uint16)); Index: src/train_cmd.cpp =================================================================== --- src/train_cmd.cpp (revision 10267) +++ src/train_cmd.cpp (working copy) @@ -2864,12 +2864,12 @@ v->cur_speed = 0; v->subspeed = 0; v->progress = 255 - 100; - if (++v->load_unload_time_rem < _patches.wait_oneway_signal * 20) return; + if (++v->load_unload_time_rem < _patches.wait_oneway_signal * 20 * _patches.daylength_multiplier) return; } else if (HasSignalOnTrackdir(gp.new_tile, i)) { v->cur_speed = 0; v->subspeed = 0; v->progress = 255 - 10; - if (++v->load_unload_time_rem < _patches.wait_twoway_signal * 73) { + if (++v->load_unload_time_rem < _patches.wait_twoway_signal * 73 * _patches.daylength_multiplier) { TileIndex o_tile = gp.new_tile + TileOffsByDiagDir(enterdir); VehicleAtSignalData vasd; vasd.tile = o_tile; Index: src/train_gui.cpp =================================================================== --- src/train_gui.cpp (revision 10267) +++ src/train_gui.cpp (working copy) @@ -422,7 +422,7 @@ SetDParam(0, (v->age + 365 < v->max_age) ? STR_AGE : STR_AGE_RED); SetDParam(2, v->max_age / 366); - SetDParam(3, GetTrainRunningCost(v) >> 8); + SetDParam(3, GetTrainRunningCost(v) * EconomyMultiplier() >> 8); DrawString(x, 15, STR_885D_AGE_RUNNING_COST_YR, 0); SetDParam(2, v->u.rail.cached_max_speed * 10 / 16); Index: src/variables.h =================================================================== --- src/variables.h (revision 10267) +++ src/variables.h (working copy) @@ -13,6 +13,7 @@ #endif #include "gfx.h" +#include "date.h" /* Prices and also the fractional part. */ VARDEF Prices _price; @@ -239,6 +240,9 @@ bool timetabling; ///< Whether to allow timetabling. bool timetable_in_ticks; ///< Whether to show the timetable in ticks rather than days. + + byte daylength_multiplier; ///< Allows to set the daylength + bool daylength_correction; ///< Economy changes according to the daylength set }; VARDEF Patches _patches; @@ -397,4 +401,8 @@ /* Forking stuff */ VARDEF bool _dedicated_forks; +/* Economy calculations for different daylengths */ +inline uint8 DaylengthMultiplier() { return DAY_TICKS * _patches.daylength_multiplier; } +inline uint8 EconomyMultiplier() { return _patches.daylength_correction ? _patches.daylength_multiplier : 1; } + #endif /* VARIABLES_H */