Commit Graph

18460 Commits (59b6e46bcee466532e7dae3a272079ecdafa0ae1)

Author SHA1 Message Date
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 7af1fd3ffb Add: [OSX] OpenGL video driver. 4 years ago
Michael Lutz b4a3bc1ffe Codechange: [OpenGL] Separate context state setup from general init. 4 years ago
Michael Lutz 7f55f0a264 Codechange: [OSX] Add support for (un)locking the video buffer. 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
Michael Lutz af4d32357c Codechange: [Win32] Move common initialization and finalization to the video driver base class. 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 8b90d4abe0 Codechange: [Win32] Move GDI specific drawing code into the GDI video driver class. 4 years ago
Michael Lutz 59e0d9618b Codechange: [Win32] Split the video driver into a base class and a GDI backend class. 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
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
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
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
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
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
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
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
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
frosch 5a1fa18509 Change: move the 'road drive side' selection to settings tree, and give it the same 'basic' visibilty as 'signal side'. 4 years ago
frosch c71d0f5e7f Change: move townname generator selection to mapgen GUI. 4 years ago
frosch f513a807db Codechange: move non-GUI code to non-GUI source files. 4 years ago
frosch 4ce941bbc2 Codechange: turn a constant variable into a real constant. 4 years ago
frosch d17226910d Codechange: minor rearrangement of settings in random map and heightmap GUI. 4 years ago
frosch 81e47277e7 Change: move the 'tree placer algorithm' selection to the settings tree window, and give it the same 'basic' visibility as 'in-game tree placement'. 4 years ago
translators 6b04b7cf18 Update: Translations from eints
slovak: 13 changes by FuryPapaya
catalan: 7 changes by J0anJosep
french: 1 change by arikover
4 years ago
Michael Lutz 8d780e0607 Add: [OSX] Automatic zoom level suggestion for Cocoa video driver. 4 years ago
Michael Lutz f175e38666 Add: [Win32] Automatic zoom level suggestion for Win32 video driver.
The zoom level suggestion is based on the DPI scaling set in Windows.
We use 150% scaling as the threshold for 2X zoom and 300% scaling
as the threshold for 4X zoom.
4 years ago
Michael Lutz f137b3057a Codechange: [Win32] Increase SDK version for 32-bit target.
Use the same Windows XP target as for 64-bit. Current MSVC version will
not produce a binary that works on anything earlier anyway.
4 years ago
Michael Lutz 33099355b8 Codechange: Re-init GUI zoom only when really changed. 4 years ago
Michael Lutz 22f5aeab07 Feature: Automatic UI and font zoom levels when supported by the OS. 4 years ago
Michael Lutz a2c3197f42 Codechange: Make the settings for min/max zoom early load settings. 4 years ago
Michael Lutz f5555a6d26 Fix 9c872192: [OSX] Clear mouse button emulation flag. 4 years ago
Michael Lutz e5c3253642 Add: [OSX] Setting to disable HiDPI graphics rendering. 4 years ago
Michael Lutz 0fc763bc55 Change: [OSX] Render screen in full native resolution on HiDPI displays. 4 years ago
Michael Lutz 8906e9e0fd Codechange: Consistently use screen size and not driver resolution for determining window sizes. 4 years ago
Michael Lutz b66e977acd Change: [OSX] When auto-detecting a font, try for sans-serif first.
On a display, especially with small fonts or low pixel sizes, sans-serif
fonts are usually easier to read than serif fonts.
4 years ago
Michael Lutz 6755ff63e1 Add: [OSX] Native font rendering without using FreeType. 4 years ago
Michael Lutz 21a2cd7bc3 Codechange: Replace magic numbers by constants. 4 years ago
Charles Pigott 8121706b89 Fix #8620: Scale spacing between date & news in history window according to font scaling 4 years ago
Charles Pigott 2b08f21625 Fix #8625: Wrong ending year was displayed in highscore table 4 years ago
Charles Pigott f1fc083f2b Change: Make order window hotkeys toggle for load & unload variants 4 years ago
Michael Lutz acca56b6a5 Cleanup: [OSX] Improve some comments. 4 years ago
Michael Lutz c78e559e88 Codechange: [OSX] Remove unused 'app active' flag. 4 years ago
Michael Lutz 9c8721922b Fix: [OSX] An emulated right mouse down event has to be followed by right mouse up. 4 years ago
Michael Lutz 649ff5f9f9 Codechange: [OSX] Use relative mouse handling during scrolling. 4 years ago
Michael Lutz 43326d11d8 Change: [OSX] Use a layer-backed view to speed up drawing. 4 years ago
Michael Lutz 2a8c3a2cf6 Codechange: [OSX] Align backing buffer pitch for a tiny bit performance. 4 years ago
Michael Lutz 94b76ce9a4 Cleanup: [OSX] Move event loop into video driver file. 4 years ago
Michael Lutz 23389e9491 Remove: [OSX] Startup splash screen.
It wasn't displayed anyway as it was never copied to the bundle.
4 years ago
Michael Lutz 063b90b97d Codechange: [OSX] Move key event handling to our view. 4 years ago
Michael Lutz f4bd54fedd Codechange: [OSX] Move mouse event handling to our NSView. 4 years ago
Michael Lutz bd42fc94cc Codechange: [OSX] Move some things from video driver to our NSView. 4 years ago
Michael Lutz 965ce12947 Codechange: [OSX] Use newer mouse tracking API. 4 years ago
Michael Lutz 42af13c141 Codechange: [OSX] Split drawing into its own subview.
This allows the drawing backend code to be independent
of any event or command handling.
4 years ago
Michael Lutz 60f30036f1 Codechange: [OSX] Drain autoreleased objects in each game loop cycle. 4 years ago
Michael Lutz 8aaf4ea098 Codechange: [OSX] Split Window and back buffer creation in Cocoa video driver. 4 years ago
Michael Lutz 0eff7de659 Cleanup: [OSX] Doxygen comment style in video driver. 4 years ago
Michael Lutz 8ced72ab10 Codechange: [OSX] Inline some functions that are used in only one place. 4 years ago
Michael Lutz 13134f9d64 Codechange: [OSX] Replace #define with modern code. 4 years ago
Michael Lutz 88f6c7a9f3 Codechange: [OSX] Fold remaining Cocoa video subdriver into the main driver. 4 years ago
Michael Lutz e6bea3961f Change: [OSX] Replace screen resolution list with suggested window sizes.
We never change the real screen resolution on OSX. As such, offering a list
of resolutions is pointless. Instead of that, offer the user a list of
commonly used window sizes up to the current screen size.
4 years ago
Michael Lutz 4db7837d06 Codechange: [OSX] There is only one subdriver left, remove virtual dispatch. 4 years ago
Michael Lutz 63ed3f3575 Codechange: Move Fontconfig-specific code to a seperate file. 4 years ago
Michael Lutz f2294851e6 Codechange: [OSX] Move OSX-specific font code to a separate file. 4 years ago
Michael Lutz c6af8f16f6 Codechange: [Win32] Move Win32-specific font code to a seperate file. 4 years ago
Michael Lutz 5ad1640984 Codechange: Make OS font handle of the FontCache read-only. 4 years ago
Michael Lutz 2b0200d429 Codechange: OS-specific data for font search is not used outside of searching. 4 years ago
Michael Lutz 84636fc2af Codechange: Remove all remaining uses of cpp_offset. 4 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.
4 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.
4 years ago
translators 0f621b4956 Update: Translations from eints
portuguese (brazilian): 36 changes by AKANexus
4 years ago
SamuXarick 36ab9c64ef Fix: Desert/rainforest data coordinate 'y' is off by 1 when their 'x' coordinate is negative 4 years ago
Charles Pigott d9df20d102 Change: Use a more specific error message when attempting to bulldoze your own HQ 4 years ago
glx22 348f322df1 Fix f1f281b31: [Win32] MinGW doesn't know timeapi.h 4 years ago
glx22 5a4d5f03b0 Codechange: Implement a constructor for CurrencySpec 4 years ago
Johannes E. Krause 3ac43582c2 Codechange: [NewGRF] Make it more explicit which parts of the TTD vehicle structure (var 80+) are not implemented 4 years ago
translators fa0704138d Update: Translations from eints
spanish (mexican): 7 changes by absay
dutch: 7 changes by Afoklala
french: 7 changes by arikover
4 years ago
Patric Stout 52317bb7df Change: [SDL2] Remove unneeded delay of redrawing the screen
In testing, I could find no reason why this statement is here.

The comment is rather unclear (it states what it does, but not
why it would be needed).

This line of code was introduced with f4f40448, which gives no
further insight on why it would be needed to have it here.

As such, let's remove it and see if anyone else reports any
problems with it. If so, this commit can be reverted and a more
clear comment should be added what this line of code is dealing
with (the WHY, not the WHAT).
4 years ago
Patric Stout 2e1535389a Codechange: [SDL2] Don't use globals if we can do with locals 4 years ago
Patric Stout 2bbef6b5cf Codechange: [SDL2] Name paint function Paint(), like other drivers do
This reduces confusion when reading different drivers.
4 years ago
Patric Stout 569ce6c7b4 Fix 30e69c51: palette was not marked dirty when creating a new
This means the code depended that the caller did this for us
before MakePalette() is executed, which is neither a
requirement nor a promise the code makes.
4 years ago
translators 64e2d6b672 Update: Translations from eints
korean: 7 changes by telk5093
russian: 11 changes by Ln-Wolf
finnish: 7 changes by hpiirai
4 years ago
Kuhnovic 83ddb1501f
Feature: Remove all industries button in scenario editor (#8550) 4 years ago
Loïc Guilloux f1f281b318
Fix: [Win32] Set minimum resolution for timers to 1ms. (#8660) 4 years ago
embeddedt 6c8f2227cd
Fix: [Emscripten] open links in browser (#8655) 4 years ago
Patric Stout ac2b5e57cf
Fix: mention our websites with https:// (instead of http://) (#8657)
It is 2021. Nobody should advertise http anymore. Not even us.
4 years ago
glx22 2cbfcd2327 Change: [CMake] Bump minimum version to 3.9 4 years ago
Loïc Guilloux b927da73c1
Fix 81d335b081: Use non-pulsating red highlight for coverage (#8622) 4 years ago
Matt Kimber 2a6da319b2
Fix 0125892: Don't crash when towns upgrade road tiles during expansion (#8651) 4 years ago
Patric Stout 2c9084d48c
Fix #8029: [SDL2] disable draw-thread on wayland SDL video driver (#8648)
When the wayland SDL video driver is used, an EGL context is
created in the main thread. It is not allowed to update this
context from another thread, which is exactly what our draw-thread
is trying.

The other solution would be to move all of SDL into the
draw-thread, but that would introduce a whole scala of different
problems.

The wayland SDL backend is significantly faster than the
X11 SDL backend, but there is a performance hit nevertheless.
4 years ago
SamuXarick a4035af337
Codechange: Apply coding style (#8640)
* Fix: Missing or needed spaces

* Codechange: Remove space

* Codechange: Remove space

* Codechange: More missing spaces

* Codechange: Missing spaces

* Codechange: Remove space

* Codechange: Remove space
4 years ago
translators 5b3fe4ae27 Update: Translations from eints
german: 4 changes by Wuzzy2
4 years ago
glx22 144991990e Fix: [CMake] Language files should depend on english.txt 4 years ago
translators 696b6990ea Update: Translations from eints
estonian: 110 changes by siimsoni
4 years ago
translators 069fb54253 Update: Translations from eints
estonian: 17 changes by siimsoni
german: 410 changes by Wuzzy2
4 years ago
Patric Stout 7fbf705c41
Fix 2db88953: default Network Server List sorter put compatible servers in wrong order (#8626)
If a server is compatible, it falls back to sorting by clients.
This used to be in reverse, so full servers are on top. With
the codechange commit, this was removed by accident, and as
such empty servers were on top. This is silly.
4 years ago
Tyler Trahan 1dda7d6486
Fix: don't walk out of the map when trying to build tunnels (#8600) 4 years ago
Patric Stout 0e54c32452 Codechange: [SDL2] Use MakeDirty() to force a redraw
The original code is "strictly correct", but just reads really
weird, and we use MakeDirty() in several other places instead too.
4 years ago
Patric Stout 30e69c518b Codechange: [SDL2] Rework how palette is updated
It now follows more what the Win32 driver does, and has far less
exceptions and special casing.

MakePalette creates the Palette and prepares surface.
UpdatePalette updates the Palette.
CheckPaletteAnim checks if UpdatePalette needs to be called and
  marks the whole screen dirty so DrawSurfaceToScreen will do a
  full redraw.
4 years ago
Patric Stout eb80fefd1d Fix: [SDL2] Display why SDL_CreateWindow() failed in case it does
All SDL_NNN errors print SDL_GetError, except for this one place.
4 years ago
Patric Stout 19345908cb Codechange: [SDL2] Split away CreateMainWindow from CreateMainSurface
This makes the code a bit more readable, as both intentions are
more clear, and there is less nesting in the main function.
4 years ago
Patric Stout 8c37e5c526 Codechange: [SDL2] reworked the different surfaces to make it more readable 4 years ago
Patric Stout 8de325f256 Codechange: [SDL2] Only prepare "caption" if you are going to us it 4 years ago
Patric Stout e41ec5b42e Codechange: [SDL2] Minor code cleanup to remove silly variable 4 years ago
Patric Stout 678031f9b3 Codechange: [SDL2] Only set _cur_palette, never _local_palette 4 years ago
Patric Stout f31b65825f Codechange: [SDL2] Move FindStartupDisplay to its own function 4 years ago
Patric Stout 6916fc76bd Codechange: [SDL2] reworked FindResolutions to be more like the rest
There was no default resolution fallback, and the code was different
from the win32 driver. It is now named the same and much more
similar.
4 years ago
Patric Stout a52d716c88 Codechange: [SDL2] remove include-protection
This is already done by CMake: if SDL2 is not detected, this file
is not included.
4 years ago
translators 5ae2c1552b Update: Translations from eints
estonian: 353 changes by siimsoni
4 years ago
translators 48698403a8 Update: Translations from eints
estonian: 85 changes by siimsoni
korean: 30 changes by telk5093
portuguese: 24 changes by CheapWebdesign
4 years ago
translators 3dac139b00 Update: Translations from eints
estonian: 5 changes by siimsoni
hungarian: 7 changes by andrejmoltok
4 years ago
translators da78b5c130 Update: Translations from eints
estonian: 117 changes by siimsoni
german: 5 changes by Wuzzy2
slovak: 23 changes by FuryPapaya
4 years ago
translators 027452fef8 Update: Translations from eints
german: 11 changes by Wuzzy2
4 years ago
translators 67fa5a23b9 Update: Translations from eints
estonian: 7 changes by siimsoni
4 years ago
translators b2d9a2dc79 Update: Translations from eints
estonian: 12 changes by siimsoni
finnish: 1 change by hpiirai
4 years ago
glx22 6b8ad5a9b1 Change: Apply some consistency to singleplayer related comments 4 years ago
glx22 07385c3662 Fix: Use the same safety checks as 'stop_ai' for 'reload_ai' 4 years ago
glx22 485aafc1b7 Fix: Never delete the last existing company in singleplayer mode 4 years ago
dP b17177bd20 Fix: Center text and image in vehicle statusbar vertically 4 years ago
translators 8fe79e153d Update: Translations from eints
estonian: 8 changes by siimsoni
german: 89 changes by Wuzzy2
finnish: 2 changes by hpiirai
dutch: 27 changes by Afoklala
4 years ago
dP bab7de6cf2 Feature: Allow GameScripts to add additional text to Industry view window 4 years ago
Pavel Stupnikov 4b42ecb0f6
Feature: Add tile parameter for GSCompany.ChangeBankBalance to show text effect if needed (#8573) 4 years ago
translators 33e27e9480 Update: Translations from eints
estonian: 15 changes by siimsoni
russian: 23 changes by Ln-Wolf
4 years ago
translators 6e1581a17d Update: Translations from eints
german: 2 changes by Wuzzy2
russian: 13 changes by Ln-Wolf
4 years ago
translators 27caabdb91 Update: Translations from eints
german: 23 changes by Wuzzy2
russian: 70 changes by Ln-Wolf
4 years ago
frosch b3d048dfcf
Change: [NewGRF] industry special flag 19 now specifically targets only passenger production, instead of the second cargo of any water-based industry. (#8590)
This behavior is less surprising to NewGRF authors, and may even be intentional behavior for some industries.
4 years ago
Michael Lutz 7da224d29d
Fix #8589, 653e7fa548: Motion counter is NewGRF-visible but not saved, leading to desyncs. (#8591) 4 years ago
Owen Rudge 6d95ed53dc Feature: Add support for rdtsc for ARM-based Windows (MSVC) 4 years ago
Patric Stout 1eceee915e Codechange: [SDL2/Win32] Be consistent how 0bpp blitters are not allowed
Sometimes it returned an usererror(), sometimes Start() failed.
Now it always fails on Start(), so nothing else has to check again
what blitter is used.

AfterBlitterChange() can never change to a 0bpp, so it is sufficient
to guard this with an assert().
4 years ago
Patric Stout 49df9c4155 Codechange: [Win32] Use _local_palette for most operations
Other drivers do this too, and this makes the world a bit more
the same.
4 years ago
Patric Stout 881d17d8f1 Codechange: [Win32] use CSleep() instead of Sleep() like everywhere else
Functional it is identical. Just helps future-us when searching
for sleeps.
4 years ago
Patric Stout 689404a4a1 Codechange: [Win32] Use return-early in RegisterWndClass() 4 years ago
Michael Lutz 7415964a4d Codechange: [Win32] Remove Windows 95 specific mouse tracking work-around. 4 years ago
Matt Kimber 40d5fe1631
Fix eeb88e8: Trains reversed while paused do not correctly update sprite bounds (#8540) 4 years ago
translators 120c6fda61 Update: Translations from eints
catalan: 11 changes by J0anJosep
4 years ago
frosch 540fdfbf5a
Fix 0e62a398c7f: Only center the window, when it is smaller than the screen. (#8581) 4 years ago
translators c91a7b5e2e Update: Translations from eints
norwegian (bokmal): 65 changes by fnutt
french: 1 change by glx22
4 years ago
frosch 0e62a398c7
Add: [SDL2] video driver parameter to put OpenTTD on a particular display on start. By default use the display where the mouse cursor is. (#8572) 4 years ago
Michael Lutz fa60c1f8b9
Feature: Choose a sensible window size on a fresh OTTD config file. (#8536) 4 years ago
translators 711723d738 Update: Translations from eints
norwegian (bokmal): 10 changes by buzzCraft
spanish (mexican): 7 changes by absay
korean: 1 change by telk5093
indonesian: 30 changes by dimaspaf14
finnish: 1 change by hpiirai
catalan: 2 changes by gerardnll
portuguese (brazilian): 4 changes by AKANexus
polish: 1 change by yazalo
4 years ago
glx22 86818e5ae8
Fix #7670: prevent useless pathfinder run for blocked vehicles 4 years ago
Jonathan G Rennison 1411f878ab
Add: Console command to dump debugging information (#8548) 4 years ago
translators b99eafbfb0 Update: Translations from eints
korean: 14 changes by telk5093
finnish: 1 change by hpiirai
spanish: 41 changes by MontyMontana
polish: 5 changes by yazalo
4 years ago
Charles Pigott ebaecebc68 Fix #8560: Planes were landing at the wrong height at airports with lowered hangar tiles 4 years ago
SamuXarick f9dee5aaa0 Feature: Show rainforest under vegetation on small map 4 years ago
Patric Stout de44ce2092
Change: darken the background of all graph to increase contrast (#8557)
Now lines like Mauve, Dark Green and Purple are much more visible
without hurting the other colours.
4 years ago
Patric Stout c6fd6cfd15 Fix: tell the user if a font fails to load and fallback is about to be used
Additionally, tell exactly why the font failed to load, which
glyph was missing from the font. This hopefully helps the user
a bit more in the right direction.
4 years ago
Patric Stout 98400974a9 Codechange: nobody was using "str" parameter, so remove it 4 years ago