Commit Graph

1261 Commits (jgrpp)

Author SHA1 Message Date
Jonathan G Rennison 3e33be7b10 Fix day length changes with scheduled dispatch and timetable start times
When time is in minutes

See: #472
1 year ago
Jonathan G Rennison 3877bb31ef Changing day length or date no longer changes time in minutes
Add offset variables for scaled date ticks.
Adjust offset when changing day length or date, such that scaled
date ticks remain the same.
Store _scaled_tick_counter and scaled date ticks offset in the savagame.
2 years ago
Jonathan G Rennison 5c2d5782a4 Fixes incorrect link graph edge travel times with non-unity day length
Change vehicle last_loading_tick to be relative to _scaled_tick_counter
2 years ago
Jonathan G Rennison d776b302fa Store the gui.zoom_max setting under a different name in the config file
So that it isn't overwritten by vanilla.
Otherwise use the vanilla setting value if present and outside the
vanilla range.
2 years ago
Jonathan G Rennison b9e322ec7a Add mechanism to override setting names used in config file 2 years ago
Jonathan G Rennison f32733ef22 Command: Replace binary_length field with auxiliary data
Use for CMD_ADD_PLAN_LINE
2 years ago
Jonathan G Rennison 6d4474b84e Merge tag '13.0-beta2' into jgrpp
# Conflicts:
#	src/cheat_gui.cpp
#	src/company_gui.cpp
#	src/console_gui.cpp
#	src/depot_gui.cpp
#	src/error_gui.cpp
#	src/gfx.cpp
#	src/graph_gui.cpp
#	src/group_gui.cpp
#	src/lang/english.txt
#	src/lang/korean.txt
#	src/lang/polish.txt
#	src/misc_gui.cpp
#	src/network/network_content_gui.h
#	src/newgrf_debug_gui.cpp
#	src/order_gui.cpp
#	src/rail_gui.cpp
#	src/road_gui.cpp
#	src/settings_gui.cpp
#	src/settings_type.h
#	src/station_gui.cpp
#	src/subsidy_gui.cpp
#	src/table/settings/gui_settings.ini
#	src/timetable_gui.cpp
#	src/town_gui.cpp
#	src/train_cmd.cpp
#	src/vehicle_gui.cpp
#	src/viewport.cpp
#	src/water_cmd.cpp
#	src/widgets/dropdown.cpp
#	src/window_gui.h
2 years ago
Jonathan G Rennison 2eecf19edb Fix engine changes not updating build template train windows 2 years ago
Jonathan G Rennison cf6f509859 Add setting flag to enable bool -> int config file load conversion 2 years ago
Jonathan G Rennison 7c3c92f8b8
Fix #10155: SyncCompanySettings sending old instead of new setting values (#10158) 2 years ago
Jonathan G Rennison ff0bed96a4 Fix SyncCompanySettings not sending correct setting values 2 years ago
Jonathan G Rennison 2af2c56d19 Allow various settings to be changed in multiplayer
If the corresponding TTDPatch flag bit has not been observed by a NewGRF
2 years ago
Jonathan G Rennison 6459e62fff Merge branch 'master' into jgrpp
# Conflicts:
#	src/lang/english.txt
#	src/map_type.h
#	src/network/network_command.cpp
#	src/object_cmd.cpp
#	src/rail_cmd.cpp
#	src/road_cmd.cpp
#	src/road_func.h
#	src/saveload/afterload.cpp
#	src/saveload/saveload.h
#	src/settings_gui.cpp
#	src/string.cpp
#	src/table/road_land.h
#	src/table/settings/game_settings.ini
#	src/table/settings/world_settings.ini
#	src/tbtr_template_gui_main.h
#	src/train_cmd.cpp
2 years ago
Jonathan G Rennison 3b3c9c1c3a
Fix #10129: Use after free in GRFLoadConfig invalid GRF error path (#10130) 2 years ago
Jonathan G Rennison 94de25ec10 Fix changing town zone settings not updating town zone radii
This could cause MP desyncs
2 years ago
Jonathan G Rennison a8361cd608 Allow overriding town settings on a per-town basis
Add a setting for whether this is allowed for non-privileged
multiplayer clients
2 years ago
Jonathan G Rennison f61562efef Fix network clients setting old company settings for new companies 2 years ago
Jonathan G Rennison 143230d8f2 Allow changing road vehicle driving side when all road vehicles in depots 2 years ago
Jonathan G Rennison 8c0eca28a8 Recalculated route step sprite sizes when changing zoom levels 2 years ago
Jonathan G Rennison 309f1b47d2 Only apply sprite_zoom_min setting when suitable zoom levels are available
Only discard sprite zoom levels when a suitable higher zoom level is
defined in the same colour mode

See: https://github.com/OpenTTD/OpenTTD/issues/9804
2 years ago
Jonathan G Rennison 856cea576f Fix infrastructure sharing checks not being executed when disabling 2 years ago
Jonathan G Rennison 22caac6529 Add game setting to limit train lookahead to signal aspect
In realistic braking mode when multi-aspect signalling enabled by GRF
2 years ago
Jonathan G Rennison 730b84e262 Fix load check of a savegame with realistic braking enabled triggering signal checks on current game 2 years ago
Jonathan G Rennison c4e2175cc9 Merge branch 'master' into jgrpp 2 years ago
Jonathan G Rennison 03bdb28c02 Allow pre_cb to transform incoming enum value in ValidateEnumSetting 2 years ago
Jonathan G Rennison 2cbbae16da Add roadstop GRF properties to set bridge heights and disallowed pillars 2 years ago
Jonathan G Rennison 1084bb8566 Initial support for NewGRF road stops (bus and lorry stops) 2 years ago
Jonathan G Rennison 47f219d66d Settings GUI: Label sprite_zoom_min as should be left at default 2 years ago
Jonathan G Rennison 96d789dfbf Fix window preference save/load of build vehicle windows 2 years ago
Jonathan G Rennison 644bd0a325 Fix input/display of speeds in tracerestrict window in tiles/day mode 2 years ago
Loïc Guilloux d62c5667cf
Fix #9766: Don't write uninitialised data in config file (#9767) 2 years ago
Jonathan G Rennison e993afcd99 Store encrypted company password hashes in server saves
Restore when loading back into the server if server has required secret
2 years ago
Jonathan G Rennison 87f0c20bc0 Add setting flag to run string setting change callbacks on config load 2 years ago
glx22 3069f805e2 Fix #9766: Don't write uninitialised data in config file
(cherry picked from commit 50304f7164d5c88a42dcc1d09648c3ec8b2faab5)

Fixes: #344
3 years ago
Michael Lutz d85348b1d1 Codechange: Template the command callback function type to allow unpacked arguments. 3 years ago
Michael Lutz 13528bfcd0 Codechange: Un-bitstuff all remaining commands. 3 years ago
Michael Lutz ccefa76a46 Codechange: Template DoCommandPInternal. 3 years ago
Michael Lutz 0f64ee5ce1 Codechange: Template DoCommandP to automagically reflect the parameters of the command proc.
When finished, this will allow each command handler to take individually
different parameters, obliviating the need for bit-packing.
3 years ago
Michael Lutz 7048e1522f Codechange: Move flags in CommandProc in front of the command arguments. 3 years ago
Michael Lutz 33ca4f2b99 Codechange: Let the compile generate the master command table out of templated command traits.
This is using a non-intrusive type-traits like templated system, which
allows compile-time validation that the command table and the command
enum match up.
3 years ago
Michael Lutz a38bbefe1b Codechange: Untangle command code, flags and error string for DoCommand*. 3 years ago
Michael Lutz 549caca39c Codechange: Move command arguments to the back of the networked command function calls. 3 years ago
Jonathan G Rennison 583663bca1 Allow setting autosave interval to a custom number of days 3 years ago
Jonathan G Rennison 0cdaa8ef55 Remove use of std::from_chars and <charconv>
Replace it with another implementation to avoid compilation issues
on some platforms
3 years ago
Jonathan G Rennison 9ff8643fd9 Split config transparency settings into base and extra fields
This is to avoid incorrect settings when loading in trunk,
as the min/max clamping is not bitwise.
In particular having all options set in trunk when transparent vehicles
in tunnels was set.
3 years ago
Jonathan G Rennison 3373be7b0d Fix assertion failure in SyncCompanySettings 3 years ago
Jonathan G Rennison 3ef1a0943b Merge branch 'master' into jgrpp-beta
# Conflicts:
#	src/lang/chuvash.txt
#	src/lang/czech.txt
#	src/lang/english_AU.txt
#	src/lang/english_US.txt
#	src/lang/german.txt
#	src/lang/japanese.txt
#	src/lang/korean.txt
#	src/lang/latvian.txt
#	src/lang/russian.txt
#	src/tree_gui.cpp
#	src/vehicle.cpp
3 years ago
Jonathan G Rennison 324e90e5ac Merge branch 'master' into jgrpp-beta
# Conflicts:
#	src/lang/arabic_egypt.txt
#	src/lang/english.txt
#	src/lang/greek.txt
#	src/network/core/tcp_connect.cpp
#	src/network/network_client.cpp
#	src/network/network_client.h
#	src/pathfinder/npf/npf.cpp
#	src/pathfinder/yapf/yapf_ship.cpp
#	src/rail_gui.cpp
#	src/settings_table.cpp
#	src/settings_type.h
#	src/station_cmd.cpp
#	src/table/settings/gui_settings.ini
#	src/town_cmd.cpp
#	src/widgets/rail_widget.h
3 years ago
Jonathan G Rennison f764fcfb1f Merge branch 'master' into jgrpp-beta
# Conflicts:
#	src/console_cmds.cpp
#	src/debug.cpp
#	src/lang/vietnamese.txt
#	src/network/core/address.cpp
#	src/network/core/address.h
#	src/network/core/config.h
#	src/network/core/os_abstraction.cpp
#	src/network/core/os_abstraction.h
#	src/network/core/tcp_listen.h
#	src/network/core/udp.cpp
#	src/network/core/udp.h
#	src/network/network.cpp
#	src/network/network_client.cpp
#	src/network/network_gamelist.cpp
#	src/network/network_server.cpp
#	src/network/network_udp.cpp
#	src/newgrf.cpp
#	src/openttd.cpp
#	src/saveload/saveload.h
#	src/settings.cpp
#	src/settings_table.cpp
#	src/settings_type.h
#	src/table/settings/network_settings.ini
3 years ago
Jonathan G Rennison f54d69a60a Merge branch 'master' into jgrpp-beta
# Conflicts:
#	src/economy.cpp
#	src/elrail.cpp
#	src/graph_gui.cpp
#	src/linkgraph/linkgraph_gui.cpp
#	src/network/core/game_info.cpp
#	src/newgrf_station.cpp
#	src/saveload/saveload.cpp
#	src/settings.cpp
#	src/station_cmd.cpp
#	src/station_gui.cpp
#	src/strings_func.h
#	src/table/settings/network_settings.ini
#	src/table/settings/settings.ini
3 years ago
Jonathan G Rennison 62afd94b47 Merge branch 'master' into jgrpp-beta
# Conflicts:
#	src/company_cmd.cpp
#	src/economy.cpp
#	src/lang/swedish.txt
#	src/network/network_command.cpp
#	src/news_gui.cpp
#	src/saveload/saveload.h
#	src/script/api/script_list.cpp
#	src/video/cocoa/cocoa_v.mm
#	src/video/sdl2_v.cpp
3 years ago
Jonathan G Rennison d1f1a6942a Add support for loading trunk savegames versions 293 - 299 (12.0)
Use modified upstream saveload implementation for these versions
Re-arrange headers to support multiple saveload implementations
3 years ago
Jonathan G Rennison 81290df946 Merge branch 'master' into jgrpp-beta
# Conflicts:
#	src/lang/spanish.txt
#	src/network/core/tcp_content_type.h
#	src/network/network_content.cpp
#	src/saveload/cheat_sl.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload.h
#	src/saveload/station_sl.cpp
#	src/saveload/vehicle_sl.cpp
#	src/settings.cpp
#	src/settings_internal.h
#	src/table/settings.h.preamble
#	src/table/settings/company_settings.ini
#	src/table/settings/currency_settings.ini
#	src/table/settings/gameopt_settings.ini
#	src/table/settings/misc_settings.ini
#	src/table/settings/settings.ini
#	src/table/settings/win32_settings.ini
#	src/table/settings/window_settings.ini
3 years ago
Jonathan G Rennison ffef1c9e44 Merge branch 'master' into jgrpp-beta
# Conflicts:
#	src/saveload/cargopacket_sl.cpp
#	src/saveload/cheat_sl.cpp
#	src/saveload/company_sl.cpp
#	src/saveload/engine_sl.cpp
#	src/saveload/map_sl.cpp
#	src/saveload/order_sl.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload.h
#	src/saveload/station_sl.cpp
#	src/saveload/vehicle_sl.cpp
#	src/settings.cpp
#	src/settings_gui.cpp
#	src/settings_internal.h
#	src/stdafx.h
#	src/table/settings/settings.ini
#	src/town_cmd.cpp
#	src/vehicle.cpp
3 years ago
Jonathan G Rennison 544da99102 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
3 years ago
Jonathan G Rennison 406b81abb1 Merge branch 'master' into jgrpp-beta
# Conflicts:
#	src/economy.cpp
#	src/lang/traditional_chinese.txt
#	src/order_gui.cpp
#	src/settings.cpp
#	src/settings_internal.h
#	src/table/company_settings.ini
#	src/table/currency_settings.ini
#	src/table/gameopt_settings.ini
#	src/table/misc_settings.ini
#	src/table/settings.h.preamble
#	src/table/settings.ini
#	src/table/win32_settings.ini
#	src/table/window_settings.ini
3 years ago
Jonathan G Rennison 784fcbd1e7 Merge branch 'master' into jgrpp-beta
# Conflicts:
#	src/settings.cpp
#	src/settings_gui.cpp
#	src/settings_internal.h
#	src/table/currency_settings.ini
#	src/table/gameopt_settings.ini
#	src/table/misc_settings.ini
#	src/table/settings.h.preamble
3 years ago
Jonathan G Rennison 781aaa4fe5 Merge branch 'master' into jgrpp-beta
# Conflicts:
#	src/settings.cpp
#	src/settings_gui.cpp
#	src/settings_internal.h
#	src/table/company_settings.ini
#	src/table/currency_settings.ini
#	src/table/gameopt_settings.ini
#	src/table/misc_settings.ini
#	src/table/settings.h.preamble
#	src/table/settings.ini
#	src/table/win32_settings.ini
#	src/table/window_settings.ini
3 years ago
Jonathan G Rennison 4042480806 Merge branch 'jgrpp' into jgrpp-beta
# Conflicts:
#	src/settings.cpp
#	src/settings_gui.cpp
#	src/settings_internal.h
#	src/table/company_settings.ini
#	src/table/currency_settings.ini
#	src/table/gameopt_settings.ini
#	src/table/misc_settings.ini
#	src/table/settings.h.preamble
#	src/table/settings.ini
#	src/table/win32_settings.ini
#	src/table/window_settings.ini
3 years ago
Jonathan G Rennison 65c20edde7 Settings: Merge orderproc into guiproc 3 years ago
Jonathan G Rennison db11c1d927 Add setting description help text for extra asymmetric linkgraph modes
See also: #321
3 years ago
Jonathan G Rennison 47156122fa Settings: Add a guiproc callback for general settings GUI operations 3 years ago
Jonathan G Rennison fd605e3cf3 Merge branch 'master' into jgrpp-beta
# Conflicts:
#	.github/workflows/commit-checker.yml
#	src/company_cmd.cpp
#	src/console_cmds.cpp
#	src/crashlog.cpp
#	src/lang/english.txt
#	src/lang/german.txt
#	src/lang/indonesian.txt
#	src/lang/japanese.txt
#	src/lang/korean.txt
#	src/lang/swedish.txt
#	src/linkgraph/linkgraphjob.cpp
#	src/linkgraph/mcf.cpp
#	src/network/core/tcp.cpp
#	src/network/core/tcp.h
#	src/network/core/tcp_game.h
#	src/network/core/udp.h
#	src/network/network.cpp
#	src/network/network_admin.cpp
#	src/network/network_admin.h
#	src/network/network_chat_gui.cpp
#	src/network/network_client.cpp
#	src/network/network_client.h
#	src/network/network_func.h
#	src/network/network_internal.h
#	src/network/network_server.cpp
#	src/network/network_server.h
#	src/newgrf.cpp
#	src/newgrf_station.cpp
#	src/order_gui.cpp
#	src/rail_cmd.cpp
#	src/saveload/saveload.cpp
#	src/settings.cpp
#	src/settings_gui.cpp
#	src/settings_internal.h
#	src/settings_type.h
#	src/station_cmd.cpp
#	src/stdafx.h
#	src/table/currency_settings.ini
#	src/table/misc_settings.ini
#	src/table/settings.h.preamble
#	src/table/settings.ini
#	src/terraform_cmd.cpp
#	src/timetable_gui.cpp
#	src/train_cmd.cpp
#	src/tree_cmd.cpp
#	src/water_cmd.cpp
3 years ago
Jonathan G Rennison da1ac73c02 Merge commit 'f1dfa661a1898cde06a38ab4cb230c95912b245b' into jgrpp-beta
# Conflicts:
#	src/lang/estonian.txt
#	src/lang/hungarian.txt
#	src/network/core/game_info.cpp
#	src/network/core/game_info.h
#	src/network/core/packet.h
#	src/network/network.cpp
#	src/network/network_client.cpp
#	src/network/network_server.cpp
#	src/network/network_udp.cpp
#	src/openttd.cpp
#	src/string_func.h
3 years ago
Rubidium 92559e6f3a Fix #9388: thread unsafe use of NetworkAdminConsole/IConsolePrint 3 years ago
Jonathan G Rennison 16f2ef227b Store tunnel/bridge signal spacing on tile, adjust spacing to fit length 3 years ago
Loïc Guilloux 8d2162ba2d
Fix b6a116a: convert server_advertise to server_game_type in config file (#9515) 3 years ago
Jonathan G Rennison b2ef6c0de8 Add implementation of multi-aspect signalling and GRF support
Requires realistic braking

See: #247
3 years ago
Rubidium 1c8f4bfaef Fix #9388: thread unsafe use of NetworkAdminConsole/IConsolePrint
(cherry picked from commit d7a0e80fc18b689455eaca09883fccbcc722d7e3)

# Conflicts:
#	src/debug.cpp
#	src/debug.h
#	src/table/settings/gui_settings.ini

See: https://github.com/OpenTTD/OpenTTD/pull/9456
3 years ago
Jonathan G Rennison d01cfa8c08 Update template vehicle properties when freight multiplier or accel model changed 3 years ago
Rubidium c71f06e59b Feature: parse the console settings the same way as config settings
Now you can use things like `set server_game_type public` instead of having to
guess the number, which would not be written into the configuration file nor
would it be shown when doing `set server_game_type`.
3 years ago
Rubidium 178ea3196b Remove: includes to network/core/config.h from headers when only three cpp files need it 3 years ago
Rubidium f6955a304c Fix: ensure no more than the allowed number of NewGRFs are loaded from the configuration 3 years ago
Rubidium 01139d3368 Codechange: access the name of a setting via an accessor function 3 years ago
glx22 89ab8b79a5 Codechange: Remove FOR_EACH_SET_BIT 3 years ago
Patric Stout 8f5d0ecde3
Codechange: split settings.ini over several files (#9421)
This reduced the load on compilers, as currently for example MacOS
doesn't like the huge settings-tables.

Additionally, nobody can find settings, as the list is massive and
unordered. By splitting it, it becomes a little bit more sensible.
3 years ago
Rubidium 7e7a4aad72 Codechange: split off the settings saveload code from the main settings handling logic 3 years ago
rubidium42 25ca6a75bc Codechange: split off the settings table and all the callbacks from the main settings handling logic 3 years ago
glx22 b4aedc8bee Codechange: ensure xxx_setting_tables are initialised after their content 3 years ago
Patric Stout cdb3dd0493 Add: store headers for most savegame chunks
When a header is added, the chunk changes from CH_ARRAY type to
CH_TABLE type.
3 years ago
Patric Stout 7dd5fd6ed4 Feature: framework to make savegames self-descriptive
We won't be able to make it fully self-descriptive (looking at you
MAP-chunks), but anything else can. With this framework, we can
add headers for each chunk explaining how each chunk looks like
in detail.

They also will all be tables, making it a lot easier to read in
external tooling, and opening the way to consider a database
(like SQLite) to use as savegame format.

Lastly, with the headers in the savegame, you can freely add
fields without needing a savegame version bump; older versions
of OpenTTD will simply ignore the new field. This also means
we can remove all the SLE_CONDNULL, as they are irrelevant.

The next few commits will start using this framework.
3 years ago
Patric Stout 75b6051b7a Change: move sensitive information to secrets.cfg and private information to private.cfg
We often ask people for their openttd.cfg, which now includes their
passwords, usernames, etc. It is easy for people to overlook this,
unwillingly sharing information they shouldn't.

By splitting this information over either private.cfg or secrets.cfg,
we make it more obvious they shouldn't be sharing those files, and
hint to what is inside them.
3 years ago
Patric Stout 4f3bf84af4 Codechange: simplify SaveVersionInConfig()
Clearly someone really wanted to generalize the function, but
in reality it makes it a lot longer than needed. Let's keep it
simple.
3 years ago
Patric Stout 66dc0ce196 Codechange: C++-ify the usage of IniFile in settings.cpp
Instead of creating the object on heap and use a pointer, create
the object on stack and use a guaranteed-not-null pointer.
The size of IniFile doesn't warrent the forcing to heap.

Additionally, use a subclass instead of a function to do some
initial bookkeeping on an IniFile meant to read a configuration.
3 years ago
Patric Stout a42251fc72 Codechange: move network-related settings out of settings.ini
This to prepare the code to split up network-related settings
into private / secrets / generic.
3 years ago
SamuXarick 003b6a0c85
Fix ea9715d: not all setting values were clamped properly (#9401) 3 years ago
Jonathan G Rennison 5fb3eb0bb9 Adjust signal speed restriction timeouts when date or day length changed 3 years ago
Jonathan G Rennison 3bba9ef37a Fix setting name 3 years ago
Jonathan G Rennison 879a23811f Clear state when setting changed 3 years ago
rubidium42 98e653dacc Fix #9386: compilers failing to compile with LTO by using variants instead of new + unique_ptr
With std::variant all memory can be figured out at compile time, so the compiler needs to keep track of fewer elements. It also saves out a unique_ptr and its memory management, over a slight impact for resolving a setting.
3 years ago
rubidium42 c93fcbcb28 Codechange: introduce helper to convert from the iterated type to the actual SettingDesc 3 years ago
rubidium42 f029fd0f3b Codechange: remove overloading on UpdateServiceInterval
One UpdateServiceInterval has two parameters to update the service interval for a vehicle type, the other for all vehicle types at once. Rename the latter to help with function resolution for the introduction of variants.
3 years ago
Jonathan G Rennison 3a67065332 Add a build public roads button to the scenario editor 3 years ago
Andreas Schmitt d718ba62ef Add option to sort tracks by category and speed (#282) 3 years ago
Jonathan G Rennison f042ca7f63 Add scope info logging to command change settings 3 years ago
Jonathan G Rennison eeece0928c Include setting name in command log for setting change commands 3 years ago
Patric Stout 8e91527251 Codechange: mark chunks that are not stored as CH_READONLY
This makes it easier to spot chunks that have a save_proc that
is a nullptr, but also prevents confusion, where it looks like
the CH_ type of a chunk has influence on how it is being read.
It is not, it is only used for saving.
3 years ago
Patric Stout 88edfd4ef1 Change: rework several CH_RIFF chunks to use CH_ARRAY instead
This adds two byte extra to those chunks, and might feel a bit
silly at first. But in later changes we will prefix CH_ARRAY with
a table header, and then this change shines.

Without this, we could still add headers to these chunks, but any
external reader wouldn't know if the CH_RIFF has them or not. This
way is much more practical, as they are now more like any other
chunk.
3 years ago
Rubidium d31a535c87 Cleanup: remove some unneeded c_str() calls 3 years ago
Patric Stout 4600d289b5 Codechange: ability to store structs and list of structs in savegames
The commits following this will use this new functionality.

Currently, a few places do this manually. This has as drawback that
the Save() and Load() code need to be in sync, and that any change
can result in (old) savegames no longer loading. In general, it is
annoying code to maintain.

By putting everything in a description table, and use that for
both Save() and Load(), it becomes easier to see what is going on,
and hopefully less likely for people to make mistakes.
3 years ago
Jonathan G Rennison 2cd1740c01 Merge PR #268 into jgrpp 3 years ago
Jonathan G Rennison fd4b5cc083 Add buttons to cargo payment graph to select x-axis
Save in misc settings
3 years ago
Jonathan G Rennison f438daa0bc Use localised units for payment graph X axis
Match quantities in graph title
3 years ago
rubidium42 eb6cdadc4d Codechange: replace IConsolePrintF with IConsolePrint and fmt formatting
Also make some strings more consistent with the rest of the console strings.
3 years ago
rubidium42 efd4ba4797 Change: unify the style of console error messages and convert to fmt
Always start with a capital, do not add "ERROR: " in front of it.
3 years ago
rubidium42 55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 3 years ago
rubidium42 bf500c39c9 Codechange: make the name of SettingDesc a std::string 3 years ago
rubidium42 ca9c50607e Codechange: use StrStartsWith/StrEndsWith when finding settings 3 years ago
Jonathan G Rennison 1002c6d9d2 Fix various compiler warnings
See: #267
3 years ago
Jonathan G Rennison 7aa63e9726 Update status bar sizing when changing date/time display settings 3 years ago
Patric Stout 1e564b333f
Codechange: make [Save|Load]Settings() behave more like other Save/Load code (#9335)
Prepare the full description and send it to SlObject. This does
require some code to be able to read to a SLE_VAR_NULL, like strings
etc, as there is no way to know their length beforehand.
3 years ago
Patric Stout 7572603c9d Codechange: remove the unused SLF_HEX flag 3 years ago
Patric Stout 648ee88a02 Codechange: merge guiflags and flags in settings .ini files
It was rather confusing which one was for what, especially as some
SaveLoad flags were settings-only. Clean up this mess a bit by
having only Setting flags.
3 years ago
Patric Stout 264991dfa5 Codechange: move SLF_NO_NETWORK_SYNC into settings
It is a settings-only flag, so don't pollute SaveLoad code with it.
3 years ago
Patric Stout 414e12d26b Codechange: move SLF_NOT_IN_SAVE into settings
It is a settings-only flag, so don't pollute SaveLoad code with it.
3 years ago
glx22 c27afdf3f6 Codechange: Remove FOR_ALL_CHUNK_HANDLERS
Co-Authored-By: Patric Stout <truebrain@openttd.org>
3 years ago
Patric Stout feb2ddbefa
Codechange: rename SettingGuiFlag to SettingFlag (#9332)
It is a lovely organicly grown enum, where it started off with
GUI-only flags, and after that a few flags got added that can be
considered GUI-only (the GUI disables/enables based on them), to
only have flags added that has nothing to do with the GUI.

So be less confusing, and rename them to what they do.

Additionally, I took this opportunity to rename 0ISDISABLED to
reflect what it really does.
3 years ago
Patric Stout 9fff00ba20
Codechange: C++-ify lists for SaveLoad (#9323)
Basically, this changes "SaveLoad *" to either:
1) "SaveLoadTable" if a list of SaveLoads was meant
2) "SaveLoad &" if a single entry was meant

As added bonus, this removes SL_END / SLE_END / SLEG_END. This
also adds core/span.hpp, a "std::span"-lite.
3 years ago
Patric Stout 0c96884700
Codechange: add a wrapper function to find all settings based on prefix (#9312) 3 years ago
Patric Stout e9e4588db1
Codechange: use setting name instead of index for HandleOldDiffCustom() (#9311) 3 years ago
Patric Stout d70fb74ac6
Codechange: use setting name instead of index for CmdChange(Company)Setting (#9306)
This is mostly done as there are now constraints on settings.ini you might not
expected. For example, conditional settings always have to come last, as otherwise
they would influence the index.
3 years ago
glx22 5799402f7a Codechange: Rename window related DeleteXXX to match new behaviour 3 years ago
rubidium42 ef991b1772 Codechange: [Network] Use std::string in CommandPacket 3 years ago
rubidium42 2e136285e1 Codechange: move from C-string to std::string for DoCommand 3 years ago
Patric Stout ca9a7df752
Codechange: rename str_validate to StrMakeValid(InPlace) (#9304)
This to be more explicit the function changes the value, and not
returns yes/no.
3 years ago
rubidium42 08308d808c Codechange: use separate pre and post callbacks for int settings 3 years ago
rubidium42 e2f5d9e561 Codechange: use separate pre and post callbacks for string settings 3 years ago
rubidium42 ea9715d970 Codechange: split Write_ValidateSetting to get separate functions for making ints valid and writing ints 3 years ago
rubidium42 208952f2ba Codechange: split Write_ValidateSetting to get separate functions for making strings valid and writing strings 3 years ago
rubidium42 8372c679e3 Codechange: add helper functions to read an int setting value 3 years ago
rubidium42 cf6b91f30f Codechange: do not use SettingDescBase directly when not needed 3 years ago
rubidium42 86c9ef8134 Codechange: remove SettingDescType in lieu of the actual classes 3 years ago
rubidium42 3bb6ce8827 Codechange: use initializer_lists for the settings tables
Not using vectors as those require copying from the initializer list and that
makes unique_ptrs to the actual SettingDesc objects later impossible.
3 years ago
rubidium42 8ffb4122df Codechange: just pass the SettingDesc to SetSettingValue and remove distinction between (non)company 3 years ago
rubidium42 e666a962b1 Codechange: let OneOfMany and ManyOfMany be their own classes as well 3 years ago
rubidium42 425d50372f Codechange: let SettingDesc extend SettingDescBase 3 years ago
rubidium42 860003458f Codechange: make BoolSettingDesc its own sub class 3 years ago
rubidium42 72ec81325b Cleanup: remove unneeded temporary variables and casts 3 years ago
rubidium42 0d6597a9e6 Codechange: move bits of SettingDesc down to the appropriate sub classes
And by doing so remove the hack where ints were put into pointers so "def" could either be an int or a string
3 years ago
rubidium42 f6723b53da Codechange: make parsing of IniItems overridable functions of SettingDesc 3 years ago
rubidium42 1f8ff0e4f9 Codechange: make Write_ValidateSetting a function of StringSettingDesc 3 years ago
rubidium42 be28c95b30 Codechange: make Write_ValidateSetting a function of IntSettingDesc 3 years ago
rubidium42 024e584904 Cleanup: use (config) formatting for console settings functions 3 years ago
rubidium42 c3cd4a683d Codechange: make formatting of values into strings a method of SettingDesc 3 years ago
rubidium42 91b3d697c5 Codechange: make SettingDesc an instance in the setting table to allow for sub classes 3 years ago
Jonathan G Rennison 3e8ee4f49f Remove "Disable vehicle image update" setting 3 years ago
rubidium42 0f062b3882 Codechange: clean up C-string support from settings 3 years ago
rubidium42 a032714dc4 Codechange: move script settings to std::string 3 years ago
rubidium42 c73d64adf9 Codechange: move passwords in settings to std::string 3 years ago
rubidium42 f219354f89 Change: further support for std::string in settings 3 years ago
rubidium42 6bca9e090d Codechange: add SetDParamStr that accepts std::string& 3 years ago
Peter Nelson a469b4f395 Fix: Recalculate padding and minimum sizes when GUI or Font zoom is changed.
(cherry picked from commit 4791ff2862)
3 years ago
rubidium42 e7581fd42d Change: [Network] Update server's NetworkServerGameInfo only when needed
Split the updating in a "static" version that only needs to be called when a new map is loaded or some settings are changed, and a "dynamic" version that updates everything that changes regularly such as the current game date or the number of spectators.
3 years ago
Jonathan G Rennison a9515456cb Merge branch 'master' into jgrpp
# Conflicts:
#	src/network/core/os_abstraction.h
#	src/network/core/tcp_content.h
#	src/network/core/udp.cpp
#	src/table/currency_settings.ini
#	src/table/settings.h.preamble
3 years ago
Peter Nelson 4791ff2862 Fix: Recalculate padding and minimum sizes when GUI or Font zoom is changed. 3 years ago
rubidium42 31c87ba908 Fix: truncating strings in settings could leave invalid Utf8 characters 3 years ago
rubidium42 0e449f20dc Codechange: writing and string validation to its own functions 3 years ago
rubidium42 b54d8a49fb Feature: allow non-ASCII currency separators 3 years ago
Jonathan G Rennison 76981ca8cd Fix setting console command min/max display with enum settings
Fixes: #240
3 years ago
Jonathan G Rennison 272e583478 Merge branch 'master' into jgrpp
# Conflicts:
#	src/lang/korean.txt
#	src/settings.cpp
3 years ago
Jonathan G Rennison d484c32d44 Reduce sensitivity of train overheated breakdown 3 years ago
PeterN 31c5b8fe0f
Fix: Invalidate cached vehicle colourmaps when changing liveries setting. (#9006) 3 years ago
Jonathan G Rennison 34e9c22c3d Hide unused climate threshold settings depending on climate threshold mode 3 years ago
Jonathan G Rennison f39b6f4ba3 Merge branch 'master' into jgrpp
# Conflicts:
#	src/cheat_gui.cpp
#	src/genworld_gui.cpp
#	src/landscape.cpp
#	src/lang/english.txt
#	src/saveload/afterload.cpp
#	src/screenshot.cpp
#	src/settings_gui.cpp
#	src/settings_internal.h
#	src/settings_type.h
#	src/table/settings.ini
#	src/tile_type.h
#	src/widgets/genworld_widget.h
3 years ago
Jonathan G Rennison 5e14b54a0c Merge branch 'master' into jgrpp 3 years ago
Jonathan G Rennison 912c62d749 Add timetable lateness/earliness conditional order 3 years ago
Patric Stout cafe4eed6e Feature: setting to indicate snow coverage for arctic climate (replaces snow line height)
Setting the snow coverage (in % of the map) makes a lot more sense
to the human, while still allowing the niche player to set (by
finding the correct %) a snow line height they like. This makes for
easier defaults, as it decoupled terrain height from amount of snow.

Maps can never be 100% snow, as we do not have sprites for coastal
tiles.

Internally, this calculates the best snow line height to approach
this coverage as close as possible.
3 years ago
reldred 67c256f437 Add PR #228: New configure town zone multipliers 3 years ago
Jonathan G Rennison 3f4333bcc8 Add setting to enable non-admin multiplayer clients to rename towns 3 years ago
Matt Kimber bcb3313e13
Feature: allow setting maximum zoom level at which sprites are drawn (#8604) 3 years ago
Jonathan G Rennison e95216b59d Merge branch 'master' into jgrpp
# Conflicts:
#	src/company_cmd.cpp
#	src/core/geometry_func.cpp
#	src/date.cpp
#	src/genworld_gui.cpp
#	src/gfx.cpp
#	src/object_gui.cpp
#	src/openttd.cpp
#	src/settings_type.h
#	src/video/allegro_v.cpp
#	src/video/dedicated_v.cpp
#	src/video/null_v.cpp
#	src/video/sdl2_v.cpp
#	src/video/sdl_v.cpp
#	src/video/win32_v.cpp
3 years ago
Michael Lutz 00c66e7096 Codechange: Allow early-load settings that are not misc settings. 3 years ago
Jonathan G Rennison efe382b35a If realistic braking can't be enabled, show an extra viewport on the blocking signal 3 years ago
Michael Lutz 6755ff63e1 Add: [OSX] Native font rendering without using FreeType. 3 years ago
Jonathan G Rennison 6c3e5642f8 Merge branch 'master' into jgrpp
# Conflicts:
#	cmake/CompileFlags.cmake
#	src/crashlog.cpp
#	src/fileio.cpp
#	src/fileio_func.h
#	src/fios_gui.cpp
#	src/ini_load.cpp
#	src/ini_type.h
#	src/lang/english.txt
#	src/lang/german.txt
#	src/lang/korean.txt
#	src/network/network_client.cpp
#	src/order_base.h
#	src/order_cmd.cpp
#	src/os/windows/win32.cpp
#	src/road_cmd.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload.h
#	src/settings.cpp
#	src/station_cmd.cpp
#	src/stdafx.h
#	src/table/settings.ini
#	src/tree_cmd.cpp
#	src/tree_gui.cpp
#	src/vehicle_base.h
#	src/video/cocoa/cocoa_v.mm
#	src/video/cocoa/event.mm
#	src/video/cocoa/wnd_quartz.mm
#	src/viewport.cpp
#	src/widgets/tree_widget.h
3 years ago
Jonathan G Rennison 9506a33443 Don't treat loading trains specially when enabling realistic braking 3 years ago
Jonathan G Rennison ed0ffb6220 Add feature: realistic train braking
Add setting to select train braking model.
3 years ago
Jonathan G Rennison 483ed2f468 Merge branch 'master' into jgrpp
# Conflicts:
#	.github/workflows/ci-build.yml
#	.github/workflows/commit-checker.yml
#	src/openttd.cpp
4 years ago
Michael Lutz dd138fc460 Codechange: Stringify config file paths. 4 years ago
Patric Stout c66bd18a10
Add: save openttd.cfg immediately on changing a setting (#8358)
Formally it was only done on exit. This means that if it crashes
changes in settings were not stored. This is often rather
frustrating. Additionally, targets (like emscripten) where people
are unlike to use "Exit Game", will never see their configuration
stored.

The drawback is that on every setting change there is some minor
I/O of writing the ini file to disk again.
4 years ago
Jonathan G Rennison 4da3cfcf56 Merge branch 'master' into jgrpp
# Conflicts:
#	CMakeLists.txt
#	src/bootstrap_gui.cpp
4 years ago
Charles Pigott cfa1b1e006 Fix: Compile warnings when asserts are disabled 4 years ago
Jonathan G Rennison c4b09e4780 Fix map-mode viewports not updating when changing company and land colours 4 years ago
Jonathan G Rennison cde5e8c79d Add setting to disable continuously updating NewGRF vehicle image 4 years ago
Jonathan G Rennison ffe3c769a3 Add road tile cached one way state, one way road section detection 4 years ago
Jonathan G Rennison bbbda0739b Add third DoCommand parameter p3 4 years ago
Jonathan G Rennison a474e71243 Viewport: Cache landscape pixels in map mode
Avoid invalidating landscape pixels for non-landscape updates
(vehicles, overlays, etc.)
4 years ago
Jonathan G Rennison 45386efcd0 Script: Allow changing ops limit and memory limit settings in game 4 years ago
Jonathan G Rennison f26143f063 Add setting for alternative linkgraph overlay colour schemes 4 years ago
Jonathan G Rennison f5e9805b10 Store time display settings both in savegame and client, add setting 4 years ago
Jonathan G Rennison f8d6e781ba Merge branch 'master' into jgrpp
# Conflicts:
#	projects/openttd_vs140.vcxproj.filters
#	projects/openttd_vs141.vcxproj.filters
#	projects/openttd_vs142.vcxproj.filters
#	src/base_consist.h
#	src/company_base.h
#	src/newgrf_config.cpp
#	src/newgrf_config.h
#	src/openttd.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload.h
#	src/saveload/station_sl.cpp
#	src/settings.cpp
#	src/signs_base.h
#	src/string.cpp
#	src/string_func.h
#	src/table/misc_settings.ini
#	src/table/settings.h.preamble
#	src/town_cmd.cpp
#	src/vehicle.cpp
#	src/vehicle_cmd.cpp
#	src/video/cocoa/cocoa_v.mm
#	src/video/null_v.cpp
4 years ago
Michael Lutz a49fdb7ebb Codechange: Store base set related texts in std::strings. 4 years ago
Michael Lutz 715aa67a9c Codechange: Use std::string in INI file parsing. 4 years ago
Jonathan G Rennison eef6ad7b2a Crash log: Save config file in new crash save chunk 4 years ago
Jonathan G Rennison ab99c16601 Add support for money cheat in multiplayer
Add a setting for whether this is permitted by multiplayer clients
4 years ago
Jonathan G Rennison 8956b1ab02 Improve performance of tunnel rendering in viewport map mode 4 years ago
Jonathan G Rennison babe98cdb1 Merge branch 'master' into jgrpp
# Conflicts:
#	src/network/network_server.h
#	src/pathfinder/yapf/yapf_road.cpp
#	src/viewport.cpp
4 years ago
Johannes E. Krause 107283748a Feature: SLF_HEX to print hexadecimal numbers in the config file 4 years ago
Johannes E. Krause f389d66e36 Fix: Loading SDT_INTLIST similar to loading SDT_NUMX 4 years ago
Johannes E. Krause 76eab18f02 Fix: Saving SDT_INTLIST handle unsigned values properly 4 years ago