Commit Graph

37920 Commits (3cbd70dc323a6f342f4986743b77dedb0e22e3e9)

Author SHA1 Message Date
Patric Stout 8230cd009d Fix: calling "exec" from script never returned
Example:

exec other.script
echo hello

The "echo" was never executed.
4 years ago
Matt Kimber bcb3313e13
Feature: allow setting maximum zoom level at which sprites are drawn (#8604) 4 years ago
Didac Perez Parera e708fb38da
Feature: allow filtering on name in rail station window (#8706) 4 years ago
Jonathan G Rennison 883e19f2c6 Windows: Fix wrong stack pointer for crash log window on non-main thread 4 years ago
Jonathan G Rennison f53697ce76 Windows: Call SetThreadStackGuarantee for all threads, not just main thread 4 years ago
Jonathan G Rennison 909e343f40
Merge pull request #223 from telk5093/jgrpp
Update: Korean translation for v0.40.4
4 years ago
stormcone 9c5a7d3a57 Fix #8733: Can't buy train engine when the "Engines only" filter is active 4 years ago
translators 3cb2dd4889 Update: Translations from eints
swedish: 22 changes by kustridaren
ukrainian: 4 changes by StepanIvasyn
lithuanian: 7 changes by devbotas
spanish: 312 changes by MontyMontana
4 years ago
Tyler Trahan de891238d6
Change: Recolour graph windows to brown (#8700) 4 years ago
Jonathan G Rennison 4361a6dbf4 Avoid undefined behaviour const_casting std::string c_str()
Use non-const data() instead

See: #224
4 years ago
frosch f580ab4ba4 Fix #8647: draw tram catenary using 4 bounding boxes.
The back sprite is now supposed to contain west, north and east pillars.
The front sprite is supposed to contain the south pillar and the wires.
4 years ago
frosch 28589db664 Fix: front/back sprites of action5 tram catenary were swapped. 4 years ago
Jonathan G Rennison c0b722ec46 Codechange: Add fast path to catenary drawing in MaskWireBits
MaskWireBits always returns its input unchanged if the input
has only 0 or 1 track bits set.
Having only 0 or 1 track bits sets (i.e. non junction tiles)
is by far the most common case.
Examining the state of neighbouring tiles and the subsequent
masking logic is relatively expensive and can be omitted in this case.
4 years ago
translators 1fb1e75038 Update: Translations from eints
norwegian (bokmal): 26 changes by Anolitt
spanish (mexican): 25 changes by absay
japanese: 11 changes by Azusa257
korean: 7 changes by telk5093
german: 7 changes by danidoedel
russian: 63 changes by Ln-Wolf
finnish: 7 changes by hpiirai
ukrainian: 5 changes by StepanIvasyn
catalan: 7 changes by J0anJosep
spanish: 7 changes by MontyMontana
portuguese (brazilian): 12 changes by Greavez
4 years ago
Patric Stout 4866e43862
Codechange: rework codeflow introduced in 098d5b22 (#8837)
It didn't sit well to me, how I wrote the commit initially. First
casting a variable into another, only to write it back into the
originally feels wrong.

This flow makes a bit more sense to me.
4 years ago
Patric Stout 14b61bfa6f Fix #8833: don't reload NewGRFs when we are shutting down
Otherwise that might cause calls to the video-driver, which are
already shut down by now. This causes, depending on the video-driver
crashes or weird effects.
4 years ago
Patric Stout afadae6d50 Fix: abort world generation on exiting the game as soon as possible
This prevents the window from "freezing" when you close it during
world generation, as it first would continue the action.
4 years ago
Patric Stout 5426cb3baf Fix: abort GRFFileScanner on exiting the game as soon as possible
This prevents the window from "freezing" when you close it during
the scanning of NewGRFs, as it first would continue the action.
4 years ago
Patric Stout b349ef6e71 Fix: don't update framerates when a modal window is open
Otherwise the numbers are all over the place when a modal window
just closed.
4 years ago
Patric Stout 970fedd78c Add: make modal windows update more smooth
Basically, modal windows had their own thread-locking for what
drawing was possible. This is a bit nonsense now we have a
game-thread. And it makes much more sense to do things like
NewGRFScan and GenerateWorld in the game-thread, and not in a
thread next to the game-thread.

This commit changes that: it removes the threads for NewGRFScan
and GenerateWorld, and just runs the code in the game-thread.
On regular intervals it allows the draw-thread to do a tick,
which gives a much smoother look and feel.

It does slow down NewGRFScan and GenerateWorld ever so slightly
as it spends more time on drawing. But the slowdown is not
measureable on my machines (with 700+ NewGRFs / 4kx4k map and
a Debug build).

Running without a game-thread means NewGRFScan and GenerateWorld
are now blocking.
4 years ago
Patric Stout 098d5b2239
Fix #8711: having gui_zoom lower than zoom_min causes crashes (#8835)
gui_zoom was never clamp'd between zoom_min/zoom_max.

zoom_min controls how zoomed-in we load sprites. For a value of 1,
no quad-sizes sprites are loaded. If gui_zoom would be 0, meaning
it wants quad-sized sprites to display, it was printing random
stuff to the screen, which could or could not result in crashes.
4 years ago
sean 160a5f2fdd
Codechange: Misleading function name for selecting refresh rate (#8836)
Co-authored-by: pnda <43609023+ThePNDA@users.noreply.github.com>
4 years ago
Patric Stout 47e11fa3f2
Codechange: only run InteractiveRandom() from the draw-thread (#8831)
Otherwise both the draw-thread and game-thread can do it both
at the same time, which gives rather unwanted side-effects.

Calling it from the draw-thread alone is sufficient, as we just
want to create some unpredictable randomness for the player. The
draw-thread is a lot more active (normally) than the game-thread,
so it is the best place of the two to do this.
Additionally, InteractiveRandom() mostly has to do with visuals
that are client-side-only, so more related to drawing than to
game.
4 years ago
Patric Stout 68e92d215a
Fix #8810: "aircraft out of fuel" news was looking in the wrong place (#8832)
v->tile for aircrafts is always zero when in the air. Only when
it starts its landing (or take-off) patterns it becomes a sane
value.
So instead, base the news on the last x/y coordinates of the plane.
4 years ago
translators 65f558d6df Update: Translations from eints
english (us): 18 changes by 2TallTyler
korean: 17 changes by telk5093
german: 13 changes by danidoedel, 4 changes by Wuzzy2
finnish: 17 changes by hpiirai
catalan: 17 changes by J0anJosep
lithuanian: 33 changes by devbotas
spanish: 17 changes by MontyMontana
portuguese (brazilian): 20 changes by Greavez
polish: 9 changes by yazalo
4 years ago
Patric Stout b21ba566ae
Codechange: remove special strings for language and resolutions (#8824)
As OpenTTD grew, we found other ways to do this, and we are no
longer in need for a hack like this.
4 years ago
PeterN 9fdc881005
Fix: Scale PIP-padding the same as regular padding. (#8829) 4 years ago
sean 0464a50ab8
Add: Display refresh rate game option (#8813) 4 years ago
Michael Lutz 436cdf1fc8 Fix #8825: [OpenGL] Don't clear cursor cache from the game loop thread. 4 years ago
translators ee69a0dc29 Update: Translations from eints
lithuanian: 5 changes by devbotas
portuguese (brazilian): 8 changes by Greavez
4 years ago
Patric Stout 8946b41d20 Fix: ensure switching blitter happens in the main thread
This because video-drivers might need to make changes to their
context, which for most video-drivers has to be done in the same
thread as the window was created; main thread in our case.
4 years ago
Patric Stout e56d2c63c3 Add: [Video] move GameLoop into its own thread
This allows drawing to happen while the GameLoop is doing an
iteration too.

Sadly, not much drawing currently can be done while the GameLoop
is running, as for example PollEvent() or UpdateWindows() can
influence the game-state. As such, they first need to acquire a
lock on the game-state before they can be called.

Currently, the main advantage is the time spend in Paint(), which
for non-OpenGL drivers can be a few milliseconds. For OpenGL this
is more like 0.05 milliseconds; in these instances this change
doesn't add any benefits for now.

This is an alternative to the former "draw-thread", which moved
the drawing in a thread for some OSes. It has similar performance
gain as this does, although this implementation allows for more
finer control over what suffers when the GameLoop takes too
long: drawing or the next GameLoop. For now they both suffer
equally.
4 years ago
Michael Lutz 3a4a15cc93 Codechange: don't set the window position when changing blitter
There really is no need to make an extra call to the OS in
these cases.
4 years ago
Patric Stout b9eac7c6dc Codechange: remove the unused lock around Blitter 4 years ago
Patric Stout 4610aa7ae3 Remove: [Video] no longer draw in a thread
Drawing in a thread is a bit odd, and often leads to surprising
issues. For example, OpenGL would only allow it if you move the
full context to the thread. Which is not always easily done on
all OSes.
In general, the advise is to handle system events and drawing
from the main thread, and do everything else in other threads.
So, let's be more like other games.

Additionally, putting the drawing routine in a thread was only
done for a few targets.

Upcoming commit will move the GameLoop in a thread, which will
work for all targets.
4 years ago
dP 56911a86ea Add: Buttons to open global goals from company goals and vice versa 4 years ago
dP 818bee3961 Change: Don't show global goals in company goal windows 4 years ago
Didac Perez Parera 3878c4781e
Fix #8817: keep NewGRF order for object class sorting (#8818) 4 years ago
Patric Stout 04db99749b
Fix #8784: using alt+enter didn't update the fullscreen toggle visibly (#8820)
Basically, the window was not invalidated, so it was never redrawn.
This made it look like it wasn't working, but it really was.
4 years ago
Eddi-z d3179709b1
Change: Clarify what effect town interactions have (#8744) 4 years ago
Michael Lutz 25656a10cb Fix #8808: [OSX, OpenGL] Crash on switching blitters due to double-mapping the video buffer. 4 years ago
Michael Lutz ae1f7bd695
Fix 937d60f2: Broken company colours for 40bpp-blitter. (#8821) 4 years ago
Patric Stout b93d7dd3cb
Add: Option to (dis-)allow accelerated video drivers. (#8819)
The video drivers using the OpenGL backend are currently our only
accelerated drivers. The options defaults to off for macOS builds and
to on everywhere else.

Co-authored-by: Michael Lutz <michi@icosahedron.de>
4 years ago
Didac Perez Parera 6e2a96c133
Add: filter for "engines only" in build train window (#8733) 4 years ago
TELK 267d6d2891 Update: Korean translation for v0.40.4 4 years ago
Jonathan G Rennison b25cbc969c Merge branch 'master' into jgrpp
# Conflicts:
#	src/lang/brazilian_portuguese.txt
#	src/lang/tamil.txt
#	src/station_cmd.cpp
4 years ago
Dídac Pérez Parera 8d9aeb3d4e Fix: keep NewGRF order for object class sorting
(cherry picked from commit 83d67fe46bd24cf88272fe2774954c8dc9bb6497)
4 years ago
translators f70aa8fabe Update: Translations from eints
estonian: 6 changes by siimsoni
catalan: 3 changes by J0anJosep
latvian: 37 changes by lexuslatvia
portuguese (brazilian): 8 changes by Greavez
polish: 1 change by azabost
4 years ago
Jonathan G Rennison 25909b06d2 Fix #8809: Crash when removing airport when hangar window open 4 years ago
Jonathan G Rennison 1b146b3bff Fix crash when removing/upgrading airport with hangar window open
See: https://github.com/OpenTTD/OpenTTD/issues/8809
4 years ago
translators 2860de7bf4 Update: Translations from eints
chinese (traditional): 5 changes by benny30111
estonian: 1 change by siimsoni
italian: 1 change by AlphaJack
ukrainian: 4 changes by StepanIvasyn
tamil: 37 changes by Aswn
portuguese (brazilian): 19 changes by Greavez
4 years ago
Jonathan G Rennison 9bf6d1407f Add screenshot type: whole map at current zoom level 4 years ago
Jonathan G Rennison d6e2b32132 Merge branch 'master' into jgrpp
# Conflicts:
#	src/screenshot.h
4 years ago
Jonathan G Rennison dc7ffb5dc6 Add unset hotkey for industry chains window 4 years ago
Jonathan G Rennison 1c51b7253f Allow following vehicles at all non-map zoom levels 4 years ago
translators f536fd55d8 Update: Translations from eints
swedish: 1 change by kustridaren
spanish (mexican): 4 changes by absay
estonian: 80 changes by siimsoni
arabic (egypt): 13 changes by AviationGamerX
ukrainian: 1 change by StepanIvasyn
dutch: 1 change by Afoklala
portuguese (brazilian): 15 changes by Greavez
4 years ago
Patric Stout 06a3c0cb26 Fix dddf885f: use IConsoleError to produce console errors 4 years ago
Patric Stout 8c6b5e52fd Add: allow making heightmap screenshot via console 4 years ago
Patric Stout ac5e77ea3b Feature: allow custom width/height of screenshot via console
Reworked how the screenshot command works while keeping it backwards
compatible. It can now more freely understand arguments, and has
the ability to make SC_DEFAULTZOOM screenshots.
4 years ago
translators 879eb9c348 Update: Translations from eints
estonian: 22 changes by siimsoni
korean: 1 change by telk5093
serbian: 41 changes by nkrs
german: 1 change by Wuzzy2
romanian: 14 changes by ALEX11BR
russian: 5 changes by Ln-Wolf
finnish: 5 changes by hpiirai
ukrainian: 2 changes by StepanIvasyn
lithuanian: 105 changes by devbotas
spanish: 3 changes by MontyMontana
french: 5 changes by MalaGaM
portuguese (brazilian): 13 changes by Greavez
4 years ago
Jonathan G Rennison 70f3993a55 CMake: Fix host strgen/settingsgen importing 4 years ago
Jonathan G Rennison 5a364d3e8c Merge branch 'master' into jgrpp
# Conflicts:
#	src/blitter/32bpp_optimized.cpp
#	src/lang/serbian.txt
4 years ago
Jonathan G Rennison d566a152bb Skip GfxDetermineMainColours contents in dedicated compiles
Fixes linker error
4 years ago
Patric Stout 0243ae4654
Fix #8799: NGameAllowedSorter() is not imposing strict weak ordering relation (#8801)
In other words, it should only (!) return true if A comes for B.
This promise was broken for the situation where two values are
identical. It would return true in these cases too. This is of
course not possible: if two values are identical, neither come
before the other. As such, the sorter was not imposing strict
weak ordering relations.

libstdc++ handled this scenario just fine, but libc++ crashes
badly on this, as it allowed comparing of [begin, end] instead
of [begin, end).
libc++ considered this not a bug (and by specs, they are correct;
just this way of crashing is of course a bit harsh):
https://bugs.llvm.org/show_bug.cgi?id=47903
4 years ago
Jonathan G Rennison 5724f6e3db
Merge pull request #219 from telk5093/jgrpp
Update: Korean translation
4 years ago
Lastorder f3b850623c
Fix #220 build fail due to missing var
Removed from merge commit dfecdf3afb
4 years ago
TELK 6f4d45f61f Update: Korean - GUI setting for shading trees on slopes 4 years ago
TELK 3b135935c7 Change: Improve Korean translation 4 years ago
Jonathan G Rennison 7e62af94ee Remove OVEERIDE macro 4 years ago
Jonathan G Rennison 865cf79915 Fix missing override keywords 4 years ago
Jonathan G Rennison 3e1589eeae Fix name collision in template replacement enum definition 4 years ago
Jonathan G Rennison 13b34b9917 Fix code style in Town::UpdateLabel 4 years ago
Jonathan G Rennison 3e017ddaa9 Remove unused dirty block size constants 4 years ago
Jonathan G Rennison 32dcc0d484 Linkgraph: Fix unused expression result warning 4 years ago
Jonathan G Rennison 9ca1c04330 Build: Fix use of xmmintrin.h on non-x86 MSVC builds 4 years ago
Jonathan G Rennison 59741b9f3c CMake: Fix HOST_BINARY_DIR cross compiling 4 years ago
Michael Lutz 937d60f239
Fix #8774: Black screenshots when using 40bpp-blitter. (#8791)
This affected all screenshot types that render to an off-screen
buffer and don't copy the actual screen contents.
4 years ago
translators 95462493ef Update: Translations from eints
english (us): 4 changes by 2TallTyler
italian: 4 changes by troccoli
serbian: 251 changes by nkrs
german: 6 changes by ebla71, 2 changes by Wuzzy2
romanian: 3 changes by ALEX11BR
russian: 11 changes by Ln-Wolf
ukrainian: 2 changes by StepanIvasyn
lithuanian: 15 changes by devbotas
spanish: 2 changes by perezdidac
4 years ago
Jonathan G Rennison 2df9c97884 Revert "Change: Zero out the gameloop timers when the game is paused"
This reverts commit 64686b53ff.
4 years ago
Jonathan G Rennison f81c71e15b OpenGL: Temporarily reduce OpenGL driver priorities 4 years ago
Jonathan G Rennison 84a7ab180e Merge branch 'master' into jgrpp
# Conflicts:
#	src/company_cmd.cpp
#	src/lang/greek.txt
#	src/table/settings.ini
4 years ago
Jonathan G Rennison fdfd9753d6 Fix tree shading with 40bpp blitter 4 years ago
Jonathan G Rennison f4e29071be Merge tag '1.11.0-beta2' into jgrpp
# Conflicts:
#	.github/workflows/ci-build.yml
#	.github/workflows/release.yml
#	CMakeLists.txt
#	src/blitter/32bpp_optimized.cpp
#	src/debug.cpp
#	src/gfx.cpp
#	src/gfx_func.h
#	src/lang/czech.txt
#	src/lang/english.txt
#	src/lang/italian.txt
#	src/lang/swedish.txt
#	src/lang/ukrainian.txt
#	src/network/network_server.cpp
#	src/os/windows/crashlog_win.cpp
#	src/os/windows/win32.cpp
#	src/pathfinder/follow_track.hpp
#	src/screenshot.cpp
#	src/settings_type.h
#	src/spritecache.cpp
#	src/vehicle_gui.cpp
#	src/video/sdl2_v.cpp
#	src/video/video_driver.cpp
#	src/video/video_driver.hpp
#	src/video/win32_v.cpp
4 years ago
Michael Lutz c656633bea Fix #8775: [Win32] Don't create the main window when alt-tabbing back into fullscreen. 4 years ago
Michael Lutz b7a44983b4 Fix: [Win32] Original window size was lost when tabbing in and out of fullscreen. 4 years ago
Patric Stout 74aa934441 Codechange: validate that "max" value of settings fit in their storage
This is an easy mistake to make, so protect us against making such
mistakes, by validating it doesn't happen.
4 years ago
Patric Stout d7a70c67ba Fix: old snow_line_height had a higher maximum value than could be stored
So any old game made with this setting was overflowing anyway;
not really a lot we can do about that now.
4 years ago
Patric Stout a0c298a539 Fix: three max-values for settings could exceed their storage size 4 years ago
Patric Stout abac4b1758
Fix c4df0f95: bootstrap was only showing a black screen (#8788)
The bootstrap has the _switch_mode to SM_MENU, and never leaves
this mode. Neither is it considered a modal window (while in some
sense it really is). So .. we need to add another "draw anyway"
exception, to make sure bootstrap is being drawn.
4 years ago
Limyx826 47e899cf75 Add: Malaysia Ringgit as Currency
Cause why not

*Update the formating
4 years ago
Charles Pigott 64686b53ff Change: Zero out the gameloop timers when the game is paused 4 years ago
Charles Pigott ef5cea0e06 Change: De-limit framerate window's framerate 4 years ago
Owen Rudge 838fd61f29 Fix: [OSX] Hide dock when entering fullscreen 4 years ago
Jonathan G Rennison 44d786d8ce MinGW: Fix define fallback for missing SHGFP_TYPE_CURRENT 4 years ago
Jonathan G Rennison a7ed477185 Log savegame compression format used at debug level sl 3 4 years ago
translators 02e7bc7e0a Update: Translations from eints
swedish: 4 changes by kustridaren
norwegian (bokmal): 3 changes by buzzCraft
spanish (mexican): 12 changes by absay
korean: 4 changes by telk5093
greek: 85 changes by sntovas
german: 4 changes by MagnumSociety
catalan: 5 changes by J0anJosep
tamil: 16 changes by Ramesh78dev
dutch: 4 changes by rcpaul
polish: 5 changes by pAter-exe
4 years ago
Jonathan G Rennison edeced8fce Zstd: Enable zstd for autosaves
See also: https://github.com/OpenTTD/OpenTTD/pull/8773
4 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
4 years ago
Jonathan G Rennison 922e8554de Zstd: Fix infinite loop when input exhausted 4 years ago
Jonathan G Rennison ee7f5ad44f Zstd: Indentation fixes 4 years ago
dP b284d34277 Add: Support Zstandard(zstd) savegame compression
(cherry picked from commit 6f0aeaf2c5436550c93205e704624957e9abc969)
4 years ago
Jonathan G Rennison 0a31a3b923 Fix for crash when exiting whilst NewGRF scan still in progress
See: https://github.com/OpenTTD/OpenTTD/issues/8760
4 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
4 years ago
Patric Stout 535fdb5c89 Codechange: remove _realtime_tick variable
(cherry picked from commit fe451b8dc7)

# Conflicts:
#	src/debug.cpp
#	src/debug.h
#	src/video/video_driver.cpp
4 years ago
Patric Stout 3744d71b13 Codechange: replace _realtime_tick with std::chrono for mouse events
(cherry picked from commit 853bfc3562)
4 years ago
Patric Stout d4f208d9c1 Codechange: [Network] replace _realtime_tick with std::chrono
(cherry picked from commit 53c28a8ec9)
4 years ago
Patric Stout 729df75d3e Fix: [Network] don't desync if client leaves before you finish downloading map
When you are downloading a map, all the commands are queued up
for you. Clients joining/leaving is done by the network protocol,
and as such are processed immediately. This means that by the
time you are processing the commands, a client that triggered
it, might already have left.

So, all commands that do something with ClientID, shouldn't
error on an invalid ClientID when DC_EXEC is set, but
gracefully handle the command anyway, to make sure the
game-state is kept in sync with all the clients that did
execute the DoCommand while the now-gone client was still
there.

Additionally, in the small chance a client disconnects between
the server validating a DoCommand and the command being
executed, also just process the command as if the client was
still there. Otherwise, lag or latency can cause clients that
did not receive the disconnect yet to desync.

(cherry picked from commit 2d9062bfc1)
4 years ago
Patric Stout c13c201f72 Fix: [Network] don't show "server doesn't respond" while in queue
Send all clients in the queue every game-day a packet that they
are still in the queue.

(cherry picked from commit 13889b6554)

# Conflicts:
#	src/network/network_server.cpp
4 years ago
Patric Stout 7da90af2f4 Fix: [Network] send map to next client if current client disconnects
Also terminate creating of the savegame, as the client is gone,
there really is no need for that anymore.

(cherry picked from commit 8d199b1bbc)
4 years ago
Patric Stout cfa1612766 Fix: [Network] also count the person downloading the map in the queue
Strictly seen, there are "N" people -waiting- in front of you
in the queue, but it is nicer to show "N + 1" for the person that
is currently downloading the map. Avoids it showing:
"0 clients in front of you". That just feels a bit off.

(cherry picked from commit 3677418225)
4 years ago
Charles Pigott 7e39d78fc3 Fix: Vehicle list windows did not update when this year's profit changed
Remove caching from vehicle group object. and recalculate it whenever
required instead.

(cherry picked from commit 6b8f9b50b9)

# Conflicts:
#	src/vehicle_gui.cpp
4 years ago
Patric Stout 40505e645a Fix: terraform limit acted random when maxing out per_64k_frames setting
uint32 + uint32 can overflow, so cast it to uint64 first.
4 years ago
Patric Stout 25e5a92286 Fix 9b800a96: (a << 16) is unsigned, so don't remove the cast 4 years ago
Jonathan G Rennison dbbe1bb3e4 Fix trains passing signals in original acceleration with braking models 4 years ago
Patric Stout 8bc0089fc4
Fix c3dc27e3: put the max-value of fast-forward-speed-limit to within the storage size (#8769) 4 years ago
translators 2545b24118 Update: Translations from eints
czech: 1 change by LubosKolouch
4 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.
4 years ago
dP 73fd634209 Fix #6266: Ugly lists in network lobby windows on double/quad interface sizes with custom fonts 4 years ago
Patric Stout 2d9062bfc1 Fix: [Network] don't desync if client leaves before you finish downloading map
When you are downloading a map, all the commands are queued up
for you. Clients joining/leaving is done by the network protocol,
and as such are processed immediately. This means that by the
time you are processing the commands, a client that triggered
it, might already have left.

So, all commands that do something with ClientID, shouldn't
error on an invalid ClientID when DC_EXEC is set, but
gracefully handle the command anyway, to make sure the
game-state is kept in sync with all the clients that did
execute the DoCommand while the now-gone client was still
there.

Additionally, in the small chance a client disconnects between
the server validating a DoCommand and the command being
executed, also just process the command as if the client was
still there. Otherwise, lag or latency can cause clients that
did not receive the disconnect yet to desync.
4 years ago
Patric Stout 13889b6554 Fix: [Network] don't show "server doesn't respond" while in queue
Send all clients in the queue every game-day a packet that they
are still in the queue.
4 years ago
Patric Stout 8d199b1bbc Fix: [Network] send map to next client if current client disconnects
Also terminate creating of the savegame, as the client is gone,
there really is no need for that anymore.
4 years ago
Patric Stout 3677418225 Fix: [Network] also count the person downloading the map in the queue
Strictly seen, there are "N" people -waiting- in front of you
in the queue, but it is nicer to show "N + 1" for the person that
is currently downloading the map. Avoids it showing:
"0 clients in front of you". That just feels a bit off.
4 years ago
Charles Pigott 6b8f9b50b9 Fix: Vehicle list windows did not update when this year's profit changed
Remove caching from vehicle group object. and recalculate it whenever
required instead.
4 years ago
Michael Lutz d79398a1d5 Fix #8763: [OpenGL] Cursor sprite origin can be negative. 4 years ago
Jonathan G Rennison c37beb78ee Check for broken custom bridge head states, and bump save version 4 years ago
Jonathan G Rennison b931df9934 Add debug console command to delete a vehicle ID 4 years ago
Pavel Stupnikov 4fd2eecb8b
Change: Improve console warnings on invalid network commands (#8753) 4 years ago
Jonathan G Rennison 2cbb42f9a9 Add fast path to catenary drawing in MaskWireBits 4 years ago
translators cd756e6f01 Update: Translations from eints
swedish: 60 changes by kustridaren
norwegian (bokmal): 12 changes by buzzCraft
czech: 82 changes by PatrikSamuelTauchim, 1 change by tomas-vl
italian: 86 changes by AlphaJack, 9 changes by federico1564S
german: 16 changes by ebla71
romanian: 10 changes by ALEX11BR
ukrainian: 3 changes by StepanIvasyn
spanish: 1 change by MontyMontana
4 years ago
Jonathan G Rennison d58989f552 Merge branch 'master' into jgrpp
# Conflicts:
#	src/lang/english_US.txt
4 years ago
Michael Lutz 77854d561b Fix: [OpenGL] Don't use OpenGL on MESA software renderers.
Performance in this case is worse than not using OpenGL, so just let
OTTD fall back to a different video driver.
4 years ago
Patric Stout 1b5d1d074e
Fix: [SDL2] set GL attributes to get the best GL context possible (#8759) 4 years ago
Jonathan G Rennison 056606d2b6 Fix ApplyLookAheadItem assuming current_order == order in order list
Fixes trains with no orders failing to brake in advance of stations
4 years ago
Jonathan G Rennison 460d504269 Fix order index wrapping when depth exceeded in AdvanceOrderIndex 4 years ago
frosch dfa141818b Fix: OpenGL cursor did not consider sprite offsets of cursor sprites. 4 years ago
frosch d236c57600 Fix: yet another place where the vehicle-cursor did not account for the interface zoom level. 4 years ago
Michael Lutz ef4cec9382 Fix #8750: [OpenGL] Line drawing did not set proper RGB/mask colours. 4 years ago
Jonathan G Rennison 18471da6e1 Fix collision checks for ship collision avoidance
This fixes cases where ships could be redirected in a circle
4 years ago
Patric Stout fe451b8dc7 Codechange: remove _realtime_tick variable 4 years ago
Patric Stout 853bfc3562 Codechange: replace _realtime_tick with std::chrono for mouse events 4 years ago
Patric Stout 53c28a8ec9 Codechange: [Network] replace _realtime_tick with std::chrono 4 years ago
Patric Stout d068d61f3c
Fix bddfcaef: don't tell twice that a client left because of a timeout etc (#8746)
SendError() notifies all clients of the disconnect. This calls
CloseConnection() at the end, which also notified the clients
of the disconnect. Really no need to do it twice.

The status NETWORK_RECV_STATUS_SERVER_ERROR is only set by
SendError(), so in case that is the status, don't let
ClientConnection() send another notification.
4 years ago
translators af326753a9 Update: Translations from eints
swedish: 1 change by kustridaren
english (us): 15 changes by 2TallTyler
catalan: 1 change by J0anJosep
dutch: 1 change by Afoklala
4 years ago
Michael Lutz 3cbbaa62db Change: Never auto-select an 8bpp blitter unless explicitly allowed by the 'support8bpp' setting. 4 years ago
Jonathan G Rennison 93f2d5e056 Add GUI setting for shading trees on slopes in viewports
Deafult on, only for non-map mode
(Slope shading is always on in map mode)
4 years ago
Jonathan G Rennison 4ef363422a Add 32bpp blitter support for adjusting brightness of drawn sprites 4 years ago
Patric Stout 9a3dbf3122
Fix 02e770ff: allow estimating CloneVehicle if short on money (#8748)
CheckCompanyHasMoney() was also executed when not using DC_EXEC,
resulting in an error about shortage of money instead of the
estimation.
This mostly is a problem for AI players, as they will have no
way to know how much it would have cost.
4 years ago
Patric Stout d4583fa64c
Fix #8123: trams on half-tiles couldn't find depots (#8738)
Basically, follow_track.hpp contains a fix for half-tiles, but
this wasn't duplicated for when trying to find a depot and in
a few other places. This makes sure all places act the same.
4 years ago
Jonathan G Rennison 42e57995dd Improve visibility of slopes under trees in viewport map vegetation mode
Loosely based on tree slope brightness adjustment from
https://github.com/nielsmh/OpenTTD/tree/tree-slope-brightness
4 years ago
translators 9209807d66 Update: Translations from eints
swedish: 19 changes by kustridaren
german: 1 change by Wuzzy2
slovak: 3 changes by FuryPapaya
4 years ago
Michael Lutz 311df31fb1 Codechange: [OpenGL] Load all OpenGL functions dynamically. 4 years ago
Michael Lutz a0c1a3f736 Codechange: [OpenGL] Simplify loading OpenGL extension functions. 4 years ago
Michael Lutz e1e8cc3851
Fix #8734: [OpenGL] Apply palette remap to cursor sprites. (#8742) 4 years ago
Patric Stout 6a8c461e38 Codechange: [OSX] GameLoop is really more like MainLoop
MainLoop() is used to bootstrap OSX, where later a callback is
done to GameLoop() to execute OpenTTD. All other video drivers
don't need that, so what is in GameLoop is in MainLoop for all
other drivers. This is rather confusing. So, instead, name
GameLoop MainLoopReal to be more in sync with the other drivers.
4 years ago
Patric Stout 67d3c6aa71 Codechange: [Video] move InteractiveRandom() to the VideoDriver 4 years ago
Patric Stout c409f45ddd Codechange: [Video] make the prototype of PollEvent() the same for all drivers
Additionally, call it from the draw-tick.
4 years ago
Tyler Trahan 8476f12432
Change: Improve graph period markings (#8732) 4 years ago
frosch 79c2b81ffd Fix: vehicle-cursor size-limit did not account for the interface zoom level. 4 years ago
Michael Lutz 46e13313e4 Fix #8731: Always use a 32bpp blitter if font anti-aliasing is enabled. 4 years ago
translators c93c9c099e Update: Translations from eints
estonian: 7 changes by siimsoni
polish: 2 changes by yazalo
4 years ago
Niels Martin Hansen cc465efa67 Change: [Win32] Use more modern way of getting free disk space 4 years ago
Niels Martin Hansen b427ddce88 Codechange: Switch to explicit wide strings 4 years ago
Niels Martin Hansen beeb9e0a1b Remove: [Win32] Last pretenses of being able to build for Windows 95 4 years ago
Michael Lutz 06ca147a82 Fix 8706c36f: Change RELEASE code, too. 4 years ago
Michael Lutz af4d32357c Codechange: [Win32] Move common initialization and finalization to the video driver base class. 4 years ago
Michael Lutz 7af1fd3ffb Add: [OSX] OpenGL video driver. 4 years ago
Michael Lutz 78b8fc3e4f Codechange: [Win32] Move GDI-specific variables and related functions into the GDI video driver class. 4 years ago
Michael Lutz b4a3bc1ffe Codechange: [OpenGL] Separate context state setup from general init. 4 years ago
Michael Lutz 8b90d4abe0 Codechange: [Win32] Move GDI specific drawing code into the GDI video driver class. 4 years ago
Michael Lutz 7f55f0a264 Codechange: [OSX] Add support for (un)locking the video buffer. 4 years ago
Michael Lutz 59e0d9618b Codechange: [Win32] Split the video driver into a base class and a GDI backend class. 4 years ago
Michael Lutz 2f25e9bdf8 Codechange: [OSX] Separate video driver into a base and a Quartz implementation. 4 years ago
Michael Lutz 421b599541 Codechange: [SDL2] Split driver in base-part and default backend 4 years ago
Patric Stout a303940372 Feature: [SDL2] OpenGL support 4 years ago
Michael Lutz a77b202767 Codechange: [SDL] Move dirty_rect to class scope. 4 years ago
Patric Stout e75858ce5e Codechange: [SDL2] Allow several places to hook into the SDL driver
This allows future subdrivers to use these to manage their
own flow.
4 years ago
Patric Stout 101e394475 Codechange: [SDL2] Move functions and variables to class-scope
This allows future subdrivers to override them.
4 years ago
Patric Stout 0d58bc9384 Codechange: [SDL2] Move SDLSurface code to its own function
This increases readability, and allow future subdrivers to not
use SDLSurface to draw.
4 years ago
Patric Stout 6098811b49 Codechange: [SDL2] Split Start() in a few more functions
This makes it a bit easier to follow what is going on, and
allow future subdrivers to hook into a few of these functions.

Reworked the code slighly while at it, to return early where
possible.
4 years ago
Michael Lutz 86c309ea75 Codechange: [OpenGL] Let OpenGL clear the pixel buffer if possible. 4 years ago
Michael Lutz 94d8acb7d0 Add: A 32 bpp blitter that uses the animation buffer from the video backend to speed up palette animation. 4 years ago
Michael Lutz ae7c63cc35 Codechange: [OpenGL] Use persistently mapped pixel buffers when supported. 4 years ago
Michael Lutz 200be7d20c Add: [OpenGL] Support for a separate animation buffer that stores the palette values of the screen in addition to the colour buffer. 4 years ago
Michael Lutz 01ef44fa4f Codechange: Allow blitter factories to decide at runtime if the blitter is usable. 4 years ago
Michael Lutz d62e302768 Change: [Win32] Prioritize the OpenGL video driver over the GDI one. 4 years ago
Michael Lutz 6bcc4884c2 Add: [OpenGL] Accelerated mouse cursor drawing. 4 years ago
Michael Lutz d4dbb3f46e Fix: Don't trash video buffer alpha in SSE3/4 blitters. 4 years ago
Michael Lutz bcd15b4dd2 Codechange: [OpenGL] Initialize backing store to opaque alpha to allow blending effects. 4 years ago
Michael Lutz 1e1a9f3999 Add: A simple, templated cache map that uses a least recently used eviction strategy. 4 years ago
Michael Lutz 3e49aff35c Codechange: Allow video drivers to handle the cursor themselves. 4 years ago
Michael Lutz 6776229047 Codechange: Make the simple Malloc sprite allocator globally usable. 4 years ago
Michael Lutz 70aa3b4011 Codechange: Give sprite encoders a hint which colour components of a sprite are filled with useful information. 4 years ago
Michael Lutz e7e5316340 Add: Allow sprite encoders (blitters) to specify an alignment for sprite width and height. 4 years ago
Michael Lutz 02e8741457 Codechange: Allow for using a sprite encoder that is not the currently active blitter when loading a sprite. 4 years ago
Michael Lutz f94b2e73e1 Codechange: [Win32] Use an OpenGL core context instead of a compatibility one. 4 years ago
Michael Lutz e8fc050b6e Add: [OpenGL] Support for 8bpp blitters. 4 years ago
Michael Lutz 320072c8dc Codechange: [OpenGL] Explicitly assign which framebuffer target receives the colour values. 4 years ago
Michael Lutz 821f30f735 Codechange: [OpenGL] Use GLSL version 1.50 if available. 4 years ago
Michael Lutz 90fd8f8cda Codechange: [OpenGL] Use generic vertex attributes in the shader program. 4 years ago
Michael Lutz acf59f6b68 Codechange: [OpenGL] Use shaders to display the video buffer on screen. 4 years ago
Michael Lutz b181859629 Change: [Win32] Disable VSync for OpenGL by default. 4 years ago
Michael Lutz 9a069faa01 Codechange: [Win32] Try to get an OpenGL 3.2+ context if possible. 4 years ago
Michael Lutz a990c497b5 Codechange: [OpenGL] Use a pixel buffer object to store the video buffer. 4 years ago
Michael Lutz 5af0cfd902 Codechange: [OpenGL] Use a vertex array object to store the vertex state for the video buffer. 4 years ago
Michael Lutz acf2ce35f7 Codechange: [OpenGL] Use a vertex buffer object to store the vertex data for the video buffer. 4 years ago
Michael Lutz 8706c36fc0 Codechange: [Win32] Move remaing global _wnd variables into the video driver. 4 years ago
Michael Lutz d6b6775888 Change: Lock the video buffer when drawing inside the game loop to properly account for threaded drawing. 4 years ago
Michael Lutz 73ed748deb Codechange: [Win32] Move the global video buffer pointer into the driver class. 4 years ago
Michael Lutz 5ad545dcc1 Codechange: [OpenGL] Only update the dirty parts of the video buffer texture. 4 years ago
Michael Lutz 3a77ade6b2 Codechange: [OpenGL] Enable driver debug messages if supported. 4 years ago
Michael Lutz d7b96a424f Codechange: [OpenGL] Use new-style extension testing introduced with OpenGL 3.0. 4 years ago
Michael Lutz ef478ade64 Add: [Win32] Video driver that uses OpenGL to transfer the video buffer to the screen. 4 years ago
Patric Stout 78d96dad2a
Fix #6319: [Win32] don't use clipping; draw whole screen every frame (#8726)
When we clip the region that is only been redrawn, something
weird happens on Windows. When pushing 60 frames per second on a
60Hz monitor, it appears that the clipped region is often shown
of another frame, instead of the current.

Examples of this are:
- pause the game, move your mouse to the left, and at the right
  speed it totally disappears.
- fast aircrafts seem to be in several places at once, weirdly
  lagging behind.
- in title screen, moving your mouse gives you the idea it is
  jumping places, instead of smooth movements.

In the end, if you do nothing, everything is correct, so it is
eventually consistent. Just when we are firing many BitBlt in
a clipped region, the in-between is not.

What goes wrong exactly, I honestly do not know. On every frame
that we push to the DC is a mouse painted, but visually it
sometimes appears like it is not. Recording with external software
shows it really is there.
It is also not our eyes playing tricks on us, as the first example
makes it really clear the mouse pointer really is not painted.

And to be clear, with the mouse this is easiest reproduceable,
as high-speed objects are influences by this most. But this happens
for all movement that redraws small regions.

Either way, not using clipped regions resolves the issue completely,
and there appears to be little to no penalty (I failed to measure
any impact of drawing the full screen). So better have a good game
than fast code, I guess?
4 years ago
translators c136dd2b32 Update: Translations from eints
english (us): 78 changes by 2TallTyler
polish: 1 change by yazalo
4 years ago
Jonathan G Rennison 19b7ecf95a Merge branch 'master' into jgrpp 4 years ago
Charles Pigott 6af49b7885 Fix #8724: Got wrong DepotID/StationID for airports, causing crash 4 years ago
Charles Pigott 80fb1c74f0 Change: Make pathfinder account for maximum order speed, if set 4 years ago
Jonathan G Rennison 4f74a83496 Add fast paths for clear/tree snow line checks in tile loop 4 years ago
Jonathan G Rennison 2e20da40ed Cache current value of snow line height 4 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
4 years ago
Jonathan G Rennison 0df3e785cb Debug: Add console command to dump tile info 4 years ago
Jonathan G Rennison 1c1d272b57 Merge branch 'master' into jgrpp 4 years ago
translators e74069e4c2 Update: Translations from eints
estonian: 19 changes by siimsoni
french: 3 changes by glx22
4 years ago
Charles Pigott 8157af6d68 Fix #8276: Crash when a NewGRF object's size was not set 4 years ago
Charles Pigott 3af407340e Fix #8349: Close depot vehicle list windows when closing the depot window 4 years ago
Patric Stout 88959f5595
Codechange: [OSX] remove final bits of old debugging code (#8714) 4 years ago
Jonathan G Rennison c9ab460a03 Re-apply c0616750
Lost in merge: e95216b5
4 years ago
Jonathan G Rennison 2221805ddd Remove IncreaseRealtimeTick
Not needed as modal progress windows no longer use _realtime_tick
4 years ago
Jonathan G Rennison dfecdf3afb Merge branch 'master' into jgrpp
# Conflicts:
#	src/dock_gui.cpp
#	src/rail_gui.cpp
#	src/road_gui.cpp
#	src/terraform_gui.cpp
#	src/vehicle.cpp
#	src/video/allegro_v.cpp
#	src/video/cocoa/cocoa_v.mm
#	src/video/dedicated_v.cpp
#	src/video/sdl2_v.cpp
#	src/video/sdl_v.cpp
#	src/video/win32_v.cpp
4 years ago
Charles Pigott 1d6a0c7b52 Fix: [YAPF] Road pathfinder did not account for length of tunnel/bridge in path cost
Copy calculations from the rail pathfinder
4 years ago
Charles Pigott c461999b2b Fix #8594: [NRT] Road pathfinder did not account for roadtype speed limits 4 years ago
Patric Stout e1b1608dc6
Fix ec1dd0bf: missing override causing compiler warnings (#8708) 4 years ago
Michael Lutz d16dc22fdf Codechange: Use C++-ism for zeroing. 4 years ago
Michael Lutz 5ca979b1e2 Fix: [OSX] Don't wait on the event loop for drawing. 4 years ago
Michael Lutz f3c192c63d Codechange: [OSX] Only keep a total dirty rect for drawing.
When drawing an 8bpp screen buffer, palette resolving was done for each
dirty rectangle. In areas with high activity, this would mean a pixel might
have been resolved multiple times. Also, if too many individual updates
were queued, the whole screen would be refreshed, even if unnecessary.

All other drivers only keep one overall dirty rect, so do it here as well.
4 years ago
translators 61275df7da Update: Translations from eints
estonian: 62 changes by siimsoni
korean: 1 change by telk5093
russian: 2 changes by Ln-Wolf
finnish: 2 changes by hpiirai
4 years ago
frosch d9b4413bc9
Codechange: rename sound ids to make more sense. (#8701) 4 years ago
SamuXarick cb95b1d2e7 Codechange: Apply coding style 4 years ago
Patric Stout 058f13bdf9 Remove: [SDL] SDL 1.3 never happened, so remove all the special code for it 4 years ago
Patric Stout 0e76d965f1 Codechange: deduplicate tick-handlers of all video drivers
They were all identical, so better put this in a single place
hoping it is less likely to break.
4 years ago
Patric Stout 7996fadb91 Change: [Win32] Remove force_full_redraw and display_hz settings
These were special settings only for the win32-drivers, and
introduced in the very first version we track.

Time kinda had caught up with those variables, so it is time to
say farewell.

force_full_redraw was most likely a debug functionality "in case
our dirty-rect fails". This should no longer be needed.

display_hz was cute, as it had a max of 120. That is kinda
out-dated information, but I also doubt anyone was really using
this.
4 years ago
Patric Stout 23d6f4eac9 Codechange: [Win32] simplify when/where GdiFlush() is called 4 years ago
Patric Stout ec1dd0bf61 Codechange: be consistent in what CheckPaletteAnim() does and when it is called
Additionally, make sure this is a class method. Later commits
will make use of this.
4 years ago
Patric Stout 790fa7102e Codechange: be consistent in naming the paint function Paint()
Also move this function to be a class member. This to allow
further deduplicating of code in a later commit.
4 years ago
Patric Stout 761efbb457 Codechange: use (Un)LockVideoBuffer() to manage video buffer 4 years ago
Patric Stout 661eb39ecc Codechange: move all input-handling of video-drivers into InputLoop 4 years ago
Patric Stout 38b4ae1c0e Codechange: [Win32] make fast-forward check the same as with other drivers
It was of all the drivers the only one doing this slightly different.
When trying to unify more code, that was rather annoying.
4 years ago
Joe Stringer d21442941c Fix: [Cygwin] Fix missing uint definition
In file included from src/settingsgen/../string_func.h:30,
                 from src/settingsgen/settingsgen.cpp:11:
src/settingsgen/../core/bitmath_func.hpp:34:15: error: 'uint' does not name a type; did you mean 'uint8'?
   34 | static inline uint GB(const T x, const uint8 s, const uint8 n)
      |               ^~~~
      |               uint8
4 years ago
Patric Stout 08821f82b6 Fix: [Win32] run InteractiveRandom() once every tick, not once every message
Win32 was the only video driver doing this. It is just a bit too
much random.
4 years ago
Patric Stout 19fdbac287 Fix: [Win32] now we are drawing on a tick, no longer use WM_PAINT
WM_PAINT hits when-ever Windows feels like, but always after we
marked the screen as dirty. In result, it was lagging behind,
giving a sub-60fps experience.

With the new draw-tick there is no longer a need to be driven by
WM_PAINT, so it is better anyway to drive the drawing ourself. As
an added bonus this makes the win32 driver more like the others.
4 years ago
Jonathan G Rennison 8e3acbae28 Decrease model progress redraw timeout to 100ms 4 years ago
Jonathan G Rennison 68a0a4d1b9 Merge branch 'master' into jgrpp
# Conflicts:
#	src/newgrf_config.cpp
4 years ago
translators 5fc983a1bb Update: Translations from eints
german: 1 change by Wuzzy2
russian: 11 changes by Ln-Wolf
catalan: 2 changes by J0anJosep
spanish: 14 changes by perezdidac
4 years ago
Patric Stout 8bf8c0f251 Fix d437445c: also use std::chrono for the GRFFileScanner modal window
For some reason I only converted one of the two modal windows we
have, and completely forgot the other.

While at it, synchronize the way those two modal windows work
in terms of "next_update".
4 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
4 years ago
Patric Stout 932abe6d5c Fix fa170b9: [SDL2] forgot to use GetGameInterval where needed 4 years ago
Patric Stout 15a0ac2735 Fix cd4f0f95: [Allegro] driver failed to build because of missing include 4 years ago
Patric Stout c4df0f95ae Fix: during switching of game-mode, drawing could show closed windows that shouldn't be closed yet
The higher your refresh-rate, the more likely this is. Mostly you
notice this when creating a new game or when abandoning a game.

This is a bit of a hack to keep the old behaviour, as before this
patch the game was already freezing your mouse while it was changing
game-mode, and it does this too after this patch. Just now it
freezes too a few frames earlier, to prevent not drawing windows
people still expect to see.
4 years ago
Patric Stout fa170b9ace Feature: configurable refresh-rate and change default to 60fps
Most modern games run on 60 fps, and for good reason. This gives
a much smoother experiences.

As some people have monitors that can do 144Hz or even 240Hz, allow
people to configure the refresh rate. Of course, the higher you
set the value, the more time the game spends on drawing pixels
instead of simulating the game, which has an effect on simulation
speed.

The simulation will still always run at 33.33 fps, and is not
influences by this setting.
4 years ago
Patric Stout eb9b1ad68d Change: sleep till the next tick in the main loop
Sleep for 1ms (which is always (a lot) more than 1ms) is just
randomly guessing and hoping you hit your deadline, give or take.

But given we can calculate when our next frame is happening, we
can just sleep for that exact amount. As these values are often
a bit larger, it is also more likely the OS can schedule us back
in close to our requested target. This means it is more likely we
hit our deadlines, which makes the FPS a lot more stable.
4 years ago
Patric Stout ae7a2b9f02 Change: allow video-drivers to miss deadlines slightly
Before, every next frame was calculated from the current time.
If for some reason the current frame was drifting a bit, the
next would too, and the next more, etc etc. This meant we rarely
hit the targets we would like, like 33.33fps.

Instead, allow video-drivers to drift slightly, and schedule the
next frame based on the time the last should have happened. Only
if the drift gets too much, that deadlines are missed for longer
period of times, schedule the next frame based on the current
time.

This makes the FPS a lot smoother, as sleeps aren't as exact as
you might think.
4 years ago
Patric Stout c81c6e5eb7 Add: draw the screen at a steady pace, also during fast-forward
During fast-forward, the game was drawing as fast as it could. This
means that the fast-forward was limited also by how fast we could
draw, something that people in general don't expect.

To give an extreme case, if you are fully zoomed out on a busy
map, fast-forward would be mostly limited because of the time it
takes to draw the screen.

By decoupling the draw-tick and game-tick, we can keep the pace
of the draw-tick the same while speeding up the game-tick. To use
the extreme case as example again, if you are fully zoomed out
now, the screen only redraws 33.33 times per second, fast-forwarding
or not. This means fast-forward is much more likely to go at the
same speed, no matter what you are looking at.
4 years ago
Patric Stout 5bfa014505 Codechange: track _realtime_tick more accurate
_realtime_tick was reset every time the diff was calculated. This
means if it would trigger, say, every N.9 milliseconds, it would
after two iterations already drift a millisecond. This adds up
pretty quick.
4 years ago
Patric Stout 25f6851ca1 Codechange: switch all video drivers to std::chrono for keeping time
On all OSes we tested the std::chrono::steady_clock is of a high
enough resolution to do millisecond measurements, which is all we
need.

By accident, this fixes a Win32 driver bug, where we would never
hit our targets, as the resolution of the clock was too low to
do accurate millisecond measurements with (it was ~16ms resolution
instead).
4 years ago
Patric Stout d437445c67 Codechange: use std::chrono to track time in modal windows
Adding to _realtime_ticks in a random place is a bit of a hack,
and by using modern C++, we can avoid this hack.
4 years ago
Tegas Aziz 1f6fb8c290
Add: Indonesia Rupiah as in-game currency (#8616)
The exchange rate is actually more like 19,000, but OpenTTD
doesn't handle such high exchange rates kindly.
4 years ago
Didac Perez Parera 96990b2ea7
Feature: Object class selection string filtering (#8603) 4 years ago
SamuXarick 7577dfa575 Codechange: Apply coding style 4 years ago
translators 259c04f41c Update: Translations from eints
russian: 1 change by Ln-Wolf
polish: 2 changes by yazalo
4 years ago
Tyler Trahan fa88cb62e1
Fix cc39fa9: New orders are non-stop by default (#8689) 4 years ago
Jonathan G Rennison 15b99f2e7a
Fix: Whole status bar instead of money widget refreshed on money change (#8692)
This could result in the rest of the status bar being
redrawn unnecessarily frequently
4 years ago
Jonathan G Rennison 55ed7d16f7
Fix: Unnecessary status bar redraws when there is no news to show (#8691)
InvalidateWindowData with mode SBI_NEWS_DELETED was called on the
status bar when checking for a new item of news to be shown in the
ticker, even if there is no news queued and no change occurs.
4 years ago
Jonathan G Rennison e059a88533
Fix: Autorenew failure advice due to bad refit being shown to all companies (#8681) 4 years ago
Tyler Trahan d5e18feed9
Change: Darken graph grid lines for legibility (#8690) 4 years ago
Wuzzy 27b4d6390b
Change: "(Business/Chair)man" to "...person" (#8659) 4 years ago
Patric Stout 8e0d48a0f6
Fix: [SDL2] simplify what to redraw to prevent tearing (#8685)
When there are a lot of rects to redraw, of which one of the last
ones is almost the full screen, visual tearing happens over the
vertical axis. This is most visible when scrolling the map.

This can be prevented by using less rects. To simplify the situation,
and as solutions like OpenGL need this anyway, keep a single rect
that shows the biggest size that updates everything correctly.

Although this means it needs a bit more time redrawing where it
is strictly seen not needed, it also means less commands have
to be executed in the backend. In the end, this is a trade-off,
and from experiments it seems the approach of this commit gives
a better result.
4 years ago
Michael Lutz 8bd2349ab6 Fix #8676, a2c3197f: GUI-visible settings may not be part of misc settings. 4 years ago
Michael Lutz 00c66e7096 Codechange: Allow early-load settings that are not misc settings. 4 years ago
translators 8f5b8fd769 Update: Translations from eints
german: 2 changes by Wuzzy2
slovak: 5 changes by FuryPapaya
dutch: 4 changes by LouisDeconinck
spanish: 1 change by MontyMontana
4 years ago
Patric Stout 6de188d025
Fix 52317bb7: [SDL2] ensure we don't try to blit out of bounds (#8684)
During resizing, there can still be dirty-rects ready to blit based
on the old dimensions. X11 with shared memory enabled crashes if
you try to do this. So, instead, if we resize, reset the dirty-rects.

This is fine, as moments later we mark the whole (new) screen as
dirty anyway.
4 years ago
TELK 7e3ca2163d Update: Korean translation for v0.40.2 4 years ago
Yourself 310bb876a2 Add: new town council "indifferent" attitude
Closes: #184
4 years ago
Jonathan G Rennison ed9410aba9 Debug: Add house population and mail generation to debug window 4 years ago
Patric Stout 7bdb2e79ed
Fix: framerate window showed a slightly higher rate than actually measured (#8682)
The first point was counted, but also initialized as "last". As
such, it didn't add to "total", but did add to "count", which made
the "count" 1 more than the total actually represents.
4 years ago
translators c9bcc12265 Update: Translations from eints
korean: 2 changes by telk5093
indonesian: 11 changes by dimaspaf14
russian: 2 changes by Ln-Wolf
finnish: 3 changes by hpiirai
french: 4 changes by glx22
4 years ago
Jonathan G Rennison 5cd3136170 Fix: Autorenew failure advice due to bad refit being shown to all companies 4 years ago
Jonathan G Rennison 0d385c9688 Use 3rd party optional wrapper, always use local verison on Apple 4 years ago
Jonathan G Rennison aaeba6887c Revert "Cleanup: use std::optional instead of custom implementation."
This reverts commit 484ea62a62.
4 years ago
Jonathan G Rennison cb5cd11b9a Fix AddressSanitizer complaining about LanguagePack deleter
See: 024a3f62
4 years ago
Jonathan G Rennison 84eef99eaa MinGW std:🧵 suppress redundancy warning for non-debug builds
See: #216
4 years ago
Jonathan G Rennison 73be35340d Fix refreshing of vehicle panel from vehicle updates
Regression from vehicle grouping changes
4 years ago
Jonathan G Rennison 667ca4d0a7 Add help info for gfx_debug and viewport_debug console commands 4 years ago
Jonathan G Rennison 8fc4f13672 Fix train speed not being set to 0 for timetabled wait at waypoint orders 4 years ago
Jonathan G Rennison efe382b35a If realistic braking can't be enabled, show an extra viewport on the blocking signal 4 years ago
translators db246b82ac Update: Translations from eints
korean: 2 changes by telk5093
german: 56 changes by Wuzzy2
finnish: 2 changes by hpiirai
catalan: 2 changes by J0anJosep
polish: 9 changes by yazalo
4 years ago
Jonathan G Rennison aa85ebe51e Show warning icon in order window if there are timetable warnings 4 years ago
glx22 45e8b7a5bd Add: Allow translation of "(Directory)" and "(Parent directory)" 4 years ago
Tyler Trahan ce06b03fac
Fix: Stopped ships shouldn't block depots (#8578) 4 years ago
dP 91cc414588 Feature: [GS] Allow non-question type windows to have no buttons 4 years ago
milek7 751f595bb6 Fix: VkMapping declarations violated C++ ODR rule. 4 years ago