; 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/>.
;

; Economy settings as stored in the main configuration file ("openttd.cfg")
; and in the savegame PATS chunk.

[pre-amble]
static void TownFoundingChanged(int32 new_value);

static const SettingVariant _economy_settings_table[] = {
[post-amble]
};
[templates]
SDT_BOOL   =   SDT_BOOL(GameSettings, $var,        $flags, $def,                              $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to,        $cat, $extra, $startup),
SDT_VAR    =    SDT_VAR(GameSettings, $var, $type, $flags, $def,       $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to,        $cat, $extra, $startup),

[validation]
SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for GameSettings.$var exceeds storage size");

[defaults]
flags    = SF_NONE
interval = 0
str      = STR_NULL
strhelp  = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
strval   = STR_NULL
pre_cb   = nullptr
post_cb  = nullptr
load     = nullptr
from     = SL_MIN_VERSION
to       = SL_MAX_VERSION
cat      = SC_ADVANCED
extra    = 0
startup  = false


[SDT_VAR]
var      = economy.town_layout
type     = SLE_UINT8
from     = SLV_59
flags    = SF_GUI_DROPDOWN
def      = TL_ORIGINAL
min      = TL_BEGIN
max      = NUM_TLS - 1
interval = 1
str      = STR_CONFIG_SETTING_TOWN_LAYOUT
strhelp  = STR_CONFIG_SETTING_TOWN_LAYOUT_HELPTEXT
strval   = STR_CONFIG_SETTING_TOWN_LAYOUT_DEFAULT
post_cb  = TownFoundingChanged

[SDT_BOOL]
var      = economy.allow_town_roads
from     = SLV_113
flags    = SF_NO_NETWORK
def      = true
str      = STR_CONFIG_SETTING_ALLOW_TOWN_ROADS
strhelp  = STR_CONFIG_SETTING_ALLOW_TOWN_ROADS_HELPTEXT

[SDT_VAR]
var      = economy.found_town
type     = SLE_UINT8
from     = SLV_128
flags    = SF_GUI_DROPDOWN
def      = TF_FORBIDDEN
min      = TF_BEGIN
max      = TF_END - 1
interval = 1
str      = STR_CONFIG_SETTING_TOWN_FOUNDING
strhelp  = STR_CONFIG_SETTING_TOWN_FOUNDING_HELPTEXT
strval   = STR_CONFIG_SETTING_TOWN_FOUNDING_FORBIDDEN
post_cb  = TownFoundingChanged
cat      = SC_BASIC

[SDT_BOOL]
var      = economy.allow_town_level_crossings
from     = SLV_143
flags    = SF_NO_NETWORK
def      = true
str      = STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS
strhelp  = STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS_HELPTEXT

[SDT_VAR]
var      = economy.town_cargogen_mode
type     = SLE_UINT8
from     = SLV_TOWN_CARGOGEN
flags    = SF_GUI_DROPDOWN
def      = TCGM_BITCOUNT
min      = TCGM_BEGIN
max      = TCGM_END - 1
interval = 1
str      = STR_CONFIG_SETTING_TOWN_CARGOGENMODE
strhelp  = STR_CONFIG_SETTING_TOWN_CARGOGENMODE_HELPTEXT
strval   = STR_CONFIG_SETTING_TOWN_CARGOGENMODE_ORIGINAL
cat      = SC_ADVANCED

[SDT_BOOL]
var      = economy.station_noise_level
from     = SLV_96
flags    = SF_NO_NETWORK
def      = false
str      = STR_CONFIG_SETTING_NOISE_LEVEL
strhelp  = STR_CONFIG_SETTING_NOISE_LEVEL_HELPTEXT
post_cb  = [](auto new_value) { InvalidateWindowClassesData(WC_TOWN_VIEW, new_value); }

[SDT_BOOL]
var      = economy.inflation
flags    = SF_NO_NETWORK
def      = false
str      = STR_CONFIG_SETTING_INFLATION
strhelp  = STR_CONFIG_SETTING_INFLATION_HELPTEXT
cat      = SC_BASIC

[SDT_BOOL]
var      = economy.multiple_industry_per_town
def      = false
str      = STR_CONFIG_SETTING_MULTIPINDTOWN
strhelp  = STR_CONFIG_SETTING_MULTIPINDTOWN_HELPTEXT

[SDT_BOOL]
var      = economy.bribe
def      = true
str      = STR_CONFIG_SETTING_BRIBE
strhelp  = STR_CONFIG_SETTING_BRIBE_HELPTEXT
post_cb  = [](auto) { SetWindowClassesDirty(WC_TOWN_AUTHORITY); }
cat      = SC_BASIC

[SDT_BOOL]
var      = economy.exclusive_rights
from     = SLV_79
def      = true
str      = STR_CONFIG_SETTING_ALLOW_EXCLUSIVE
strhelp  = STR_CONFIG_SETTING_ALLOW_EXCLUSIVE_HELPTEXT
post_cb  = [](auto) { SetWindowClassesDirty(WC_TOWN_AUTHORITY); }
cat      = SC_BASIC

[SDT_BOOL]
var      = economy.fund_buildings
from     = SLV_165
def      = true
str      = STR_CONFIG_SETTING_ALLOW_FUND_BUILDINGS
strhelp  = STR_CONFIG_SETTING_ALLOW_FUND_BUILDINGS_HELPTEXT
post_cb  = [](auto) { SetWindowClassesDirty(WC_TOWN_AUTHORITY); }
cat      = SC_BASIC

[SDT_BOOL]
var      = economy.fund_roads
from     = SLV_160
def      = true
str      = STR_CONFIG_SETTING_ALLOW_FUND_ROAD
strhelp  = STR_CONFIG_SETTING_ALLOW_FUND_ROAD_HELPTEXT
post_cb  = [](auto) { SetWindowClassesDirty(WC_TOWN_AUTHORITY); }
cat      = SC_BASIC

[SDT_BOOL]
var      = economy.give_money
from     = SLV_79
def      = true
str      = STR_CONFIG_SETTING_ALLOW_GIVE_MONEY
strhelp  = STR_CONFIG_SETTING_ALLOW_GIVE_MONEY_HELPTEXT
cat      = SC_BASIC

[SDT_VAR]
var      = economy.type
type     = SLE_UINT8
flags    = SF_GUI_DROPDOWN
def      = ET_SMOOTH
min      = ET_BEGIN
max      = ET_END - 1
str      = STR_CONFIG_SETTING_ECONOMY_TYPE
strhelp  = STR_CONFIG_SETTING_ECONOMY_TYPE_HELPTEXT
strval   = STR_CONFIG_SETTING_ECONOMY_TYPE_ORIGINAL
post_cb  = [](auto) { InvalidateWindowClassesData(WC_INDUSTRY_VIEW); }
cat      = SC_BASIC

[SDT_BOOL]
var      = economy.allow_shares
def      = false
str      = STR_CONFIG_SETTING_ALLOW_SHARES
strhelp  = STR_CONFIG_SETTING_ALLOW_SHARES_HELPTEXT
post_cb  = [](auto) { InvalidateWindowClassesData(WC_COMPANY); }

[SDT_VAR]
var      = economy.min_years_for_shares
type     = SLE_UINT8
from     = SLV_TRADING_AGE
def      = 6
min      = 0
max      = 255
interval = 1
str      = STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES
strhelp  = STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_HELPTEXT
strval   = STR_JUST_INT
cat      = SC_EXPERT

[SDT_VAR]
var      = economy.feeder_payment_share
type     = SLE_UINT8
from     = SLV_134
def      = 75
min      = 0
max      = 100
str      = STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE
strhelp  = STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE_HELPTEXT
strval   = STR_CONFIG_SETTING_PERCENTAGE
cat      = SC_EXPERT

[SDT_VAR]
var      = economy.town_growth_rate
type     = SLE_UINT8
from     = SLV_54
flags    = SF_GUI_DROPDOWN
def      = 2
min      = 0
max      = 4
str      = STR_CONFIG_SETTING_TOWN_GROWTH
strhelp  = STR_CONFIG_SETTING_TOWN_GROWTH_HELPTEXT
strval   = STR_CONFIG_SETTING_TOWN_GROWTH_NONE

[SDT_VAR]
var      = economy.larger_towns
type     = SLE_UINT8
from     = SLV_54
flags    = SF_GUI_0_IS_SPECIAL
def      = 4
min      = 0
max      = 255
interval = 1
str      = STR_CONFIG_SETTING_LARGER_TOWNS
strhelp  = STR_CONFIG_SETTING_LARGER_TOWNS_HELPTEXT
strval   = STR_CONFIG_SETTING_LARGER_TOWNS_VALUE

[SDT_VAR]
var      = economy.initial_city_size
type     = SLE_UINT8
from     = SLV_56
def      = 2
min      = 1
max      = 10
interval = 1
str      = STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER
strhelp  = STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER_HELPTEXT
strval   = STR_JUST_COMMA

[SDT_BOOL]
var      = economy.mod_road_rebuild
from     = SLV_77
def      = true
cat      = SC_EXPERT

[SDT_VAR]
var      = economy.dist_local_authority
type     = SLE_UINT8
def      = 20
min      = 5
max      = 60
cat      = SC_EXPERT

[SDT_VAR]
var      = economy.town_noise_population[0]
type     = SLE_UINT16
from     = SLV_96
def      = 800
min      = 200
max      = 65535
cat      = SC_EXPERT

[SDT_VAR]
var      = economy.town_noise_population[1]
type     = SLE_UINT16
from     = SLV_96
def      = 2000
min      = 400
max      = 65535
cat      = SC_EXPERT

[SDT_VAR]
var      = economy.town_noise_population[2]
type     = SLE_UINT16
from     = SLV_96
def      = 4000
min      = 800
max      = 65535
cat      = SC_EXPERT

[SDT_BOOL]
var      = economy.infrastructure_maintenance
from     = SLV_166
def      = false
str      = STR_CONFIG_SETTING_INFRASTRUCTURE_MAINTENANCE
strhelp  = STR_CONFIG_SETTING_INFRASTRUCTURE_MAINTENANCE_HELPTEXT
post_cb  = [](auto) { InvalidateWindowClassesData(WC_COMPANY_INFRASTRUCTURE); }
cat      = SC_BASIC
