Merge branch 'master' into jgrpp
# Conflicts: # src/date_type.h # src/linkgraph/linkgraphjob.cpp # src/linkgraph/linkgraphschedule.cpp # src/saveload/saveload.h # src/table/settings/linkgraph_settings.ini
This commit is contained in:
@@ -32,6 +32,8 @@ 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 DAYS_IN_LEAP_YEAR = 366; ///< sometimes, you need one day more...
|
||||||
static const int MONTHS_IN_YEAR = 12; ///< months per year
|
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
|
||||||
|
|
||||||
#define DATE_UNIT_SIZE (_settings_time.time_in_minutes ? _settings_time.ticks_per_minute : (DAY_TICKS * _settings_game.economy.day_length_factor))
|
#define DATE_UNIT_SIZE (_settings_time.time_in_minutes ? _settings_time.ticks_per_minute : (DAY_TICKS * _settings_game.economy.day_length_factor))
|
||||||
|
|
||||||
static const int STATION_RATING_TICKS = 185; ///< cycle duration for updating station rating
|
static const int STATION_RATING_TICKS = 185; ///< cycle duration for updating station rating
|
||||||
|
@@ -1926,10 +1926,10 @@ STR_CONFIG_SETTING_LARGER_TOWNS_DISABLED :None
|
|||||||
STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER :Initial city size multiplier: {STRING2}
|
STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER :Initial city size multiplier: {STRING2}
|
||||||
STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER_HELPTEXT :Average size of cities relative to normal towns at start of the game
|
STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER_HELPTEXT :Average size of cities relative to normal towns at start of the game
|
||||||
|
|
||||||
STR_CONFIG_SETTING_LINKGRAPH_INTERVAL :Update distribution graph every {STRING2}{NBSP}day{P 0:2 "" s}
|
STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL :Update distribution graph every {STRING2}{NBSP}second{P 0:2 "" s}
|
||||||
STR_CONFIG_SETTING_LINKGRAPH_INTERVAL_HELPTEXT :Time between subsequent recalculations of the link graph. Each recalculation calculates the plans for one component of the graph. That means that a value X for this setting does not mean the whole graph will be updated every X days. Only some component will. The shorter you set it the more CPU time will be necessary to calculate it. The longer you set it the longer it will take until the cargo distribution starts on new routes.
|
STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL_HELPTEXT :Time between subsequent recalculations of the link graph. Each recalculation calculates the plans for one component of the graph. That means that a value X for this setting does not mean the whole graph will be updated every X seconds. Only some component will. The shorter you set it the more CPU time will be necessary to calculate it. The longer you set it the longer it will take until the cargo distribution starts on new routes.
|
||||||
STR_CONFIG_SETTING_LINKGRAPH_TIME :Take {STRING2}{NBSP}day{P 0:2 "" s} for recalculation of distribution graph
|
STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME :Take {STRING2}{NBSP}second{P 0:2 "" s} for recalculation of distribution graph
|
||||||
STR_CONFIG_SETTING_LINKGRAPH_TIME_HELPTEXT :Time taken for each recalculation of a link graph component. When a recalculation is started, a thread is spawned which is allowed to run for this number of days. The shorter you set this the more likely it is that the thread is not finished when it's supposed to. Then the game stops until it is ("lag"). The longer you set it the longer it takes for the distribution to be updated when routes change.
|
STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME_HELPTEXT :Time taken for each recalculation of a link graph component. When a recalculation is started, a thread is spawned which is allowed to run for this number of seconds. The shorter you set this the more likely it is that the thread is not finished when it's supposed to. Then the game stops until it is ("lag"). The longer you set it the longer it takes for the distribution to be updated when routes change.
|
||||||
|
|
||||||
STR_CONFIG_SETTING_DISTRIBUTION_PAX :Distribution mode for passengers: {STRING2}
|
STR_CONFIG_SETTING_DISTRIBUTION_PAX :Distribution mode for passengers: {STRING2}
|
||||||
STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT :"Symmetric" means that roughly the same number of passengers will go from a station A to a station B as from B to A. "Asymmetric" means that arbitrary numbers of passengers can go in either direction. "Manual" means that no automatic distribution will take place for passengers.
|
STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT :"Symmetric" means that roughly the same number of passengers will go from a station A to a station B as from B to A. "Asymmetric" means that arbitrary numbers of passengers can go in either direction. "Manual" means that no automatic distribution will take place for passengers.
|
||||||
|
@@ -28,7 +28,7 @@ INSTANTIATE_POOL_METHODS(LinkGraphJob)
|
|||||||
|
|
||||||
static DateTicks GetLinkGraphJobJoinDateTicks(uint duration_multiplier)
|
static DateTicks GetLinkGraphJobJoinDateTicks(uint duration_multiplier)
|
||||||
{
|
{
|
||||||
DateTicks ticks = (_settings_game.linkgraph.recalc_time * DAY_TICKS * duration_multiplier) / _settings_game.economy.day_length_factor;
|
DateTicks ticks = (_settings_game.linkgraph.recalc_time * DAY_TICKS * duration_multiplier) / (SECONDS_PER_DAY * _settings_game.economy.day_length_factor);
|
||||||
return ticks + (_date * DAY_TICKS) + _date_fract;
|
return ticks + (_date * DAY_TICKS) + _date_fract;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -321,10 +321,10 @@ void StateGameLoop_LinkGraphPauseControl()
|
|||||||
} else if (_pause_mode == PM_UNPAUSED && _tick_skip_counter == 0) {
|
} else if (_pause_mode == PM_UNPAUSED && _tick_skip_counter == 0) {
|
||||||
if (_settings_game.economy.day_length_factor == 1) {
|
if (_settings_game.economy.day_length_factor == 1) {
|
||||||
if (_date_fract != LinkGraphSchedule::SPAWN_JOIN_TICK - 2) return;
|
if (_date_fract != LinkGraphSchedule::SPAWN_JOIN_TICK - 2) return;
|
||||||
if (_date % _settings_game.linkgraph.recalc_interval != _settings_game.linkgraph.recalc_interval / 2) return;
|
if (_date % _settings_game.linkgraph.recalc_interval != (_settings_game.linkgraph.recalc_interval / SECONDS_PER_DAY) / 2) return;
|
||||||
} else {
|
} else {
|
||||||
int date_ticks = ((_date * DAY_TICKS) + _date_fract - (LinkGraphSchedule::SPAWN_JOIN_TICK - 2));
|
int date_ticks = ((_date * DAY_TICKS) + _date_fract - (LinkGraphSchedule::SPAWN_JOIN_TICK - 2));
|
||||||
int interval = std::max<int>(2, (_settings_game.linkgraph.recalc_interval * DAY_TICKS / _settings_game.economy.day_length_factor));
|
int interval = std::max<int>(2, (_settings_game.linkgraph.recalc_interval * DAY_TICKS / (SECONDS_PER_DAY * _settings_game.economy.day_length_factor)));
|
||||||
if (date_ticks % interval != interval / 2) return;
|
if (date_ticks % interval != interval / 2) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,10 +357,10 @@ void OnTick_LinkGraph()
|
|||||||
int interval;
|
int interval;
|
||||||
if (_settings_game.economy.day_length_factor == 1) {
|
if (_settings_game.economy.day_length_factor == 1) {
|
||||||
if (_date_fract != LinkGraphSchedule::SPAWN_JOIN_TICK) return;
|
if (_date_fract != LinkGraphSchedule::SPAWN_JOIN_TICK) return;
|
||||||
interval = _settings_game.linkgraph.recalc_interval;
|
interval = _settings_game.linkgraph.recalc_interval / SECONDS_PER_DAY;
|
||||||
offset = _date % interval;
|
offset = _date % interval;
|
||||||
} else {
|
} else {
|
||||||
interval = std::max<int>(2, (_settings_game.linkgraph.recalc_interval * DAY_TICKS / _settings_game.economy.day_length_factor));
|
interval = std::max<int>(2, (_settings_game.linkgraph.recalc_interval * DAY_TICKS / (SECONDS_PER_DAY * _settings_game.economy.day_length_factor)));
|
||||||
offset = ((_date * DAY_TICKS) + _date_fract - LinkGraphSchedule::SPAWN_JOIN_TICK) % interval;
|
offset = ((_date * DAY_TICKS) + _date_fract - LinkGraphSchedule::SPAWN_JOIN_TICK) % interval;
|
||||||
}
|
}
|
||||||
if (offset == 0) {
|
if (offset == 0) {
|
||||||
|
@@ -904,6 +904,12 @@ bool AfterLoadGame()
|
|||||||
_settings_game.game_creation.ending_year = DEF_END_YEAR;
|
_settings_game.game_creation.ending_year = DEF_END_YEAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Convert linkgraph update settings from days to seconds. */
|
||||||
|
if (IsSavegameVersionBefore(SLV_LINKGRAPH_SECONDS) && SlXvIsFeatureMissing(XSLFI_LINKGRAPH_DAY_SCALE, 3)) {
|
||||||
|
_settings_game.linkgraph.recalc_interval *= SECONDS_PER_DAY;
|
||||||
|
_settings_game.linkgraph.recalc_time *= SECONDS_PER_DAY;
|
||||||
|
}
|
||||||
|
|
||||||
/* Load the sprites */
|
/* Load the sprites */
|
||||||
GfxLoadSprites();
|
GfxLoadSprites();
|
||||||
LoadStringWidthTable();
|
LoadStringWidthTable();
|
||||||
|
@@ -107,7 +107,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
|
|||||||
{ XSLFI_EXTRA_LARGE_MAP, XSCF_NULL, 0, 1, "extra_large_map", nullptr, nullptr, nullptr },
|
{ XSLFI_EXTRA_LARGE_MAP, XSCF_NULL, 0, 1, "extra_large_map", nullptr, nullptr, nullptr },
|
||||||
{ XSLFI_REVERSE_AT_WAYPOINT, XSCF_NULL, 1, 1, "reverse_at_waypoint", nullptr, nullptr, nullptr },
|
{ XSLFI_REVERSE_AT_WAYPOINT, XSCF_NULL, 1, 1, "reverse_at_waypoint", nullptr, nullptr, nullptr },
|
||||||
{ XSLFI_VEH_LIFETIME_PROFIT, XSCF_NULL, 1, 1, "veh_lifetime_profit", nullptr, nullptr, nullptr },
|
{ XSLFI_VEH_LIFETIME_PROFIT, XSCF_NULL, 1, 1, "veh_lifetime_profit", nullptr, nullptr, nullptr },
|
||||||
{ XSLFI_LINKGRAPH_DAY_SCALE, XSCF_NULL, 2, 2, "linkgraph_day_scale", nullptr, nullptr, nullptr },
|
{ XSLFI_LINKGRAPH_DAY_SCALE, XSCF_NULL, 3, 3, "linkgraph_day_scale", nullptr, nullptr, nullptr },
|
||||||
{ XSLFI_TEMPLATE_REPLACEMENT, XSCF_NULL, 9, 9, "template_replacement", nullptr, nullptr, "TRPL,TMPL" },
|
{ XSLFI_TEMPLATE_REPLACEMENT, XSCF_NULL, 9, 9, "template_replacement", nullptr, nullptr, "TRPL,TMPL" },
|
||||||
{ XSLFI_MORE_RAIL_TYPES, XSCF_NULL, 0, 1, "more_rail_types", nullptr, nullptr, nullptr },
|
{ XSLFI_MORE_RAIL_TYPES, XSCF_NULL, 0, 1, "more_rail_types", nullptr, nullptr, nullptr },
|
||||||
{ XSLFI_CARGO_TYPE_ORDERS, XSCF_NULL, 3, 3, "cargo_type_orders", nullptr, nullptr, "ORDX,VEOX" },
|
{ XSLFI_CARGO_TYPE_ORDERS, XSCF_NULL, 3, 3, "cargo_type_orders", nullptr, nullptr, "ORDX,VEOX" },
|
||||||
|
@@ -359,6 +359,7 @@ enum SaveLoadVersion : uint16 {
|
|||||||
SLV_VELOCITY_NAUTICAL, ///< 305 PR#10594 Separation of land and nautical velocity (knots!)
|
SLV_VELOCITY_NAUTICAL, ///< 305 PR#10594 Separation of land and nautical velocity (knots!)
|
||||||
SLV_CONSISTENT_PARTIAL_Z, ///< 306 PR#10570 Conversion from an inconsistent partial Z calculation for slopes, to one that is (more) consistent.
|
SLV_CONSISTENT_PARTIAL_Z, ///< 306 PR#10570 Conversion from an inconsistent partial Z calculation for slopes, to one that is (more) consistent.
|
||||||
SLV_MORE_CARGO_AGE, ///< 307 PR#10596 Track cargo age for a longer period.
|
SLV_MORE_CARGO_AGE, ///< 307 PR#10596 Track cargo age for a longer period.
|
||||||
|
SLV_LINKGRAPH_SECONDS, ///< 308 PR#10610 Store linkgraph update intervals in seconds instead of days.
|
||||||
|
|
||||||
SL_MAX_VERSION, ///< Highest possible saveload version
|
SL_MAX_VERSION, ///< Highest possible saveload version
|
||||||
|
|
||||||
|
@@ -178,6 +178,7 @@ enum IniFileVersion : uint32 {
|
|||||||
IFV_0, ///< 0 All versions prior to introduction.
|
IFV_0, ///< 0 All versions prior to introduction.
|
||||||
IFV_PRIVATE_SECRETS, ///< 1 PR#9298 Moving of settings from openttd.cfg to private.cfg / secrets.cfg.
|
IFV_PRIVATE_SECRETS, ///< 1 PR#9298 Moving of settings from openttd.cfg to private.cfg / secrets.cfg.
|
||||||
IFV_GAME_TYPE, ///< 2 PR#9515 Convert server_advertise to server_game_type.
|
IFV_GAME_TYPE, ///< 2 PR#9515 Convert server_advertise to server_game_type.
|
||||||
|
IFV_LINKGRAPH_SECONDS, ///< 3 PR#10610 Store linkgraph update intervals in seconds instead of days.
|
||||||
|
|
||||||
IFV_MAX_VERSION, ///< Highest possible ini-file version.
|
IFV_MAX_VERSION, ///< Highest possible ini-file version.
|
||||||
};
|
};
|
||||||
@@ -2322,6 +2323,11 @@ void LoadFromConfig(bool startup)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (generic_version < IFV_LINKGRAPH_SECONDS) {
|
||||||
|
_settings_newgame.linkgraph.recalc_interval *= SECONDS_PER_DAY;
|
||||||
|
_settings_newgame.linkgraph.recalc_time *= SECONDS_PER_DAY;
|
||||||
|
}
|
||||||
|
|
||||||
_grfconfig_newgame = GRFLoadConfig(generic_ini, "newgrf", false);
|
_grfconfig_newgame = GRFLoadConfig(generic_ini, "newgrf", false);
|
||||||
_grfconfig_static = GRFLoadConfig(generic_ini, "newgrf-static", true);
|
_grfconfig_static = GRFLoadConfig(generic_ini, "newgrf-static", true);
|
||||||
AILoadConfig(generic_ini, "ai_players");
|
AILoadConfig(generic_ini, "ai_players");
|
||||||
|
@@ -1078,25 +1078,25 @@ patxname = ""max_town_heightlevel.economy.min_city_land_area""
|
|||||||
var = linkgraph.recalc_interval
|
var = linkgraph.recalc_interval
|
||||||
type = SLE_UINT16
|
type = SLE_UINT16
|
||||||
from = SLV_183
|
from = SLV_183
|
||||||
def = 4
|
def = 8
|
||||||
min = 2
|
min = 4
|
||||||
max = 32
|
max = 90
|
||||||
interval = 2
|
interval = 1
|
||||||
str = STR_CONFIG_SETTING_LINKGRAPH_INTERVAL
|
str = STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL
|
||||||
strval = STR_JUST_COMMA
|
strval = STR_JUST_COMMA
|
||||||
strhelp = STR_CONFIG_SETTING_LINKGRAPH_INTERVAL_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL_HELPTEXT
|
||||||
|
|
||||||
[SDT_VAR]
|
[SDT_VAR]
|
||||||
var = linkgraph.recalc_time
|
var = linkgraph.recalc_time
|
||||||
type = SLE_UINT16
|
type = SLE_UINT16
|
||||||
from = SLV_183
|
from = SLV_183
|
||||||
def = 16
|
def = 32
|
||||||
min = 1
|
min = 1
|
||||||
max = 4096
|
max = 9000
|
||||||
interval = 1
|
interval = 1
|
||||||
str = STR_CONFIG_SETTING_LINKGRAPH_TIME
|
str = STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME
|
||||||
strval = STR_JUST_COMMA
|
strval = STR_JUST_COMMA
|
||||||
strhelp = STR_CONFIG_SETTING_LINKGRAPH_TIME_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME_HELPTEXT
|
||||||
|
|
||||||
[SDT_NAMED_NULL]
|
[SDT_NAMED_NULL]
|
||||||
name = ""linkgraph.recalc_not_scaled_by_daylength""
|
name = ""linkgraph.recalc_not_scaled_by_daylength""
|
||||||
|
Reference in New Issue
Block a user