Commit Graph

2482 Commits (2eecf19edb584529802680a48b11bac7b8cde091)

Author SHA1 Message Date
Jonathan G Rennison 5698507d0b Change station cargo history storage format
Use uint16 to avoid truncation issues
Don't reserve memory for unused cargoes
Store history as ring buffer
Update history graph immediately on storage date
Show total waiting cargo
3 years ago
Jonathan G Rennison c4a596b756 Fix missing file from fb0403dc 3 years ago
Jonathan G Rennison fb0403dcee Add save/load support for train speed adaptation 3 years ago
Jonathan G Rennison 4d0cda12bd Fix saving one byte at a time in Save_SPRG 3 years ago
rubidium42 f7f1d530b8 Codechange: instead of "naked" initializer lists, declare the type in the saveload macros
This to help variant's constructor to be able to resolve the constructor of the setting
3 years ago
Andreas Schmitt 9b1783809d Add station cargo history 3 years ago
Andreas Schmitt e1214a6d8b Fix some type conversion warnings 3 years ago
Jonathan G Rennison 3e66ffead0 Saveload: Allow threaded saves in network server mode 3 years ago
Jonathan G Rennison 87948d8029 Thread: Adjust checks for whether current thread is the game thread 3 years ago
Rubidium 281a65b3e1 Cleanup: simplify some boolean expressions 3 years ago
Rubidium 357af686dc Cleanup: use true/false instead of 1/0 where applicable 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 4c4b55ecbd Change: rework GLOG chunk to be more like the rest
Basically it is very similar to Vehicles, where there first is
a type field, followed by data of that type. So this commit makes
it looks like how Vehicles solved that.
This removes a lot of custom "keeping track of length" stuff.
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
Patric Stout b9ab9e4d05 Codechange: add the ability to save/load a std::vector
std::vector<bool> is not possible, as .. that is a nice special
case in C++.

This new type will be used in next commit.
3 years ago
Patric Stout 97b94bdc9a Change: prefix SL_ARR with the length of the array
This means that during loading we can validate that what is saved
is also that what is expected. Additionally, this makes all list
types similar to how they are stored on disk:
First a gamma to indicate length, followed by the data.
The size still depends on the type.
3 years ago
Patric Stout f67af5cbe5 Codechange: make it more obvious SlArray supports SLE_VAR_NULL
In the end, the code was already doing the right thing, but a few
functions deep, and not really obvious. When validating what objects
can handle SLE_VAR_NULL, it is nicer to just have this obvious.
3 years ago
Patric Stout d5cda58158 Codechange: use SL_NULL if you want to store null-bytes or load to nothing
Using SL_ARR for this gives us a bit of trouble later on, where we
add a length-field to SL_ARR. This of course is not the intention
of SLE_CONDNULL. So better seperate it.
3 years ago
Patric Stout 0d2e3437e3 Change: switch SL_DEQUE and SL_REFLIST length field to a gamma
The current SaveLoad is a bit inconsistent how long a length field
is. Sometimes it is a 32bit, sometimes a gamma. Make it consistent
across the board by making them all gammas.
3 years ago
Patric Stout 75e7451151 Change: indicate in the savegame if a SL_STRUCT contains any data
This helps external tooling to understand if a SL_STRUCT should
be skipped when reading. Basically, this transforms an SL_STRUCT
into a SL_STRUCTLIST with either 0 or 1 length.
3 years ago
Patric Stout a146bcfe93 Change: store length of SL_STRUCTLIST in the savegame
This wasn't consistently done, and often variables were used that
were read by an earlier blob. By moving it next to the struct
itself, the code becomes a bit more self-contained and easier to
read.

Additionally, this allows for external tooling to know how many
structs to expect, instead of having to know where to find the
length-field or a hard-coded value that can change at any moment.
3 years ago
Patric Stout 7b135a8269 Codechange: use SLE_STRUCT(LIST) for Linkgraph chunks 3 years ago
Patric Stout 5cd0c65787 Codechange: move Save/Load functions of same chunk next to each other 3 years ago
Patric Stout af3aba7a88 Codechange: use SLE_STRUCT(LIST) for GameScript chunks 3 years ago
Patric Stout aa02bf27f6 Codechange: use as much of STNN code for STNS as possible
There was a lot of code duplication for no real reason. Now with
SLEG_STRUCT support, we can just re-use the code, hopefully making
it easier for future-us to make changes to this, without breaking
everything for old games.
3 years ago
Patric Stout 0bdca02bdf Codechange: use SLE_STRUCT(LIST) for Station chunks 3 years ago
Patric Stout af43fc3d62 Codechange: use SLE_STRUCT(LIST) for Company chunks 3 years ago
Patric Stout 0bb1d2fa8e Codechange: use SLE_STRUCT(LIST) for Town chunks 3 years ago
Patric Stout 4e4720f217 Codechange: remove the special station/vehicle code from SaveLoad
With the new SLEG_STRUCT it is much easier to embed a struct
in a struct, where the sub-struct has limitations on when it is
being used.
This makes both the code easier to read (less magic) and avoids
the SaveLoad needing to know all these things about Stations
and Vehicles.
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
Patric Stout 1e432fbd71
Fix 81062163: for (really) old games, station bus/truck station cache was not updated (#9366) 3 years ago
rubidium42 55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 3 years ago
Jonathan G Rennison 1002c6d9d2 Fix various compiler warnings
See: #267
3 years ago
Tyler Trahan d09210e1c6 Feature: Configurable subsidy duration 3 years ago
Patric Stout 174952440a Codechange: rework CHTS-chunk save/load to be more like the others 3 years ago
Patric Stout 8f323855b1 Codechange: rename SL_LST to SL_REFLIST to highlight the "reference" part
You can easily mistake SlList / SL_LST to be a list of SL_VAR, but
it is a list of SL_REF. With this rename, it hopefully saves a few
people from "wtf?" moments.
3 years ago
Patric Stout aa6443d57a Codechange: refactor SlList to use SlStorageHelper 3 years ago
Patric Stout 23857af693 Codechange: refactor SlDequeueHelper to work with unsigned and be more generic
Future additions will start using it for std::list too.
3 years ago
Patric Stout a2147d437e Codechange: use wrappers to get Var[Mem|File]Type, instead of GB() 3 years ago
Patric Stout fba86f711f Codechange: move GetVariableAddress inside SlObjectMember
Also move it to static, as nobody else is using it.
3 years ago
Patric Stout f997eb6ca4
Fix: compatible NewGRFs in crash-log reported wrong md5 (#9340)
The text suggests it reports the original md5, but it does in fact
report the replaced md5. Now it reports both.
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 28e90769f7 Codechange: use "[[maybe_unused]]" instead of a wide variety of other ways we had
While at it, replace OTTD_ASSERT with WITH_ASSERT, as this
is always set if assert() is valid. No matter if NDEBUG is set
or not.
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 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 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 425d50372f Codechange: let SettingDesc extend SettingDescBase 3 years ago
Jonathan G Rennison 0579c8755c Add tracerestrict action: No PBS signal back PF penalty 3 years ago
Jonathan G Rennison 6d3a1935a0 Fix "(undefined string)" message when SlError called when saving 3 years ago
Jonathan G Rennison 3ecda2b735 Fix handling of SlError when called from game thread 3 years ago
Jonathan G Rennison a15e26f369 NewGRF: Elide unmasked vehicle callbacks where possible
This includes:
* CBID_VEHICLE_32DAY_CALLBACK
* CBID_VEHICLE_REFIT_COST
* CBID_VEHICLE_MODIFY_PROPERTY
  This is on a per-property basis

The main benefit of this is to avoid callbacks not handled by the
vehicle's current sprite group from using the full graphics chain as
the "default" branch in the callback switch.
In the case where the graphics chain is long/expensive, a lot of work
had to be done before a callback failure result was eventually returned.
3 years ago
rubidium42 44ca7d9377 Change: Use gender-neutral pronouns 3 years ago
rubidium42 ddaedaf32a Fix: empty undocumented branches 3 years ago
Rubidium bb9121dbd4 Fix: comparison of narrow type to wide type in loop (potential for infinite loops) 3 years ago
PeterN 66cac92028 Fix #9202: Invalid test for unset NewGRF override mapping. (#9226)
(cherry picked from commit 3d9436bd75)
3 years ago
PeterN f52da3de3a Codechange: Don't save unused NewGRF override mappings. (#9202)
(cherry picked from commit 69e5da0b54)
3 years ago
William Davis 879de9781b Change: Use gender-neutral pronouns in console command messages (and comments) (#9203)
(cherry picked from commit 881e1da51d)
3 years ago
Jonathan G Rennison 2e28bc8e6a Tracerestrict: Add engine class conditional 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 95386dc2b8 Codechange: move misc settings to std::string 3 years ago
glx22 38c97e1492 Codechange: Replace TILE_AREA_LOOP with range-based for loops 3 years ago
Patric Stout b136e65cf9
Change: reworked the debug levels for network facility (#9251)
It now follows very simple rules:
0 - Fatal, user should know about this
1 - Error, but we are recovering
2 - Warning, wrong but okay if you don't know
3 - Info, information you might care about
4 -
5 - Debug #1 - High level debug messages
6 - Debug #2 - Low level debug messages
7 - Trace information
3 years ago
PeterN 3d9436bd75
Fix #9202: Invalid test for unset NewGRF override mapping. (#9226) 3 years ago
PeterN 69e5da0b54
Codechange: Don't save unused NewGRF override mappings. (#9202) 3 years ago
William Davis 881e1da51d
Change: Use gender-neutral pronouns in console command messages (and comments) (#9203) 3 years ago
glx22 8333323090 Codechange: Replace FOR_ALL_ROADTRAMTYPES with range-based for loops
(cherry picked from commit 2feb801e56)
3 years ago
PeterN 43fe7463ba Fix: Update text effect size when font zoom is changed. (#9174)
(cherry picked from commit 18651dd8b1)
3 years ago
Loïc Guilloux 88bc7bd235 Fix: [MinGW] Set minimum OS version to Windows XP (#9135)
(cherry picked from commit 356bbbb90a)
3 years ago
Jonathan G Rennison 95ca147445 Add cheat: town local authority ratings fixed as Outstanding 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
glx22 2feb801e56 Codechange: Replace FOR_ALL_ROADTRAMTYPES with range-based for loops 3 years ago
PeterN 18651dd8b1
Fix: Update text effect size when font zoom is changed. (#9174) 3 years ago
Loïc Guilloux 356bbbb90a
Fix: [MinGW] Set minimum OS version to Windows XP (#9135) 3 years ago
Jonathan G Rennison 253772e9af Merge branch 'master' into jgrpp
# Conflicts:
#	CMakeLists.txt
#	COMPILING.md
#	src/console.cpp
#	src/console_cmds.cpp
#	src/console_internal.h
#	src/rev.cpp.in
3 years ago
Jonathan G Rennison ba418f9d0d Merge branch 'master' into jgrpp
# Conflicts:
#	src/lang/simplified_chinese.txt
#	src/network/core/tcp_content.cpp
#	src/network/core/udp.cpp
#	src/network/network_server.cpp
#	src/saveload/linkgraph_sl.cpp
#	src/table/gameopt_settings.ini
3 years ago
peter1138 a05bc04b63 Feature: Per-group wagon removal flag. 3 years ago
peter1138 27a956ba62 Codechange: Replace Group::replace_protection with Group::flags 3 years ago
Jonathan G Rennison 14636d2512 Check multi-tile ID-translated houses after house ID limit change
(Or when reloading NewGRFs)
If an overriding house type which newly fit in the limit changed the
tile layout, existing houses on the map could have the wrong layout

See: #243
3 years ago
Jonathan G Rennison 6a3e87114a Add a min_version parameter to SlXvIsFeatureMissing 3 years ago
Milek7 aade177d79
Fix: Corrupted savegame could cause heap corruption by writing outside link graph edge matrix. (#9046) 3 years ago
Milek7 da55286c2c
Fix: Corrupted savegame could crash the game by providing invalid gamelog enums. (#9045) 3 years ago
Jonathan G Rennison b514d29db1 Replace TrainCache::cached_tilt with a flags field 3 years ago
Jonathan G Rennison cb5c6902db Fix order dest refcount mismatch warning when loading very old savegames 3 years ago
Jonathan G Rennison 9e3ac646fa Fix desync warning messages when loading game with non-matching train braking model 3 years ago
Jonathan G Rennison e623560120 Fix 4c2e42fa: Wrong town caches when loading pre more-houses savegame 3 years ago
Jonathan G Rennison 7faa279250 Fix 26a123b7: Wrong variable size in VENC chunk saver 3 years ago
Jonathan G Rennison 6c62bce1ac Bump water flooding savegame version and clear states on load 3 years ago
Jonathan G Rennison 737b538492 Bump savegame version, copy town to city multipliers for old savegames 3 years ago
Jonathan G Rennison d7b23733b3 Bump realistic braking savegame version 3 years ago
Jonathan G Rennison 5d88030feb
Merge pull request #238 from reldred/newhouses_limits_tweaks
Extra House IDs
3 years ago
Jonathan G Rennison 4c2e42fae0 Add savegame conversion and version bump for more house IDs 3 years ago
Jonathan G Rennison f1cab62140 Add cheat to fix station ratings at 100% 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 26a123b708 Realistic braking: Cache offset of centre of mass of train 3 years ago
Jonathan G Rennison 912c62d749 Add timetable lateness/earliness conditional order 3 years ago
Patric Stout 13a5264438 Fix: store the recent new game_creation settings in savegames
This allows us to later on see what someone did, and makes sure
that "restart" command still knows how the game was created.
3 years ago
Patric Stout 1a1049bc0d Change: rename setting "max_heightlevel" to "map_height_limit"
This better reflects what it is, and hopefully removes a bit of
the confusion people are having what this setting actually does.

Additionally, update the text on the setting to better inform
users what it is doing exactly, so they can make an educated
decision on how to change it.

Next commit will introduce an "auto" value, which should be the
new default. The rename has as added benefit that everyone will
start out on the "auto" value.
3 years ago
Jonathan G Rennison a670e369db Add setting for no vehicles introduced after given year 3 years ago
Patric Stout 9bfa7198fd
Change: Heading for 1.12 now (#8862) 3 years ago
Jonathan G Rennison 4361a6dbf4 Avoid undefined behaviour const_casting std::string c_str()
Use non-const data() instead

See: #224
3 years ago
Jonathan G Rennison a7ed477185 Log savegame compression format used at debug level sl 3 3 years ago
Jonathan G Rennison edeced8fce Zstd: Enable zstd for autosaves
See also: https://github.com/OpenTTD/OpenTTD/pull/8773
3 years ago
Jonathan G Rennison c2ae7580e0 Zstd: Use zstd for network joins if supported at both ends
See also: https://github.com/OpenTTD/OpenTTD/pull/8773
3 years ago
Jonathan G Rennison 922e8554de Zstd: Fix infinite loop when input exhausted 3 years ago
Jonathan G Rennison ee7f5ad44f Zstd: Indentation fixes 3 years ago
dP b284d34277 Add: Support Zstandard(zstd) savegame compression
(cherry picked from commit 6f0aeaf2c5436550c93205e704624957e9abc969)
3 years ago
Patric Stout f183ded9fe Add: settings to limit your fast-forward game speed
By default this setting is set to 2500% normal game speed.

(cherry picked from commit c3dc27e37e)

# Conflicts:
#	src/gfx.cpp
#	src/gfx_func.h
#	src/settings_type.h
#	src/video/cocoa/cocoa_v.mm
#	src/video/video_driver.cpp
#	src/video/win32_v.cpp
3 years ago
Patric Stout c3dc27e37e Add: settings to limit your fast-forward game speed
By default this setting is set to 2500% normal game speed.
3 years ago
Jonathan G Rennison c37beb78ee Check for broken custom bridge head states, and bump save version 3 years ago
Jonathan G Rennison 2e20da40ed Cache current value of snow line height 3 years ago
Jonathan G Rennison f595696e97 Add map bit to suppress water flooding checks
Set if all neighbour tiles are also water
This reduces the overhead of flood checks on large maps
3 years ago
Michael Lutz 7845434270 Codechange: Don't use cpp_offsetof in the save/load code.
Many of the member variables that are used in save/load are inside types
that are not standard layout types. Using pointer arithmetics to determine
addresses of members inside types that are not standard layout is generally
undefined behaviour. If we'd use C++17, it is conditionally supported, which means
each compiler may or may not support it. And even then using it for individual
array elements is syntactically not supported the the standard offsetof function.

Unfortunately, the trickery employed for saving linkgraph settings causes quite some
clutter in the settings ini files.
3 years ago
Michael Lutz 9c9292949f Codechange: Don't use cpp_offsetof in the TTO/TTD savegame loader.
Many of the member variables that are used in the oldloader are inside types
that are not standard layout types. Using pointer arithmetics to determine
addresses of members inside types that are not standard layout is generally
undefined behaviour. If we'd use C++17, it is conditionally supported, which means
each compiler may or may not support it. And even then using it for individual
array elements is syntactically not supported the the standard offsetof function.
3 years ago
Jonathan G Rennison aff89b61f5 Add tracerestrict reserved tiles ahead conditional 3 years ago
Jonathan G Rennison 35d720b0ad Add tracerestrict PBS end signal conditional
This is for realistic braking long reserve
3 years ago
Jonathan G Rennison a0e9baac54 Bump more_cond_orders savegame version due to 8a814bbf 3 years ago
Jonathan G Rennison d42ad99688 Add conditional order for current time/date 3 years ago
Jonathan G Rennison 650d5e014e Merge branch 'master' into jgrpp
# Conflicts:
#	src/ai/ai_gui.cpp
#	src/company_cmd.cpp
#	src/lang/estonian.txt
#	src/lang/german.txt
#	src/lang/hungarian.txt
#	src/lang/korean.txt
#	src/lang/slovak.txt
#	src/main_gui.cpp
#	src/video/sdl2_v.cpp
3 years ago
Jonathan G Rennison 7154f8859d Merge tag '1.11.0-beta1' into jgrpp
# Conflicts:
#	src/console_cmds.cpp
#	src/gfx_func.h
#	src/industry.h
#	src/lang/czech.txt
#	src/lang/estonian.txt
#	src/lang/german.txt
#	src/lang/indonesian.txt
#	src/lang/japanese.txt
#	src/lang/norwegian_bokmal.txt
#	src/lang/russian.txt
#	src/lang/slovak.txt
#	src/saveload/saveload.h
#	src/station_gui.cpp
#	src/town_gui.cpp
#	src/vehicle_gui.cpp
#	src/video/sdl2_v.cpp
#	src/waypoint_gui.cpp
3 years ago
Jonathan G Rennison b7ddd486cf Merge branch 'master' into jgrpp
# Conflicts:
#	cmake/CompileFlags.cmake
#	src/aircraft_cmd.cpp
#	src/blitter/32bpp_anim.cpp
#	src/cargopacket.cpp
#	src/cheat_gui.cpp
#	src/company_cmd.cpp
#	src/company_gui.cpp
#	src/core/pool_func.hpp
#	src/date.cpp
#	src/economy.cpp
#	src/error_gui.cpp
#	src/ground_vehicle.cpp
#	src/ground_vehicle.hpp
#	src/group_gui.cpp
#	src/industry_cmd.cpp
#	src/lang/dutch.txt
#	src/lang/french.txt
#	src/lang/german.txt
#	src/linkgraph/linkgraph_gui.cpp
#	src/linkgraph/mcf.cpp
#	src/network/network_content.cpp
#	src/network/network_server.cpp
#	src/network/network_udp.cpp
#	src/newgrf_engine.cpp
#	src/newgrf_station.cpp
#	src/order_cmd.cpp
#	src/order_gui.cpp
#	src/pathfinder/follow_track.hpp
#	src/pathfinder/yapf/yapf_common.hpp
#	src/saveload/saveload.cpp
#	src/settings_gui.cpp
#	src/station_cmd.cpp
#	src/station_kdtree.h
#	src/string_func.h
#	src/table/settings.ini
#	src/tgp.cpp
#	src/timetable_cmd.cpp
#	src/timetable_gui.cpp
#	src/toolbar_gui.cpp
#	src/town_cmd.cpp
#	src/train_cmd.cpp
#	src/train_gui.cpp
#	src/tree_gui.cpp
#	src/tunnelbridge_cmd.cpp
#	src/vehicle.cpp
#	src/vehicle_gui.cpp
#	src/video/sdl2_v.cpp
#	src/video/sdl_v.cpp
#	src/video/win32_v.cpp
#	src/viewport.cpp
#	src/viewport_sprite_sorter_sse4.cpp
#	src/window.cpp
3 years ago
Jonathan G Rennison d978ffcb59 Fix train braking model not being set to original on load 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 33d9e48bcf Add setting for inflation dates mode 3 years ago
Jonathan G Rennison 39df1c49a1 Merge branch 'master' into jgrpp
# Conflicts:
#	src/fileio.cpp
#	src/group_gui.cpp
#	src/industry.h
#	src/lang/korean.txt
#	src/linkgraph/linkgraphjob.cpp
#	src/linkgraph/linkgraphjob.h
#	src/linkgraph/linkgraphschedule.cpp
#	src/linkgraph/linkgraphschedule.h
#	src/openttd.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload.h
#	src/town_cmd.cpp
#	src/vehicle_gui.cpp
#	src/vehicle_gui_base.h
3 years ago
Jonathan G Rennison 43980639de Merge branch 'master' into jgrpp
# Conflicts:
#	.gitignore
#	CMakeLists.txt
#	src/3rdparty/optional/optional.hpp
#	src/group_cmd.cpp
#	src/industry_cmd.cpp
#	src/misc_gui.cpp
#	src/video/sdl2_v.cpp
3 years ago
Jonathan G Rennison ed0ffb6220 Add feature: realistic train braking
Add setting to select train braking model.
3 years ago
glx22 6b8ad5a9b1 Change: Apply some consistency to singleplayer related comments 3 years ago
dP bab7de6cf2 Feature: Allow GameScripts to add additional text to Industry view window 3 years ago
Michael Lutz a190b00af1 Fix #8589, 653e7fa548: Motion counter is NewGRF-visible but not saved, leading to desyncs. (#8591)
(cherry picked from commit 7da224d29d)
3 years ago
Michael Lutz 7da224d29d
Fix #8589, 653e7fa548: Motion counter is NewGRF-visible but not saved, leading to desyncs. (#8591) 3 years ago
Matt Kimber 40d5fe1631
Fix eeb88e8: Trains reversed while paused do not correctly update sprite bounds (#8540) 3 years ago
Jonathan G Rennison 515aeb04e0 TBTR: Add support for vehicle reversed flag 4 years ago
Patric Stout ef6b17baf7 Fix 2fd871e2af5: load correct ending-year for old (pre 0.7) savegames
Despite what it looked like, you could never really change the
ending-year (it was always reset to 2050 on start-up). See commit
683b65ee1 for details. As a side-effect, the variable that was
suppose to store the ending-year was just zero, never containing
a real ending-year.
4 years ago
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 4 years ago
Matt Kimber 9b28b15e67 Codechange: create MutableSpriteCache to remove the need to cast Vehicle to a mutable type in render methods 4 years ago
Patric Stout 8596b43b2b
Codechange: move some DEBUG-levels and remove some others in saveload routine (#8474)
When running with -dsl=2 it is very easy to miss important information
as there was a lot of noise in between too. This tunes the debug
levels a bit to be less noisy while keeping the important bits.
4 years ago
Jonathan G Rennison 5721790c5d Fix assert failure in DoStartupNewCompany when called from AfterLoadGame 4 years ago
Pavel Stupnikov f39a00d676 Feature: Set exclusive access to industry from GS (#8115)
(cherry picked from commit 9a45a0f535)
4 years ago
Niels Martin Hansen 4d97fbc814 Feature: Influence industry production changes from GS (#7912)
(cherry picked from commit b7751c483e)
4 years ago
Patric Stout 488187a423 Fix: next 67 savegame versions are used in PatchPacks; skip them (#8411)
Various of PatchPacks (Spring 2013, Joker, ChillPP) used versions
slightly higher than ours. Of course, as time went by, this
caught up with us, and we are now almost pushing a new version
that would conflict with them. To avoid users creating unneeded
issues about "why can I not load my savegame", lets be ahead of
the curve and flat-out refuse to load them.

Version-wise, this is totally fine. We have ~32k versions to go
before we run out (0x8000 is masked by JGRPP; we should avoid
using that). At the rate we bump savegames, this is not going to
happen in any sane reality.

(cherry picked from commit d8c8f4e72d)
4 years ago
Michael Lutz b408fe77f7 Codechange: Use std::string in file scanners. 4 years ago
Michael Lutz 5cbb2da794 Codechange: Even more std::string usage in file IO. 4 years ago
Michael Lutz 65f65ad2ad Codechange: Convert some more FIO functions to take std::string. 4 years ago
Charles Pigott 860c270c73 Codechange: Replace assert_compile macro with static_assert 4 years ago
cirdan 395a5d9991 Cleanup: Remove unused ChunkType flag CH_AUTO_LENGTH
CH_AUTO_LENGTH is no longer used anywhere, so remove all code
that depends on it.
4 years ago
cirdan 46ff7d918b Cleanup: Remove save-only autolength flag from economy chunk handlers
CH_AUTO_LENGTH is only used when saving chunks; it makes no sense
to set it for chunks without a save handler.
4 years ago
glx22 d8605ad18d Codechange: Replace FOR_VEHICLE_ORDERS with range-based for loops 4 years ago
Jonathan G Rennison 78b06ddc40 TBTR: Fix palette recolouring of templates
Fix group overrides affecting template image when cloning vehicle
Update template when changing company colours

Update template images on demand instead of at load
4 years ago
Jonathan G Rennison 0c5dc5d41e Change: [Linkgraph] Pause the game when linkgraph jobs lag (#6470)
Check if the job is still running two date fract ticks before it is due
to join, and if so pause the game until its done.
When loading a game, check if the game would block immediately due to
a job which is scheduled to be joined within two date fract ticks,
and if so pause the game until its done.
This avoids the main thread being blocked on a thread join, which appears
to the user as if the game is unresponsive, as the UI does not repaint
and cannot be interacted with.
Show if pause is due to link graph job in status bar, update network
messages.
This does not apply for network clients.
4 years ago
Pavel Stupnikov 9a45a0f535
Feature: Set exclusive access to industry from GS (#8115) 4 years ago
Niels Martin Hansen b7751c483e
Feature: Influence industry production changes from GS (#7912) 4 years ago
Patric Stout d8c8f4e72d
Fix: next 67 savegame versions are used in PatchPacks; skip them (#8411)
Various of PatchPacks (Spring 2013, Joker, ChillPP) used versions
slightly higher than ours. Of course, as time went by, this
caught up with us, and we are now almost pushing a new version
that would conflict with them. To avoid users creating unneeded
issues about "why can I not load my savegame", lets be ahead of
the curve and flat-out refuse to load them.

Version-wise, this is totally fine. We have ~32k versions to go
before we run out (0x8000 is masked by JGRPP; we should avoid
using that). At the rate we bump savegames, this is not going to
happen in any sane reality.
4 years ago
Jonathan G Rennison 8ac436f507 Add setting to scale primary industry cargo production 4 years ago
Jonathan G Rennison f0c3a4b42e Saveload: Store NewGRF name in savegame, include in missing GRF message 4 years ago
Jonathan G Rennison 207c79a736 Saveload: Fix SLE*_CONDSSTR* macros 4 years ago
Patric Stout d15dc9f40f Add: support for emscripten (play-OpenTTD-in-the-browser)
Emscripten compiles to WASM, which can be loaded via
HTML / JavaScript. This allows you to play OpenTTD inside a
browser.

Co-authored-by: milek7 <me@milek7.pl>
4 years ago
Michael Lutz 79240eab1e Codechange: Make use of the improved C++17 emplace_back function. 4 years ago
Jonathan G Rennison 840e459601 Revert "Fix 63ccb36ef3: Crash trying to load TTO/TTD savegames. (#8356)"
This is not necessary due to 5243cfd6d0.

This reverts commit c558936ec3.
4 years ago
Jonathan G Rennison 4436da7436 Saveload: Skip GetVariableAddress asserts if _DEBUG not defined 4 years ago
Jonathan G Rennison 4da3cfcf56 Merge branch 'master' into jgrpp
# Conflicts:
#	CMakeLists.txt
#	src/bootstrap_gui.cpp
4 years ago
Patric Stout 731af1f1f3 Codechange: don't do work GetVariableAddress() is already doing 4 years ago
Patric Stout c98717cb45 Fix: do not add an offset to a nullptr
This is, by specs, undefined behaviour. See
https://reviews.llvm.org/D67122

In cases where this is done, optimizations done by LLVM can
generate code that causes crashes.

GetVariableAddress() had two (legit) ways this could happen:
- For SaveLoad set to global
- For SaveLoad set to SLE_VAR_NULL, where sld->address is always
  a nullptr, and object could or could not be a nullptr.
4 years ago
Michael Lutz c558936ec3
Fix 63ccb36ef3: Crash trying to load TTO/TTD savegames. (#8356) 4 years ago
Jonathan G Rennison 3e1ab88323 Fix NRT road/tram type conversion on savegame load from JokerPP v1.27 4 years ago
Jonathan G Rennison 270a748b64 Tracerestrict: Add time/date conditional 4 years ago
Jonathan G Rennison 2ad446369d Cache animated tile speed, use btree map for animated tiles 4 years ago
Jonathan G Rennison 1f54c8a018 Send vehicle caches to network clients to prevent desyncs due to bad GRFs 4 years ago
Jonathan G Rennison 9efeb3551a Tunnel/bridge signal simulation spacing is now a company setting 4 years ago
Jonathan G Rennison 0902243ab3 Allow changing the colour of plans 4 years ago
Jonathan G Rennison 57d47b9bae Add support for overtaking inside (non-custom) bridges/tunnels 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 3a75f13874 Allow drive-through road stops to be one-way 4 years ago
Jonathan G Rennison de5fb361ad Fix crash when saving order backups 4 years ago
Jonathan G Rennison e1aca1ab34 Extend Order::flags to 16 bits, fixes conditional order target field size
Adjust order packing and CmdInsertOrder

See: #198
4 years ago
Jonathan G Rennison b9f7db9c7e Jump counter is no longer a separate field 4 years ago
Jonathan G Rennison 1716083a30 Use saveload object filtering for order chunks 4 years ago
Jonathan G Rennison bb862100af Fix operator typo in 6dd7b286 in oldloader_sl.cpp 4 years ago
Jonathan G Rennison 6dd7b2869c Increase per-vehicle order limit to 64k
See: #110
4 years ago
Jonathan G Rennison cce6d731a1 TBTR: Delete orphaned virtual trains on client disconnection 4 years ago
Jonathan G Rennison 3b47b7b091 Plans: Improve performance of viewport plan rendering 4 years ago
Jonathan G Rennison 84dd35b685 Add drive-through train depot emulation (default off) 4 years ago
Jonathan G Rennison 4763f441f6 On load, use previous local company or first usable company
Instead of always using the first company slot
4 years ago
Jonathan G Rennison 2ea3a7d6f4 Add setting for default road/tram types, to match default rail type setting 4 years ago
Jonathan G Rennison 2d350d26db Add rate limit for object construction 4 years ago
Jonathan G Rennison ff12051ee1 Only show ship is lost messages if lost for a significant time 4 years ago
Jonathan G Rennison 825190db0c Remove programmable pre-signal calls to DebugPrintProgram 4 years ago
Jonathan G Rennison abb7b69861 Add slot and counter support to programmable pre-signals 4 years ago
Jonathan G Rennison 9ee8091ecc Add conditional order which tests counter value 4 years ago
Jonathan G Rennison 817bc44a3e Initial implementation of tracerestrict counter mechanism 4 years ago
Jonathan G Rennison d2594ece79 Add routing restrictions action to control news reports about stuck trains 4 years ago
Jonathan G Rennison beaeda2990 TBTR: Show empty and full train weights in GUI, and weight ratios if enabled 4 years ago
Jonathan G Rennison e2de103d82 Skip GRF compatibility check when using -K/-q switches 4 years ago