Merge branch 'master' into jgrpp-beta

# Conflicts:
#	src/cargopacket.h
#	src/lang/korean.txt
#	src/linkgraph/linkgraph.h
#	src/linkgraph/linkgraphjob.h
#	src/linkgraph/linkgraphschedule.h
#	src/network/network_admin.h
#	src/network/network_func.h
#	src/network/network_server.cpp
#	src/network/network_server.h
#	src/order_base.h
#	src/rail_cmd.cpp
#	src/saveload/company_sl.cpp
#	src/saveload/depot_sl.cpp
#	src/saveload/economy_sl.cpp
#	src/saveload/linkgraph_sl.cpp
#	src/saveload/map_sl.cpp
#	src/saveload/newgrf_sl.cpp
#	src/saveload/order_sl.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload.h
#	src/saveload/signs_sl.cpp
#	src/saveload/station_sl.cpp
#	src/saveload/subsidy_sl.cpp
#	src/saveload/town_sl.cpp
#	src/saveload/vehicle_sl.cpp
#	src/script/api/script_object.cpp
#	src/settings.cpp
#	src/string.cpp
#	src/string_func.h
#	src/table/CMakeLists.txt
#	src/table/settings/settings.ini
#	src/viewport_sprite_sorter_sse4.cpp
This commit is contained in:
Jonathan G Rennison
2021-10-18 18:01:27 +01:00
113 changed files with 721 additions and 755 deletions

View File

@@ -1,50 +1,4 @@
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 hostsettingsgen
-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 hostsettingsgen ${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

View File

@@ -0,0 +1,47 @@
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 hostsettingsgen
-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 hostsettingsgen ${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)

View File

@@ -4,6 +4,9 @@
; 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/>.
;
; These are settings that are company-wide. Meaning that if 1 player in a
; company changes them, it changes for all players.
[pre-amble]
static void UpdateServiceInterval(int32 new_value);
static bool CanUpdateServiceInterval(VehicleType type, int32 &new_value);

View File

@@ -4,6 +4,8 @@
; 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/>.
;
; Settings for the in-game custom currency.
[pre-amble]
static const SettingTable _currency_settings{
[post-amble]

View File

@@ -4,8 +4,18 @@
; 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/>.
;
; Settings that used to be saved in the savegame under the OPTS chunk and
; under "gameopts" in the configuration file, but no longer are. Most of these
; are now moved to other places.
;
; For backwards compatability, this file dictates how both were saved. When
; a configuration files contains these entries, they are read once, and removed
; from the configuration file afterwards. Those that are still supported will
; be saved in their new place.
[pre-amble]
static const uint GAME_DIFFICULTY_NUM = 18;
static const std::array<std::string, GAME_DIFFICULTY_NUM> _old_diff_settings{"max_no_competitors", "competitor_start_time", "number_towns", "industry_density", "max_loan", "initial_interest", "vehicle_costs", "competitor_speed", "competitor_intelligence", "vehicle_breakdowns", "subsidy_multiplier", "construction_cost", "terrain_type", "quantity_sea_lakes", "economy", "line_reverse_mode", "disasters", "town_council_tolerance"};
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

View File

@@ -4,6 +4,9 @@
; 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/>.
;
; Various of settings that are stored in global variables. They are all
; located under "misc" in the configuration files.
[pre-amble]
extern std::string _config_language_file;

View File

@@ -4,6 +4,9 @@
; 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/>.
;
; Settings as stored in the main configuration file ("openttd.cfg") and in the
; savegame PATS chunk (if not flagged not to).
[pre-amble]
/* Begin - Callback Functions for the various settings */
static void v_PositionMainToolbar(int32 new_value);
@@ -186,7 +189,7 @@ enumlist = <this parameter must be set>
; Saved settings variables.
; Do not ADD or REMOVE something in this "difficulty.XXX" table or before it. It breaks savegame compatibility.
; The next 18 entries are important for savegame compatibility. Do NOT remove those. See HandleOldDiffCustom() for more details.
[SDT_VAR]
var = difficulty.max_no_competitors
type = SLE_UINT8
@@ -198,10 +201,14 @@ interval = 1
post_cb = MaxNoAIsChange
cat = SC_BASIC
[SDT_NULL]
length = 1
[SDT_VAR]
var = difficulty.competitor_start_time
type = SLE_UINT8
from = SLV_97
to = SLV_110
def = 2
min = 0
max = 3
[SDT_VAR]
var = difficulty.number_towns
@@ -284,10 +291,14 @@ strhelp = STR_CONFIG_SETTING_CONSTRUCTION_SPEED_HELPTEXT
strval = STR_AI_SPEED_VERY_SLOW
cat = SC_BASIC
[SDT_NULL]
length = 1
[SDT_VAR]
var = difficulty.competitor_intelligence
type = SLE_UINT8
from = SLV_97
to = SLV_110
def = 0
min = 0
max = 2
[SDT_VAR]
var = difficulty.vehicle_breakdowns
@@ -4089,6 +4100,21 @@ str = STR_CONFIG_SETTING_RIGHT_MOUSE_WND_CLOSE
strhelp = STR_CONFIG_SETTING_RIGHT_MOUSE_WND_CLOSE_HELPTEXT
cat = SC_BASIC
; We might need to emulate a right mouse button on mac
[SDTC_VAR]
ifdef = __APPLE__
var = gui.right_mouse_btn_emulation
type = SLE_UINT8
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
guiflags = SGF_MULTISTRING
def = 0
min = 0
max = 2
str = STR_CONFIG_SETTING_RIGHT_MOUSE_BTN_EMU
strhelp = STR_CONFIG_SETTING_RIGHT_MOUSE_BTN_EMU_HELPTEXT
strval = STR_CONFIG_SETTING_RIGHT_MOUSE_BTN_EMU_COMMAND
cat = SC_BASIC
[SDTC_BOOL]
var = gui.measure_tooltip
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -6083,27 +6109,6 @@ flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
def = false
cat = SC_EXPERT
; Since the network code (CmdChangeSetting and friends) use the index in this array to decide
; which setting the server is talking about all conditional compilation of this array must be at the
; end. This isn't really the best solution, the settings the server can tell the client about should
; either use a separate array or some other form of identifier.
;
; We might need to emulate a right mouse button on mac
[SDTC_VAR]
ifdef = __APPLE__
var = gui.right_mouse_btn_emulation
type = SLE_UINT8
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
guiflags = SGF_MULTISTRING
def = 0
min = 0
max = 2
str = STR_CONFIG_SETTING_RIGHT_MOUSE_BTN_EMU
strhelp = STR_CONFIG_SETTING_RIGHT_MOUSE_BTN_EMU_HELPTEXT
strval = STR_CONFIG_SETTING_RIGHT_MOUSE_BTN_EMU_COMMAND
cat = SC_BASIC
[SDT_BOOL]
var = vehicle.pay_for_repair
def = true

View File

@@ -4,6 +4,9 @@
; 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/>.
;
; Windows specific settings that are stored in global variables. They are all
; located under "win32" in the configuration files.
[pre-amble]
/* win32_v.cpp only settings */
#if defined(_WIN32) && !defined(DEDICATED)

View File

@@ -4,6 +4,9 @@
; 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/>.
;
; The windows configuration file ("windows.cfg") defines various of properties
; of all windows.
[pre-amble]
static const SettingTable _window_settings{