Commit Graph

51349 Commits (5afa1b93eba08224e88f69b10b241da4bd76dc8f)
 

Author SHA1 Message Date
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 b124c49ea4 Fix: [Actions] Also run CI against libsdl1.2 for every pull request 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 cb8e1706b2 Fix: [Actions] if SDL2 is installed, it is always picked over SDL1
So no need to install both SDL1 and SDL2, that gives a false idea
of reality.
4 years ago
Patric Stout d3df4674f9 Fix: [Actions] build our allegro driver too in our CI
This prevents us breaking it without realising.
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 bebe3acaa8
Merge pull request #217 from telk5093/jgrpp
Update: Korean translation for v0.40.2
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
Jonathan G Rennison 66b9e80315 Version: Committing version data for tag: jgrpp-0.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 6089347833 Revert "Cleanup: src/3rdparty/optional was removed, also remove its licensing note. (#8567)"
This reverts commit 516e863395.
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
Joan Josep b7a1750863 Doc: Add labels to landscape grid description. (#8452)
(cherry picked from commit a18188ae90)
4 years ago