Index: src/aircraft_cmd.cpp =================================================================== --- src/aircraft_cmd.cpp (revision 10499) +++ 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 10499) +++ src/aircraft_gui.cpp (working copy) @@ -91,7 +91,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 10499) +++ src/build_vehicle_gui.cpp (working copy) @@ -485,7 +485,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; @@ -512,7 +512,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; @@ -543,7 +543,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; @@ -578,7 +578,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 10499) +++ src/date.cpp (working copy) @@ -217,7 +217,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); @@ -239,7 +239,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 10499) +++ src/engine_gui.cpp (working copy) @@ -126,7 +126,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); @@ -144,7 +144,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); } @@ -155,7 +155,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); @@ -169,7 +169,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 10499) +++ src/graph_gui.cpp (working copy) @@ -1079,7 +1079,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); @@ -1091,7 +1091,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 10499) +++ src/lang/english.txt (working copy) @@ -1175,6 +1175,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/network/network.h =================================================================== --- src/network/network.h (revision 10499) +++ src/network/network.h (working copy) @@ -3,7 +3,7 @@ #ifndef NETWORK_H #define NETWORK_H -#define NOREV_STRING "norev000" +#define NOREV_STRING "r10499-daypatch" #ifdef ENABLE_NETWORK Index: src/players.cpp =================================================================== --- src/players.cpp (revision 10499) +++ 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 10499) +++ 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 10499) +++ src/roadveh_gui.cpp (working copy) @@ -91,7 +91,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/saveload.cpp =================================================================== --- src/saveload.cpp (revision 10499) +++ src/saveload.cpp (working copy) @@ -30,7 +30,8 @@ #include #include -extern const uint16 SAVEGAME_VERSION = 69; +extern const uint16 SAVEGAME_VERSION = 70; + uint16 _sl_version; ///< the major savegame version identifier byte _sl_minor_version; ///< the minor savegame version, DO NOT USE! Index: src/settings.cpp =================================================================== --- src/settings.cpp (revision 10499) +++ src/settings.cpp (working copy) @@ -1431,7 +1431,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_CONDVAR(Patches, daylength_multiplier, SLE_UINT8, 70, SL_MAX_VERSION, 0,NC, 1,1,30,1, STR_CONFIG_PATCHES_DAY_LENGTH_MULTIPLIER, NULL), + SDT_CONDBOOL(Patches, daylength_correction, 70, SL_MAX_VERSION, 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 10499) +++ src/settings_gui.cpp (working copy) @@ -698,6 +698,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 10499) +++ 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 10499) +++ src/ship_gui.cpp (working copy) @@ -49,7 +49,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 10499) +++ 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()); } } @@ -192,7 +192,7 @@ } y += 10; - 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)); @@ -244,7 +244,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); @@ -278,7 +278,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_gui.cpp =================================================================== --- src/train_gui.cpp (revision 10499) +++ src/train_gui.cpp (working copy) @@ -421,7 +421,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 10499) +++ 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; @@ -241,6 +242,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; @@ -400,4 +404,8 @@ /* Forking stuff */ VARDEF bool _dedicated_forks; +/* Economy calculations for different daylengths */ +inline uint16 DaylengthMultiplier() { return DAY_TICKS * _patches.daylength_multiplier; } +inline uint16 EconomyMultiplier() { return _patches.daylength_correction ? _patches.daylength_multiplier : 1; } + #endif /* VARIABLES_H */