Commit Graph

312 Commits (ed1457dca335a68b74603b619584eff9f7231ef4)

Author SHA1 Message Date
Michael Lutz 57b992717b Codechange: Extend DrawSpriteToRgbaBuffer to work with 8bpp blitters. 2 years ago
Michael Lutz f40e82a19d Fix #9743: [OSX] Don't try to render touchbar sprites with invalid zoom level. 2 years ago
Danny de Bruijne 753b1d7e15 Feature: Add selected toolbar buttons to MacBook Pro Touch Bar 3 years ago
Patric Stout 0013673faf Change: prevent palette updates during copying to the video driver
ThreadSanitizer rightfully notices that the game-thread could
update the palette while the draw-thread is copying it for local
use. The odds of this are very small, but nevertheless, it does
carry a very good point.

It wouldn't hurt the application in any way, but it might cause
visual glitches on the screen.
3 years ago
Patric Stout 74186998a2 Codechange: use _cur_palette the same in all the drivers
It was a bit of a mixed bag. With this change, gfx.cpp is in
control who accesses _cur_palette from the video-drivers.
3 years ago
Patric Stout c12a152ec9
Fix: thread safety issue during exiting the game (#9380)
_exit_game is read by the draw-thread to know when to exit, but
most of the time written by the game-thread.
3 years ago
rubidium42 55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 3 years ago
Michael Lutz 418e0ea85f Codechange: Use dynamic string list for contents of land info window. 3 years ago
rubidium42 cb89d22cf2 Codechange: add DrawString(Multiline) that accepts std::string& 3 years ago
Peter Nelson 4791ff2862 Fix: Recalculate padding and minimum sizes when GUI or Font zoom is changed. 3 years ago
Peter Nelson 2efa390a7d Codechange: Simplify calling of DrawCharCentered() 3 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.
3 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.
3 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.
3 years ago
Patric Stout b9eac7c6dc Codechange: remove the unused lock around Blitter 3 years ago
Patric Stout c3dc27e37e Add: settings to limit your fast-forward game speed
By default this setting is set to 2500% normal game speed.
3 years ago
Michael Lutz 3e49aff35c Codechange: Allow video drivers to handle the cursor themselves. 3 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.
3 years ago
Michael Lutz 22f5aeab07 Feature: Automatic UI and font zoom levels when supported by the OS. 3 years ago
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 3 years ago
Charles Pigott 860c270c73 Codechange: Replace assert_compile macro with static_assert 3 years ago
Patric Stout d5b9f7ac37 Add: [Emscripten] use "relative mouse mode" with SDL2
This mode doesn't wrap the mouse constantly, but requests SDL
to lock the mouse pointer. This is needed, as with Emscripten
you are not allowed to change the mouse poisition (only to lock
it into place).
4 years ago
TechGeekNZ 8652a4db76 Cleanup: Give `SetDirtyBlocks` a more descriptive name. 4 years ago
TechGeekNZ 3d8597d42e Cleanup: Add undocumented parameter to GetSpriteSize. 4 years ago
Niels Martin Hansen 35c55dfe70 Add: Filled polygon drawing function 4 years ago
glx 42144ecd56 Add: a TextColour flag to ignore colour changes from strings 5 years ago
stormcone 40ebf3c765 Fix: Do not refer to a function in the documentation that was removed years ago (#7844)
The 'DoDrawString' was removed with this commit: f11300d
5 years ago
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 5 years ago
JMcKiern 04f659e768 Fix: Some typos found using codespell 5 years ago
Charles Pigott 327ff89808 Codechange: Remove PauseModeByte 5 years ago
Charles Pigott 96a4787710 Codechange: Set ZoomLevel's base type to byte instead of using ZoomLevelByte 5 years ago
glx 9195f2337a Codechange: use std::vector for _resolutions 5 years ago
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 5 years ago
Michael Lutz baf9229931 Codechange: Replace AutoDeleteSmallVector with direct std::vector use in text layout code. 5 years ago
Michael Lutz 329bb52613 Codechange: Store text layout runs directly as values in a std::vector instead of heap allocated.
This reduces memory allocations and heap fragmentation.
5 years ago
Michael Lutz ae748166d0 Codechange: Use platform independent C++11 function for sleeping on a thread. 5 years ago
Michael Lutz 05f4e73608 Codechange: Replace custom mutex code with C++11 mutex'es.
A conforming compiler with a valid <mutex>-header is expected.
Most parts of the code assume that locking a mutex will never fail unexpectedly,
which is generally true on all common platforms that don't just pretend to
be C++11. The use of condition variables in driver code is checked.
5 years ago
glx22 66dd7c3879
Fix: MSVC warnings (#7423) 5 years ago
Henry Wilson ab711e6942 Codechange: Replaced SmallVector::[Begin|End]() with std alternatives 5 years ago
Henry Wilson 297fd3dda3 Codechange: Replaced SmallVector::Include() with include() 5 years ago
Henry Wilson a690936ed7 Codechange: Replace SmallVector::Length() with std::vector::size() 5 years ago
Patric Stout e3c639a09f Remove: ENABLE_NETWORK switch
This switch has been a pain for years. Often disabling broke
compilation, as no developer compiles OpenTTD without, neither do
any of our official binaries.

Additionaly, it has grown so hugely in our codebase, that it
clearly shows that the current solution was a poor one. 350+
instances of "#ifdef ENABLE_NETWORK" were in the code, of which
only ~30 in the networking code itself. The rest were all around
the code to do the right thing, from GUI to NewGRF.

A more proper solution would be to stub all the functions, and
make sure the rest of the code can simply assume network is
available. This was also partially done, and most variables were
correct if networking was disabled. Despite that, often the #ifdefs
were still used.

With the recent removal of DOS, there is also no platform anymore
which we support where networking isn't working out-of-the-box.

All in all, it is time to remove the ENABLE_NETWORK switch. No
replacement is planned, but if you feel we really need this option,
we welcome any Pull Request which implements this in a way that
doesn't crawl through the code like this diff shows we used to.
5 years ago
PeterN 195fd0dc60
Fix #7266: Reorder reinitialization of caches when changing font zoom level. (#7273) 5 years ago
Greg Carlin 00d28a500d Feature: Add option to adjust font size separately from GUI size. (#7003)
Adds an option in the "Game Options" next to "Interface Size" called "Font Size". Available options are normal, double, and quad.
5 years ago
glx e76fd99c47 Fix #7007: deadlock when launched with -n switch 5 years ago
Charles Pigott f5b1115039 Doc: Lots and lots of doxymentation fixes 6 years ago
Jonathan G Rennison 458bc90678 Fix: Poor contrast in cargo dest flow legend window cargo labels.
Select foreground colour depending on the brightness of the background.

Previously all cargo labels were rendered using black text, even
the background cargo colour was dark/black.
As an example: FIRS coal was black text on a black background.
6 years ago
Patric Stout aef69443e7 Remove: WinCE support 6 years ago
frosch 3cb7d9703b (svn r27628) -Codechange: Prepare for drawing cursors consisting of multiple sprites. 8 years ago
frosch 4d1843a95e (svn r27627) -Codechange: Deduplicate some cursor magic into SetMouseCursorBusy. 8 years ago