Changeset - r25555:7f48433a370d
[Not reviewed]
master
7 1 8
Patric Stout - 3 years ago 2021-05-29 08:58:07
truebrain@openttd.org
Codechange: move all settings.ini files to table/settings
11 files changed:
0 comments (0 inline, 0 general)
src/table/CMakeLists.txt
Show inline comments
 
set(GENERATED_BINARY_DIR ${CMAKE_BINARY_DIR}/generated)
 
set(TABLE_BINARY_DIR ${GENERATED_BINARY_DIR}/table)
 

	
 
set(TABLE_INI_SOURCE_FILES
 
        ${CMAKE_CURRENT_SOURCE_DIR}/company_settings.ini
 
        ${CMAKE_CURRENT_SOURCE_DIR}/currency_settings.ini
 
        ${CMAKE_CURRENT_SOURCE_DIR}/gameopt_settings.ini
 
        ${CMAKE_CURRENT_SOURCE_DIR}/misc_settings.ini
 
        ${CMAKE_CURRENT_SOURCE_DIR}/settings.ini
 
        ${CMAKE_CURRENT_SOURCE_DIR}/win32_settings.ini
 
        ${CMAKE_CURRENT_SOURCE_DIR}/window_settings.ini
 
)
 

	
 
if (HOST_BINARY_DIR)
 
    include(${HOST_BINARY_DIR}/settingsgen.cmake)
 
endif()
 

	
 
# Generate a command and target to create the settings table
 
add_custom_command_timestamp(OUTPUT ${TABLE_BINARY_DIR}/settings.h
 
        COMMAND ${CMAKE_COMMAND} -E make_directory ${TABLE_BINARY_DIR}
 
        COMMAND settingsgen
 
                -o ${TABLE_BINARY_DIR}/settings.h
 
                -b ${CMAKE_SOURCE_DIR}/src/table/settings.h.preamble
 
                -a ${CMAKE_SOURCE_DIR}/src/table/settings.h.postamble
 
                ${TABLE_INI_SOURCE_FILES}
 
        DEPENDS settingsgen ${TABLE_INI_SOURCE_FILES}
 
                ${CMAKE_SOURCE_DIR}/src/table/settings.h.preamble
 
                ${CMAKE_SOURCE_DIR}/src/table/settings.h.postamble
 
        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
 
        COMMENT "Generating table/settings.h"
 
)
 
add_custom_target_timestamp(table_settings
 
        DEPENDS
 
        ${TABLE_BINARY_DIR}/settings.h
 
)
 

	
 
add_library(settings
 
        INTERFACE
 
)
 
target_include_directories(settings
 
        INTERFACE
 
        ${GENERATED_BINARY_DIR}
 
)
 
add_dependencies(settings
 
        table_settings
 
)
 
add_library(openttd::settings ALIAS settings)
 
add_subdirectory(settings)
 

	
 
add_files(
 
    airport_defaults.h
src/table/company_settings.ini
Show inline comments
 
deleted file
src/table/currency_settings.ini
Show inline comments
 
deleted file
src/table/gameopt_settings.ini
Show inline comments
 
deleted file
src/table/misc_settings.ini
Show inline comments
 
deleted file
src/table/settings.ini
Show inline comments
 
deleted file
src/table/settings/CMakeLists.txt
Show inline comments
 
new file 100644
 
set(GENERATED_BINARY_DIR ${CMAKE_BINARY_DIR}/generated)
 
set(TABLE_BINARY_DIR ${GENERATED_BINARY_DIR}/table)
 

	
 
set(TABLE_INI_SOURCE_FILES
 
        ${CMAKE_CURRENT_SOURCE_DIR}/company_settings.ini
 
        ${CMAKE_CURRENT_SOURCE_DIR}/currency_settings.ini
 
        ${CMAKE_CURRENT_SOURCE_DIR}/gameopt_settings.ini
 
        ${CMAKE_CURRENT_SOURCE_DIR}/misc_settings.ini
 
        ${CMAKE_CURRENT_SOURCE_DIR}/settings.ini
 
        ${CMAKE_CURRENT_SOURCE_DIR}/win32_settings.ini
 
        ${CMAKE_CURRENT_SOURCE_DIR}/window_settings.ini
 
)
 

	
 
if (HOST_BINARY_DIR)
 
    include(${HOST_BINARY_DIR}/settingsgen.cmake)
 
endif()
 

	
 
# Generate a command and target to create the settings table
 
add_custom_command_timestamp(OUTPUT ${TABLE_BINARY_DIR}/settings.h
 
        COMMAND ${CMAKE_COMMAND} -E make_directory ${TABLE_BINARY_DIR}
 
        COMMAND settingsgen
 
                -o ${TABLE_BINARY_DIR}/settings.h
 
                -b ${CMAKE_SOURCE_DIR}/src/table/settings.h.preamble
 
                -a ${CMAKE_SOURCE_DIR}/src/table/settings.h.postamble
 
                ${TABLE_INI_SOURCE_FILES}
 
        DEPENDS settingsgen ${TABLE_INI_SOURCE_FILES}
 
                ${CMAKE_SOURCE_DIR}/src/table/settings.h.preamble
 
                ${CMAKE_SOURCE_DIR}/src/table/settings.h.postamble
 
        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
 
        COMMENT "Generating table/settings.h"
 
)
 
add_custom_target_timestamp(table_settings
 
        DEPENDS
 
        ${TABLE_BINARY_DIR}/settings.h
 
)
 

	
 
add_library(settings
 
        INTERFACE
 
)
 
target_include_directories(settings
 
        INTERFACE
 
        ${GENERATED_BINARY_DIR}
 
)
 
add_dependencies(settings
 
        table_settings
 
)
 
add_library(openttd::settings ALIAS settings)
src/table/settings/company_settings.ini
Show inline comments
 
new file 100644
 
; 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/>.
 
;
 

	
 
[pre-amble]
 
static void UpdateServiceInterval(int32 new_value);
 
static bool CanUpdateServiceInterval(VehicleType type, int32 &new_value);
 
static void UpdateServiceInterval(VehicleType type, int32 new_value);
 

	
 
static const SettingTable _company_settings{
 
[post-amble]
 
};
 
[templates]
 
SDT_BOOL = SDT_BOOL(CompanySettings, $var,        $flags, $guiflags, $def,                        $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
 
SDT_VAR  =  SDT_VAR(CompanySettings, $var, $type, $flags, $guiflags, $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 CompanySettings.$var exceeds storage size");
 

	
 
[defaults]
 
flags    = 0
 
guiflags = SGF_PER_COMPANY
 
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_BOOL]
 
var      = engine_renew
 
def      = true
 
str      = STR_CONFIG_SETTING_AUTORENEW_VEHICLE
 
strhelp  = STR_CONFIG_SETTING_AUTORENEW_VEHICLE_HELPTEXT
 
cat      = SC_BASIC
 

	
 
[SDT_VAR]
 
var      = engine_renew_months
 
type     = SLE_INT16
 
guiflags = SGF_PER_COMPANY | SGF_DISPLAY_ABS
 
def      = 6
 
min      = -12
 
max      = 12
 
str      = STR_CONFIG_SETTING_AUTORENEW_MONTHS
 
strhelp  = STR_CONFIG_SETTING_AUTORENEW_MONTHS_HELPTEXT
 
strval   = STR_CONFIG_SETTING_AUTORENEW_MONTHS_VALUE_BEFORE
 

	
 
[SDT_VAR]
 
var      = engine_renew_money
 
type     = SLE_UINT
 
guiflags = SGF_PER_COMPANY | SGF_CURRENCY
 
def      = 100000
 
min      = 0
 
max      = 2000000
 
str      = STR_CONFIG_SETTING_AUTORENEW_MONEY
 
strhelp  = STR_CONFIG_SETTING_AUTORENEW_MONEY_HELPTEXT
 
strval   = STR_JUST_CURRENCY_LONG
 

	
 
[SDT_BOOL]
 
var      = renew_keep_length
 
def      = false
 

	
 
[SDT_BOOL]
 
var      = vehicle.servint_ispercent
 
def      = false
 
str      = STR_CONFIG_SETTING_SERVINT_ISPERCENT
 
strhelp  = STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT
 
post_cb  = UpdateServiceInterval
 

	
 
[SDT_VAR]
 
var      = vehicle.servint_trains
 
type     = SLE_UINT16
 
guiflags = SGF_PER_COMPANY | SGF_0ISDISABLED
 
def      = 150
 
min      = 5
 
max      = 800
 
str      = STR_CONFIG_SETTING_SERVINT_TRAINS
 
strhelp  = STR_CONFIG_SETTING_SERVINT_TRAINS_HELPTEXT
 
strval   = STR_CONFIG_SETTING_SERVINT_VALUE
 
pre_cb   = [](auto new_value) { return CanUpdateServiceInterval(VEH_TRAIN, new_value); }
 
post_cb  = [](auto new_value) { UpdateServiceInterval(VEH_TRAIN, new_value); }
 

	
 
[SDT_VAR]
 
var      = vehicle.servint_roadveh
 
type     = SLE_UINT16
 
guiflags = SGF_PER_COMPANY | SGF_0ISDISABLED
 
def      = 150
 
min      = 5
 
max      = 800
 
str      = STR_CONFIG_SETTING_SERVINT_ROAD_VEHICLES
 
strhelp  = STR_CONFIG_SETTING_SERVINT_ROAD_VEHICLES_HELPTEXT
 
strval   = STR_CONFIG_SETTING_SERVINT_VALUE
 
pre_cb   = [](auto new_value) { return CanUpdateServiceInterval(VEH_ROAD, new_value); }
 
post_cb  = [](auto new_value) { UpdateServiceInterval(VEH_ROAD, new_value); }
 

	
 
[SDT_VAR]
 
var      = vehicle.servint_ships
 
type     = SLE_UINT16
 
guiflags = SGF_PER_COMPANY | SGF_0ISDISABLED
 
def      = 360
 
min      = 5
 
max      = 800
 
str      = STR_CONFIG_SETTING_SERVINT_SHIPS
 
strhelp  = STR_CONFIG_SETTING_SERVINT_SHIPS_HELPTEXT
 
strval   = STR_CONFIG_SETTING_SERVINT_VALUE
 
pre_cb   = [](auto new_value) { return CanUpdateServiceInterval(VEH_SHIP, new_value); }
 
post_cb  = [](auto new_value) { UpdateServiceInterval(VEH_SHIP, new_value); }
 

	
 
[SDT_VAR]
 
var      = vehicle.servint_aircraft
 
type     = SLE_UINT16
 
guiflags = SGF_PER_COMPANY | SGF_0ISDISABLED
 
def      = 100
 
min      = 5
 
max      = 800
 
str      = STR_CONFIG_SETTING_SERVINT_AIRCRAFT
 
strhelp  = STR_CONFIG_SETTING_SERVINT_AIRCRAFT_HELPTEXT
 
strval   = STR_CONFIG_SETTING_SERVINT_VALUE
 
pre_cb   = [](auto new_value) { return CanUpdateServiceInterval(VEH_AIRCRAFT, new_value); }
 
post_cb  = [](auto new_value) { UpdateServiceInterval(VEH_AIRCRAFT, new_value); }
src/table/settings/currency_settings.ini
Show inline comments
 
new file 100644
 
; 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/>.
 
;
 

	
 
[pre-amble]
 
static const SettingTable _currency_settings{
 
[post-amble]
 
};
 
[templates]
 
SDT_VAR  = SDT_VAR (CurrencySpec, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
 
SDT_SSTR = SDT_SSTR(CurrencySpec, $var, $type, $flags, $guiflags, $def,                                                 $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
 

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

	
 
[defaults]
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
guiflags = SGF_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      = rate
 
type     = SLE_UINT16
 
def      = 1
 
min      = 0
 
max      = UINT16_MAX
 

	
 
[SDT_SSTR]
 
var      = separator
 
type     = SLE_STRQ
 
def      = "".""
 
cat      = SC_BASIC
 

	
 
[SDT_VAR]
 
var      = to_euro
 
type     = SLE_INT32
 
def      = 0
 
min      = MIN_YEAR
 
max      = MAX_YEAR
 

	
 
[SDT_SSTR]
 
var      = prefix
 
type     = SLE_STRQ
 
def      = nullptr
 

	
 
[SDT_SSTR]
 
var      = suffix
 
type     = SLE_STRQ
 
def      = "" credits""
src/table/settings/gameopt_settings.ini
Show inline comments
 
new file 100644
 
; 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/>.
 
;
 

	
 
[pre-amble]
 
static const uint GAME_DIFFICULTY_NUM = 18;
 
static uint16 _old_diff_custom[GAME_DIFFICULTY_NUM];
 
uint8 _old_diff_level;                                 ///< Old difficulty level from old savegames
 
uint8 _old_units;                                      ///< Old units from old savegames
 

	
 
/* Most of these strings are used both for gameopt-backward compatibility
 
 * and the settings tables. The rest is here for consistency. */
 
static std::initializer_list<const char*> _locale_currencies{"GBP", "USD", "EUR", "YEN", "ATS", "BEF", "CHF", "CZK", "DEM", "DKK", "ESP", "FIM", "FRF", "GRD", "HUF", "ISK", "ITL", "NLG", "NOK", "PLN", "RON", "RUR", "SIT", "SEK", "YTL", "SKK", "BRL", "EEK", "custom"};
 
static std::initializer_list<const char*> _locale_units{"imperial", "metric", "si", "gameunits"};
 
static std::initializer_list<const char*> _town_names{"english", "french", "german", "american", "latin", "silly", "swedish", "dutch", "finnish", "polish", "slovak", "norwegian", "hungarian", "austrian", "romanian", "czech", "swiss", "danish", "turkish", "italian", "catalan"};
 
static std::initializer_list<const char*> _climates{"temperate", "arctic", "tropic", "toyland"};
 
static std::initializer_list<const char*> _autosave_interval{"off", "monthly", "quarterly", "half year", "yearly"};
 
static std::initializer_list<const char*> _roadsides{"left", "right"};
 
static std::initializer_list<const char*> _savegame_date{"long", "short", "iso"};
 
static std::initializer_list<const char*> _osk_activation{"disabled", "double", "single", "immediately"};
 
static std::initializer_list<const char*> _settings_profiles{"easy", "medium", "hard"};
 
static std::initializer_list<const char*> _news_display{ "off", "summarized", "full"};
 

	
 
static const SettingTable _gameopt_settings{
 
/* In version 4 a new difficulty setting has been added to the difficulty settings,
 
 * town attitude towards demolishing. Needs special handling because some dimwit thought
 
 * it funny to have the GameDifficulty struct be an array while it is a struct of
 
 * same-sized members
 
 * XXX - To save file-space and since values are never bigger than about 10? only
 
 * save the first 16 bits in the savegame. Question is why the values are still int32
 
 * and why not byte for example?
 
 * 'SLE_FILE_I16 | SLE_VAR_U16' in "diff_custom" is needed to get around SlArray() hack
 
 * for savegames version 0 - though it is an array, it has to go through the byteswap process */
 
[post-amble]
 
};
 
[templates]
 
SDTG_LIST    =  SDTG_LIST($name,              $type, $flags, $guiflags, $var, $def, $length, $from, $to, $cat, $extra, $startup),
 
SDTG_VAR     =   SDTG_VAR($name,              $type, $flags, $guiflags, $var, $def, $min, $max, $interval,  $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
 
SDT_NULL     =   SDT_NULL(                                                          $length,                                                            $from, $to),
 
SDTC_OMANY   = SDTC_OMANY(              $var, $type, $flags, $guiflags, $def,       $max, $full,            $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to,        $cat, $extra, $startup),
 
SDTG_OMANY   = SDTG_OMANY($name,              $type, $flags, $guiflags, $var, $def, $max, $full,            $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to,        $cat, $extra, $startup),
 
SDT_OMANY    =  SDT_OMANY(GameSettings, $var, $type, $flags, $guiflags, $def,       $max, $full,            $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $load, $cat, $extra, $startup),
 
SDT_VAR      =    SDT_VAR(GameSettings, $var, $type, $flags, $guiflags, $def, $min, $max,        $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to,        $cat, $extra, $startup),
 

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

	
 
[defaults]
 
flags    = 0
 
guiflags = SGF_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
 

	
 

	
 

	
 
[SDTG_LIST]
 
name     = ""diff_custom""
 
sdt_cmd  = SDT_INTLIST
 
sle_cmd  = SL_ARR
 
type     = SLE_FILE_I16 | SLE_VAR_U16
 
flags    = SLF_NOT_IN_CONFIG
 
var      = _old_diff_custom
 
length   = 17
 
def      = nullptr
 
to       = SLV_4
 

	
 
[SDTG_LIST]
 
name     = ""diff_custom""
 
sdt_cmd  = SDT_INTLIST
 
sle_cmd  = SL_ARR
 
type     = SLE_UINT16
 
flags    = SLF_NOT_IN_CONFIG
 
var      = _old_diff_custom
 
length   = 18
 
def      = nullptr
 
full     = nullptr
 
from     = SLV_4
 

	
 
##
 
[SDTG_VAR]
 
name     = ""diff_level""
 
var      = _old_diff_level
 
type     = SLE_UINT8
 
flags    = SLF_NOT_IN_CONFIG
 
def      = SP_CUSTOM
 
min      = SP_EASY
 
max      = SP_CUSTOM
 
cat      = SC_BASIC
 

	
 
[SDT_OMANY]
 
var      = locale.currency
 
type     = SLE_UINT8
 
flags    = SLF_NO_NETWORK_SYNC
 
def      = 0
 
max      = CURRENCY_END - 1
 
full     = _locale_currencies
 
cat      = SC_BASIC
 

	
 
[SDTG_OMANY]
 
name     = ""units""
 
var      = _old_units
 
type     = SLE_UINT8
 
flags    = SLF_NOT_IN_CONFIG
 
def      = 1
 
max      = 2
 
full     = _locale_units
 
cat      = SC_BASIC
 

	
 
# There are only 21 predefined town_name values (0-20), but you can have more with newgrf action F so allow
 
# these bigger values (21-255). Invalid values will fallback to english on use and (undefined string) in GUI.
 
[SDT_OMANY]
 
var      = game_creation.town_name
 
type     = SLE_UINT8
 
def      = 0
 
max      = 255
 
full     = _town_names
 
cat      = SC_BASIC
 

	
 
[SDT_OMANY]
 
var      = game_creation.landscape
 
type     = SLE_UINT8
 
def      = 0
 
max      = 3
 
full     = _climates
 
load     = ConvertLandscape
 
cat      = SC_BASIC
 

	
 
[SDT_VAR]
 
var      = game_creation.snow_line_height
 
type     = SLE_UINT8
 
def      = DEF_SNOWLINE_HEIGHT * TILE_HEIGHT
 
min      = MIN_SNOWLINE_HEIGHT * TILE_HEIGHT
 
# "max" used to be MAX_SNOWLINE_HEIGHT * TILE_HEIGHT, but this would overflow the storage.
 
max      = UINT8_MAX
 
to       = SLV_22
 

	
 
[SDT_NULL]
 
length   = 1
 
from     = SLV_22
 
to       = SLV_165
 

	
 
[SDT_NULL]
 
length   = 1
 
to       = SLV_23
 

	
 
[SDTC_OMANY]
 
var      = gui.autosave
 
type     = SLE_UINT8
 
from     = SLV_23
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
def      = 1
 
max      = 4
 
full     = _autosave_interval
 
cat      = SC_BASIC
 

	
 
[SDT_OMANY]
 
var      = vehicle.road_side
 
type     = SLE_UINT8
 
def      = 1
 
max      = 1
 
full     = _roadsides
 
cat      = SC_BASIC
src/table/settings/misc_settings.ini
Show inline comments
 
new file 100644
 
; 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/>.
 
;
 

	
 
[pre-amble]
 
extern std::string _config_language_file;
 

	
 
static std::initializer_list<const char*> _support8bppmodes{"no", "system" , "hardware"};
 
static std::initializer_list<const char*> _display_opt_modes{"SHOW_TOWN_NAMES", "SHOW_STATION_NAMES", "SHOW_SIGNS", "FULL_ANIMATION", "", "FULL_DETAIL", "WAYPOINTS", "SHOW_COMPETITOR_SIGNS"};
 

	
 
#ifdef WITH_COCOA
 
extern bool _allow_hidpi_window;
 
#endif
 
#ifndef WITH_COCOA
 
#define WITHOUT_COCOA
 
#endif
 

	
 
static const SettingTable _misc_settings{
 
[post-amble]
 
};
 
[templates]
 
SDTG_LIST  =  SDTG_LIST($name, $type, $flags, $guiflags, $var, $def,       $length,                                                            $from, $to, $cat, $extra, $startup),
 
SDTG_MMANY = SDTG_MMANY($name, $type, $flags, $guiflags, $var, $def,                        $full, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
 
SDTG_OMANY = SDTG_OMANY($name, $type, $flags, $guiflags, $var, $def,       $max,            $full, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
 
SDTG_SSTR  =  SDTG_SSTR($name, $type, $flags, $guiflags, $var, $def,       0,                                               $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
 
SDTG_BOOL  =  SDTG_BOOL($name,        $flags, $guiflags, $var, $def,                               $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
 
SDTG_VAR   =   SDTG_VAR($name, $type, $flags, $guiflags, $var, $def, $min, $max, $interval,        $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
 

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

	
 
[defaults]
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
guiflags = SGF_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  = true
 

	
 

	
 

	
 
[SDTG_MMANY]
 
name     = ""display_opt""
 
type     = SLE_UINT8
 
var      = _display_opt
 
def      = (1 << DO_SHOW_TOWN_NAMES | 1 << DO_SHOW_STATION_NAMES | 1 << DO_SHOW_SIGNS | 1 << DO_FULL_ANIMATION | 1 << DO_FULL_DETAIL | 1 << DO_SHOW_WAYPOINT_NAMES | 1 << DO_SHOW_COMPETITOR_SIGNS)
 
full     = _display_opt_modes
 

	
 
[SDTG_BOOL]
 
name     = ""fullscreen""
 
var      = _fullscreen
 
def      = false
 
cat      = SC_BASIC
 

	
 
[SDTG_BOOL]
 
ifdef    = WITH_COCOA
 
name     = ""video_hw_accel""
 
var      = _video_hw_accel
 
def      = false
 
cat      = SC_BASIC
 

	
 
[SDTG_BOOL]
 
ifdef    = WITHOUT_COCOA
 
name     = ""video_hw_accel""
 
var      = _video_hw_accel
 
def      = true
 
cat      = SC_BASIC
 

	
 
[SDTG_BOOL]
 
name     = ""video_vsync""
 
var      = _video_vsync
 
def      = false
 
cat      = SC_BASIC
 

	
 
[SDTG_OMANY]
 
name     = ""support8bpp""
 
type     = SLE_UINT8
 
var      = _support8bpp
 
def      = 0
 
max      = 2
 
full     = _support8bppmodes
 
cat      = SC_BASIC
 

	
 
[SDTG_SSTR]
 
name     = ""graphicsset""
 
type     = SLE_STRQ
 
var      = BaseGraphics::ini_set
 
def      = nullptr
 
cat      = SC_BASIC
 

	
 
[SDTG_SSTR]
 
name     = ""soundsset""
 
type     = SLE_STRQ
 
var      = BaseSounds::ini_set
 
def      = nullptr
 
cat      = SC_BASIC
 

	
 
[SDTG_SSTR]
 
name     = ""musicset""
 
type     = SLE_STRQ
 
var      = BaseMusic::ini_set
 
def      = nullptr
 
cat      = SC_BASIC
 

	
 
[SDTG_SSTR]
 
name     = ""videodriver""
 
type     = SLE_STRQ
 
var      = _ini_videodriver
 
def      = nullptr
 
cat      = SC_EXPERT
 

	
 
[SDTG_SSTR]
 
name     = ""musicdriver""
 
type     = SLE_STRQ
 
var      = _ini_musicdriver
 
def      = nullptr
 
cat      = SC_EXPERT
 

	
 
[SDTG_SSTR]
 
name     = ""sounddriver""
 
type     = SLE_STRQ
 
var      = _ini_sounddriver
 
def      = nullptr
 
cat      = SC_EXPERT
 

	
 
[SDTG_SSTR]
 
name     = ""blitter""
 
type     = SLE_STRQ
 
var      = _ini_blitter
 
def      = nullptr
 

	
 
[SDTG_SSTR]
 
name     = ""language""
 
type     = SLE_STR
 
var      = _config_language_file
 
def      = nullptr
 
cat      = SC_BASIC
 

	
 
; workaround for implicit lengthof() in SDTG_LIST
 
[SDTG_LIST]
 
name     = ""resolution""
 
type     = SLE_INT
 
length   = 2
 
var      = _cur_resolution
 
def      = ""0,0""
 
cat      = SC_BASIC
 

	
 
[SDTG_SSTR]
 
name     = ""screenshot_format""
 
type     = SLE_STR
 
var      = _screenshot_format_name
 
def      = nullptr
 
cat      = SC_EXPERT
 

	
 
[SDTG_SSTR]
 
name     = ""savegame_format""
 
type     = SLE_STR
 
var      = _savegame_format
 
def      = nullptr
 
cat      = SC_EXPERT
 

	
 
[SDTG_BOOL]
 
name     = ""rightclick_emulate""
 
var      = _rightclick_emulate
 
def      = false
 

	
 
[SDTG_SSTR]
 
ifdef    = HAS_TRUETYPE_FONT
 
name     = ""small_font""
 
type     = SLE_STR
 
var      = _freetype.small.font
 
def      = nullptr
 

	
 
[SDTG_SSTR]
 
ifdef    = HAS_TRUETYPE_FONT
 
name     = ""medium_font""
 
type     = SLE_STR
 
var      = _freetype.medium.font
 
def      = nullptr
 

	
 
[SDTG_SSTR]
 
ifdef    = HAS_TRUETYPE_FONT
 
name     = ""large_font""
 
type     = SLE_STR
 
var      = _freetype.large.font
 
def      = nullptr
 

	
 
[SDTG_SSTR]
 
ifdef    = HAS_TRUETYPE_FONT
 
name     = ""mono_font""
 
type     = SLE_STR
 
var      = _freetype.mono.font
 
def      = nullptr
 

	
 
[SDTG_VAR]
 
ifdef    = HAS_TRUETYPE_FONT
 
name     = ""small_size""
 
type     = SLE_UINT
 
var      = _freetype.small.size
 
def      = 0
 
min      = 0
 
max      = 72
 

	
 
[SDTG_VAR]
 
ifdef    = HAS_TRUETYPE_FONT
 
name     = ""medium_size""
 
type     = SLE_UINT
 
var      = _freetype.medium.size
 
def      = 0
 
min      = 0
 
max      = 72
 

	
 
[SDTG_VAR]
 
ifdef    = HAS_TRUETYPE_FONT
 
name     = ""large_size""
 
type     = SLE_UINT
 
var      = _freetype.large.size
 
def      = 0
 
min      = 0
 
max      = 72
 

	
 
[SDTG_VAR]
 
ifdef    = HAS_TRUETYPE_FONT
 
name     = ""mono_size""
 
type     = SLE_UINT
 
var      = _freetype.mono.size
 
def      = 0
 
min      = 0
 
max      = 72
 

	
 
[SDTG_BOOL]
 
ifdef    = HAS_TRUETYPE_FONT
 
name     = ""small_aa""
 
var      = _freetype.small.aa
 
def      = false
 

	
 
[SDTG_BOOL]
 
ifdef    = HAS_TRUETYPE_FONT
 
name     = ""medium_aa""
 
var      = _freetype.medium.aa
 
def      = false
 

	
 
[SDTG_BOOL]
 
ifdef    = HAS_TRUETYPE_FONT
 
name     = ""large_aa""
 
var      = _freetype.large.aa
 
def      = false
 

	
 
[SDTG_BOOL]
 
ifdef    = HAS_TRUETYPE_FONT
 
name     = ""mono_aa""
 
var      = _freetype.mono.aa
 
def      = false
 

	
 
[SDTG_VAR]
 
name     = ""sprite_cache_size_px""
 
type     = SLE_UINT
 
var      = _sprite_cache_size
 
def      = 128
 
min      = 1
 
max      = 512
 
cat      = SC_EXPERT
 

	
 
[SDTG_VAR]
 
name     = ""player_face""
 
type     = SLE_UINT32
 
var      = _company_manager_face
 
def      = 0
 
min      = 0
 
max      = 0xFFFFFFFF
 
cat      = SC_BASIC
 

	
 
[SDTG_VAR]
 
name     = ""transparency_options""
 
type     = SLE_UINT
 
var      = _transparency_opt
 
def      = 0
 
min      = 0
 
max      = 0x1FF
 
cat      = SC_BASIC
 

	
 
[SDTG_VAR]
 
name     = ""transparency_locks""
 
type     = SLE_UINT
 
var      = _transparency_lock
 
def      = 0
 
min      = 0
 
max      = 0x1FF
 
cat      = SC_BASIC
 

	
 
[SDTG_VAR]
 
name     = ""invisibility_options""
 
type     = SLE_UINT
 
var      = _invisibility_opt
 
def      = 0
 
min      = 0
 
max      = 0xFF
 
cat      = SC_BASIC
 

	
 
[SDTG_SSTR]
 
name     = ""keyboard""
 
type     = SLE_STR
 
var      = _keyboard_opt[0]
 
def      = nullptr
 
cat      = SC_EXPERT
 

	
 
[SDTG_SSTR]
 
name     = ""keyboard_caps""
 
type     = SLE_STR
 
var      = _keyboard_opt[1]
 
def      = nullptr
 
cat      = SC_EXPERT
 

	
 
[SDTG_VAR]
 
name     = ""last_newgrf_count""
 
type     = SLE_UINT32
 
var      = _settings_client.gui.last_newgrf_count
 
def      = 100
 
min      = 0
 
max      = UINT32_MAX
 
cat      = SC_EXPERT
 

	
 
[SDTG_VAR]
 
name     = ""gui_zoom""
 
type     = SLE_INT8
 
var      = _gui_zoom_cfg
 
def      = ZOOM_LVL_CFG_AUTO
 
min      = ZOOM_LVL_CFG_AUTO
 
max      = ZOOM_LVL_OUT_4X
 
cat      = SC_BASIC
 

	
 
[SDTG_VAR]
 
name     = ""font_zoom""
 
type     = SLE_INT8
 
var      = _font_zoom_cfg
 
def      = ZOOM_LVL_CFG_AUTO
 
min      = ZOOM_LVL_CFG_AUTO
 
max      = ZOOM_LVL_OUT_4X
 
cat      = SC_BASIC
 

	
 
[SDTG_BOOL]
 
ifdef    = WITH_COCOA
 
name     = ""allow_hidpi""
 
var      = _allow_hidpi_window
 
def      = true

Changeset was too big and was cut off... Show full diff anyway

0 comments (0 inline, 0 general)