Commit Graph

52678 Commits

Author SHA1 Message Date
Andreas Schmitt
44fe1ca00b Tweak the bridge generation 2021-06-19 13:02:36 +01:00
Andreas Schmitt
a1df69be87 Check for overlaps and intersections of planned bridges and tunnels 2021-06-19 13:02:36 +01:00
Andreas Schmitt
1899b1877d Improve performance even more 2021-06-19 13:02:36 +01:00
Andreas Schmitt
7b7b74e21e Adjust values 2021-06-19 13:02:36 +01:00
Andreas Schmitt
b89afbdff3 Reintroduce base cost to make A* admissible 2021-06-19 13:02:36 +01:00
Andreas Schmitt
b3044cc482 Improve performance 2021-06-19 13:02:36 +01:00
Andreas Schmitt
953be43301 Prevent numeric overflow 2021-06-19 13:02:36 +01:00
Andreas Schmitt
af29085e42 Only build bridges over water 2021-06-19 13:02:36 +01:00
Andreas Schmitt
8d584990aa Remove unused hash functions and start the road building from the map center 2021-06-19 13:02:36 +01:00
Andreas Schmitt
4542410b41 Revert "Replace original algorithm with a simpler one"
This reverts commit 8cb3d80402f626034c08a162b8956dce03eb79f6.
2021-06-19 13:02:36 +01:00
Andreas Schmitt
9d6d41e457 Update src/lang/english.txt
Co-authored-by: stormcone <48624099+stormcone@users.noreply.github.com>
2021-06-19 13:02:36 +01:00
Andreas Schmitt
35ebeff874 Remove low performance containers with standard library ones 2021-06-19 13:02:36 +01:00
Andreas Schmitt
83ea6e9fd8 Replace original algorithm with a simpler one 2021-06-19 13:02:36 +01:00
Andreas Schmitt
150e502cf9 Add generation of public roads linking towns 2021-06-19 13:02:36 +01:00
PeterN
ce7ef4d824 Fix: Wrong cargo line position in IndustryCargo window. (#9383)
Resolved by changing calculation to determine the offset based on centring the cargo lines in the available space.
2021-06-17 23:34:59 +01:00
SamuXarick
1e6a2163a5 Fix #9358: Don't skip empty files in tar (#9367) 2021-06-18 00:08:49 +02:00
Patric Stout
cf865597f8 Fix: don't propagate shift/ctrl state till next game-tick (#9381)
When the game-loop is very slow, it was easily possible to start
the loop with _shift_pressed being false, but end with
_shift_pressed being true. This doesn't hurt the game as such,
but for the user this can be very weird: I pressed "Buy Vehicle",
pressed shift a bit later, and I still get a cost indication.
2021-06-17 20:22:57 +02:00
Patric Stout
b45c006ab9 Fix: on startup, NewGRF scan could case race-condition (#9382)
Creating a thread was not thread-safe. The irony.

The video-driver has a function GameLoopPause() which first checks
if the thread is the game-thread or not. For this it needs access
to this->game_thread. This variable is set in StartNewThread().

However, due to timing, it is well possible GameLoopPause() is
called from the thread well before this->game_thread is assigned.

And so we have a race-condition!

Simply solve this by preventing a thread to start till we are
done with our bookkeeping.
2021-06-17 20:10:40 +02:00
Andreas Schmitt
d718ba62ef Add option to sort tracks by category and speed (#282) 2021-06-17 19:08:59 +01:00
Patric Stout
c12a152ec9 Fix: thread safety issue during exiting the game (#9380)
_exit_game is read by the draw-thread to know when to exit, but
most of the time written by the game-thread.
2021-06-17 18:58:59 +02:00
Jonathan G Rennison
24ad8759db Viewport map: Improve handling of sloped tile rendering 2021-06-17 17:27:03 +01:00
Jonathan G Rennison
c4cb700738 Viewport map: Don't double draw north tile of bridge/tunnel 2021-06-17 17:22:50 +01:00
Jonathan G Rennison
65bd6eee11 Do not allow RV curves/reversing to override lower max speed 2021-06-17 17:17:02 +01:00
Andreas Schmitt
ec40677fdc Add a setting to turn off road vehicle slowdown in curves
Prior to this change, road vehicles would always slowdown in curves. This forces the player to build grid like roads. With new height levels and more mountainous maps and in the absense of diagonal roads this causes unnecessary pain. It should be an option to turn this off, so mountainous maps and curvy roads are not punishing the player unnecessarily. Nobody wants to build grid like roads outside of towns.
2021-06-17 17:10:26 +01:00
Andreas Schmitt
7555da1642 Move subsettings always to the top of parent setting (#279) 2021-06-17 17:08:49 +01:00
Rubidium
281a65b3e1 Cleanup: simplify some boolean expressions 2021-06-17 16:18:30 +02:00
Rubidium
357af686dc Cleanup: use true/false instead of 1/0 where applicable 2021-06-17 16:18:30 +02:00
Rubidium
f904aef176 Cleanup: use nullptr instead of 0 or NULL 2021-06-17 16:18:30 +02:00
Rubidium
a9774f3e34 Cleanup: [Squirrel] Use nullptr instead of 0 or NULL 2021-06-17 16:18:30 +02:00
Rubidium
3237e97b35 Cleanup: [Script] Use nullptr instead of 0 or NULL 2021-06-17 16:18:30 +02:00
Rubidium
930bb22416 Cleanup: remove lines from station_base.h that are already included in includes base_station_base.h 2021-06-17 16:18:30 +02:00
Jonathan G Rennison
1e64ee4f6b Disable town noise limits in indifferent town tolerance mode
Instead of setting noise limit to 0
2021-06-16 21:03:51 +01:00
translators
b560620eb9 Update: Translations from eints
spanish: 3 changes by MontyMontana
hindi: 28 changes by ritwikraghav14
2021-06-15 18:57:22 +00:00
Jonathan G Rennison
af89056824 Don't show demolish confirm dialog when shift pressed 2021-06-15 19:40:24 +01:00
Jonathan G Rennison
0b80461cd4 Merge branch 'pr-270' into jgrpp
# Conflicts:
#	src/lang/english.txt
#	src/settings_type.h
#	src/table/settings.ini
2021-06-15 19:32:54 +01:00
Jonathan G Rennison
f042ca7f63 Add scope info logging to command change settings 2021-06-15 18:57:57 +01:00
Jonathan G Rennison
eeece0928c Include setting name in command log for setting change commands 2021-06-15 18:52:40 +01:00
Jonathan G Rennison
696fb746b7 Add setting for demolition confirmation mode 2021-06-15 18:46:12 +01:00
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.
2021-06-15 19:36:15 +02:00
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.
2021-06-15 19:36:15 +02:00
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.
2021-06-15 19:36:15 +02:00
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.
2021-06-15 19:36:15 +02:00
Jonathan G Rennison
a8ce0ac787 Fix crash when clearing tunnel where only near end is reserved with realistic braking 2021-06-15 18:26:39 +01:00
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.
2021-06-15 16:45:04 +02:00
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.
2021-06-15 16:45:04 +02:00
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.
2021-06-15 16:45:04 +02:00
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.
2021-06-15 16:45:04 +02:00
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.
2021-06-15 16:45:04 +02:00
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.
2021-06-15 16:45:04 +02:00
Jonathan G Rennison
a49d91fa39 Use CommandContainer for demolish area callback state storage 2021-06-15 14:33:44 +01:00