Index: src/date_type.h =================================================================== --- src/date_type.h (revision 16096) +++ src/date_type.h (working copy) @@ -11,12 +11,15 @@ * 1 tick is approximately 30 ms. * 1 day is thus about 2 seconds (74 * 30 = 2220) on a machine that can run OpenTTD normally */ -enum { - DAY_TICKS = 74, ///< ticks per day - DAYS_IN_YEAR = 365, ///< days per year - DAYS_IN_LEAP_YEAR = 366, ///< sometimes, you need one day more... -}; +#define DAY_TICKS (74 * _settings_game.economy.daylength) +///< ticks per day +#define DAYS_IN_YEAR 365 +///< days per year +#define DAYS_IN_LEAP_YEAR 366 +///< sometimes, you need one day more... + + /* * ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR and DAYS_TILL_ORIGINAL_BASE_YEAR are * primarily used for loading newgrf and savegame data and returning some Index: src/lang/english.txt =================================================================== --- src/lang/english.txt (revision 16096) +++ src/lang/english.txt (working copy) @@ -3602,6 +3602,10 @@ STR_STATION_NOISE :{BLACK}Noise generated: {GOLD}{COMMA} ######## +############ daylength advanced setting +STR_CONFIG_PATCHES_DAYLENGTH :{LTBLUE}Daylength factor: {ORANGE}{STRING} * 2,22 seconds at normal game speed +######## + ############ Downloading of content from the central server STR_CONTENT_NO_ZLIB :{WHITE}OpenTTD is build without "zlib" support... STR_CONTENT_NO_ZLIB_SUB :{WHITE}... downloading content is not possible! Index: src/settings_gui.cpp =================================================================== --- src/settings_gui.cpp (revision 16096) +++ src/settings_gui.cpp (working copy) @@ -1220,6 +1220,7 @@ SettingEntry(&_settings_economy_industries_page, STR_CONFIG_SETTING_ECONOMY_INDUSTRIES), SettingEntry("economy.inflation"), SettingEntry("economy.smooth_economy"), + SettingEntry("economy.daylength"), }; /** Economy sub-page */ static SettingsPage _settings_economy_page = {_settings_economy, lengthof(_settings_economy)}; Index: src/table/settings.h =================================================================== --- src/table/settings.h (revision 16096) +++ src/table/settings.h (working copy) @@ -425,6 +425,7 @@ SDT_CONDVAR(GameSettings, economy.larger_towns, SLE_UINT8, 54, SL_MAX_VERSION, 0, D0, 4, 0, 255, 1, STR_CONFIG_SETTING_LARGER_TOWNS, NULL), SDT_CONDVAR(GameSettings, economy.initial_city_size, SLE_UINT8, 56, SL_MAX_VERSION, 0, 0, 2, 1, 10, 1, STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER, NULL), SDT_CONDBOOL(GameSettings, economy.mod_road_rebuild, 77, SL_MAX_VERSION, 0, 0, false, STR_CONFIG_SETTING_MODIFIED_ROAD_REBUILD, NULL), + SDT_CONDVAR(GameSettings, economy.daylength, SLE_UINT8,104, SL_MAX_VERSION, 0, 0, 1, 1, 31, 1, STR_CONFIG_PATCHES_DAYLENGTH, NULL), SDT_CONDNULL(1, 0, 106), // previously ai-new setting. SDT_BOOL(GameSettings, ai.ai_in_multiplayer, 0, 0, true, STR_CONFIG_SETTING_AI_IN_MULTIPLAYER, NULL), Index: src/ship_cmd.cpp =================================================================== --- src/ship_cmd.cpp (revision 16096) +++ src/ship_cmd.cpp (working copy) @@ -150,7 +150,7 @@ Money Ship::GetRunningCost() const { - return GetVehicleProperty(this, 0x0F, ShipVehInfo(this->engine_type)->running_cost) * _price.ship_running; + return GetVehicleProperty(this, 0x0F, ShipVehInfo(this->engine_type)->running_cost) * _settings_game.economy.daylength * _price.ship_running; } void Ship::OnNewDay() Index: src/roadveh.h =================================================================== --- src/roadveh.h (revision 16096) +++ src/roadveh.h (working copy) @@ -9,6 +9,7 @@ #include "engine_func.h" #include "engine_base.h" #include "economy_func.h" +#include "settings_type.h" /** State information about the Road Vehicle controller */ enum { @@ -96,7 +97,7 @@ SpriteID GetImage(Direction direction) const; int GetDisplaySpeed() const { return this->cur_speed / 2; } int GetDisplayMaxSpeed() const { return this->max_speed / 2; } - Money GetRunningCost() const { return RoadVehInfo(this->engine_type)->running_cost * GetPriceByIndex(RoadVehInfo(this->engine_type)->running_cost_class); } + Money GetRunningCost() const { return RoadVehInfo(this->engine_type)->running_cost * _settings_game.economy.daylength * GetPriceByIndex(RoadVehInfo(this->engine_type)->running_cost_class); } bool IsInDepot() const { return this->u.road.state == RVSB_IN_DEPOT; } bool IsStoppedInDepot() const; void Tick(); Index: src/train_cmd.cpp =================================================================== --- src/train_cmd.cpp (revision 16096) +++ src/train_cmd.cpp (working copy) @@ -4424,7 +4424,7 @@ /* Halve running cost for multiheaded parts */ if (IsMultiheaded(v)) cost_factor /= 2; - cost += cost_factor * GetPriceByIndex(rvi->running_cost_class); + cost += cost_factor * _settings_game.economy.daylength * GetPriceByIndex(rvi->running_cost_class); } while ((v = GetNextVehicle(v)) != NULL); return cost; Index: src/settings_type.h =================================================================== --- src/settings_type.h (revision 16096) +++ src/settings_type.h (working copy) @@ -326,6 +326,7 @@ bool allow_town_roads; ///< towns are allowed to build roads (always allowed when generating world / in SE) bool station_noise_level; ///< build new airports when the town noise level is still within accepted limits uint16 town_noise_population[3]; ///< population to base decision on noise evaluation (@see town_council_tolerance) + byte daylength; ///< factor by which the daylength is multiplied (74 default ticks * setting) }; /** Settings related to stations. */ Index: src/sortlist_type.h =================================================================== --- src/sortlist_type.h (revision 16096) +++ src/sortlist_type.h (working copy) @@ -11,6 +11,7 @@ #include "core/sort_func.hpp" #include "core/smallvec_type.hpp" #include "date_type.h" +#include "settings_type.h" enum SortListFlags { VL_NONE = 0, ///< no sort Index: src/engine.cpp =================================================================== --- src/engine.cpp (revision 16096) +++ src/engine.cpp (working copy) @@ -211,16 +211,16 @@ { switch (this->type) { case VEH_ROAD: - return this->u.road.running_cost * GetPriceByIndex(this->u.road.running_cost_class) >> 8; + return this->u.road.running_cost * GetPriceByIndex(this->u.road.running_cost_class) * _settings_game.economy.daylength >> 8; case VEH_TRAIN: - return GetEngineProperty(this->index, 0x0D, this->u.rail.running_cost) * GetPriceByIndex(this->u.rail.running_cost_class) >> 8; + return GetEngineProperty(this->index, 0x0D, this->u.rail.running_cost) * GetPriceByIndex(this->u.rail.running_cost_class) * _settings_game.economy.daylength >> 8; case VEH_SHIP: - return GetEngineProperty(this->index, 0x0F, this->u.ship.running_cost) * _price.ship_running >> 8; + return GetEngineProperty(this->index, 0x0F, this->u.ship.running_cost) * _settings_game.economy.daylength * _price.ship_running >> 8; case VEH_AIRCRAFT: - return GetEngineProperty(this->index, 0x0E, this->u.air.running_cost) * _price.aircraft_running >> 8; + return GetEngineProperty(this->index, 0x0E, this->u.air.running_cost) * _settings_game.economy.daylength * _price.aircraft_running >> 8; default: NOT_REACHED(); } Index: src/vehicle_base.h =================================================================== --- src/vehicle_base.h (revision 16096) +++ src/vehicle_base.h (working copy) @@ -24,6 +24,7 @@ #include "engine_type.h" #include "order_func.h" #include "transport_type.h" +#include "settings_type.h" /** Road vehicle states */ enum RoadVehicleStates { Index: src/aircraft_cmd.cpp =================================================================== --- src/aircraft_cmd.cpp (revision 16096) +++ src/aircraft_cmd.cpp (working copy) @@ -612,7 +612,7 @@ Money Aircraft::GetRunningCost() const { - return GetVehicleProperty(this, 0x0E, AircraftVehInfo(this->engine_type)->running_cost) * _price.aircraft_running; + return GetVehicleProperty(this, 0x0E, AircraftVehInfo(this->engine_type)->running_cost) * _settings_game.economy.daylength * _price.aircraft_running; } void Aircraft::OnNewDay()