Commit Graph
275 Commits
Author SHA1 Message Date
Patric StoutandGitHub 4d501655ad Fix: building on Raspberry Pi failed because of const vs constexpr (#8924) 2021-04-01 19:39:55 +02:00
Patric StoutandGitHub 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.
2021-02-17 21:19:32 +01:00
Charles PigottandGitHub 9b800a96ed Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
Charles Pigott 860c270c73 Codechange: Replace assert_compile macro with static_assert 2020-12-27 10:55:42 +00:00
Michael Lutz 79240eab1e Codechange: Make use of the improved C++17 emplace_back function. 2020-12-15 00:29:30 +01:00
TechGeekNZandNiels Martin Hansen 716c883737 Fix: Globally apply preprocessor directive coding style
Global; except for the 32-bit SSE blitter, which has some #DEFINEs
in not-very-nice places.
2020-07-03 09:08:46 +02:00
Patric Stoutandglx22 56d54cf60e Add: introduce CMake for project management
CMake works on all our supported platforms, like MSVC, Mingw, GCC,
Clang, and many more. It allows for a single way of doing things,
so no longer we need shell scripts and vbs scripts to work on all
our supported platforms.

Additionally, CMake allows to generate project files for like MSVC,
KDevelop, etc.

This heavily reduces the lines of code we need to support multiple
platforms from a project perspective.

Addtiionally, this heavily improves our detection of libraries, etc.
2020-06-05 19:36:05 +02:00
Michael Lutz f2b40f40aa Codechange: Replace SmallPair with std::pair.
std::pair is already the smallest possible pair, and it already handles non-POD types correctly.
2020-05-21 20:02:34 +02:00
CharlèneandCharles Pigott 2196cd3cf8 Fix: OpenBSD endianness detection 2020-02-11 13:01:45 +00:00
Jonathan G RennisonandCharles Pigott 150dfba95b Codechange: Remove std::function from Pool iteration wrapper
Add a separate template wrapper for filtered iteration
2020-01-07 09:00:45 +00:00
glxandNiels Martin Hansen e3c75a30ba Fix: unused variable warnings 2019-12-21 20:13:03 +01:00
glxandNiels Martin Hansen ae532008ff Cleanup: remove FOR_ALL_ITEMS 2019-12-21 20:13:03 +01:00
glxandNiels Martin Hansen 68f22134cb Add: Allow iteration of pools in range-based for loops 2019-12-21 20:13:03 +01:00
S. D. CloudtandCharles Pigott 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
GabdaandNiels Martin Hansen 652fb40652 Codechange: Performance improvement in k-d tree FindNearest() 2019-10-08 08:53:19 +02:00
JMcKiernandCharles Pigott 04f659e768 Fix: Some typos found using codespell 2019-09-29 21:27:32 +01:00
Nikolas NybyandCharles Pigott 28e11623bd Codechange: math functions - use cpp-style casts 2019-08-31 20:27:56 +01:00
GabdaandCharles Pigott b870596f15 Add #6887: Option to show zone inside local authority boundary of towns
Can be found at town information > local authority window
Layout for button is same as Graph Keys
Turn on/off for every town individually
2019-08-17 21:45:20 +01:00
glxandCharles Pigott 26aa3b8623 Remove: grow() helper function 2019-05-04 19:50:53 +01:00
Charles PigottandPeterN 9e19a5f93e Remove: (Simple)TinyEnumT 2019-04-29 17:40:22 +01:00
peter1138andPeterN 66cd32a252 Codechange: Use std::underlying_type for DECLARE_POSTFIX_INCREMENT. 2019-04-21 22:31:12 +01:00
peter1138andPeterN ac1e1a272f Fix: Replace int with std::underlying_type in DECLARE_ENUM_AS_BIT_SET.
This fixes 64 bit uses of this macro.
2019-04-21 22:31:12 +01:00
glxandglx22 ebd4f32d15 Cleanup: remove core/sort_func.hpp as it's not used anymore 2019-04-18 21:49:34 +02:00
glxandglx22 9195f2337a Codechange: use std::vector for _resolutions 2019-04-18 21:49:34 +02:00
Michael LutzandCharles Pigott 38729297f9 Codechange: No need for AutoFreePtr if there's std::unique_ptr. 2019-04-15 22:52:50 +01:00
Michael LutzandCharles Pigott 4e85ccf3c0 Codechange: Replace SmallStackSafeStackAlloc with std::array.
The only port that ever used it to make heap allocations instead of stack ones was the NDS port, which got thrown out some time ago.
2019-04-15 22:52:50 +01:00
glxandglx22 410b81537c Fix 801cbea9c: operator< is not always the best idea
Also removes unused and anyway broken SmallMap::SortByKey() function.
2019-04-13 21:05:25 +02:00
glxandPeterN 801cbea9cc Codechange: use std::sort() for all std::vector types 2019-04-13 12:49:18 +01:00
Henry WilsonandMichael Lutz 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
Michael Lutz 8b1880187a Remove: AutoFreeSmallVector.
The last use was for storing a list of memory blocks. As the way these lists are accessed is very
specific, it is easier to just write an explicit destructor instead of trying to exactly match the behaviour.
2019-04-09 22:45:15 +02:00
Michael Lutz e804173595 Codechange: If something is a vector of strings, use a vector of strings instead of an AutoFreeSmallVector. 2019-04-09 22:45:15 +02:00
Michael Lutz c7b9987d08 Codechange: Switch DropDownList to directly use std::vector, thus making AutoDeleteSmallVector obsolete.
DropDownListItem are strongly managed using std::unique_ptr to ensure leak-free handling. Appropriate use
of move-semantics make intent a lot clearer than parameter comments and allows the compiler to generate
copy-free code for most situations.
2019-04-09 22:45:15 +02:00
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.
2019-04-06 11:27:39 +02:00
Michael LutzandCharles Pigott 21d9e87b46 Fix #7165: Const overload SmallMap::Contains(key) compared wrong types.
Const and non-const Find() have different return types.
2019-03-28 00:04:28 +00:00
stormconeandCharles Pigott ee260e4704 Fix #7165: SmallMap::Erase(key) does not work correctly 2019-03-28 00:04:28 +00:00
glx22andGitHub 66dd7c3879 Fix: MSVC warnings (#7423) 2019-03-28 00:09:33 +01:00
Charles PigottandPeterN ed9005690a Fix #7421: Don't (directly) dereference std::vector::end() in SmallMap 2019-03-27 06:31:49 +00:00
Henry WilsonandPeterN 03ca3190c9 Codechange: Use range-based for-loop in Auto[Free|Delete]SmallVector 2019-03-26 20:15:57 +00:00
Henry WilsonandPeterN cc62f4163f Cleanup: Remove unused size template parameters from SmallMap and Auto[Free|Delete]SmallVector 2019-03-26 20:15:57 +00:00
Henry WilsonandPeterN c01a2e2a81 Codechange: Removed SmallVector completely 2019-03-26 20:15:57 +00:00
Henry WilsonandPeterN 6570f7989f Codechange: Declare SmallVector as an alias for std::vector 2019-03-26 20:15:57 +00:00
Henry WilsonandPeterN ab711e6942 Codechange: Replaced SmallVector::[Begin|End]() with std alternatives 2019-03-26 20:15:57 +00:00
Henry WilsonandPeterN 297fd3dda3 Codechange: Replaced SmallVector::Include() with include() 2019-03-26 20:15:57 +00:00
Henry WilsonandPeterN 2bc2de9034 Codechange: Replaced SmallVector::Find() with std::find() 2019-03-26 20:15:57 +00:00
Henry WilsonandPeterN e0c58bf5ee Codechange: Removed SmallVector::Insert() 2019-03-26 20:15:57 +00:00
Henry WilsonandPeterN a0f36a50e6 Codechange: Replaced SmallVector::Append() with std::vector::[push|emplace]_back() 2019-03-26 20:15:57 +00:00
Henry WilsonandPeterN ca2f33c6d0 Codechange: Replaced SmallVector::Erase() with std::vector::erase() 2019-03-26 20:15:57 +00:00
Henry WilsonandPeterN 097328c3d7 Codechange: Replaced SmallVector::Get() const with std alternatives 2019-03-26 20:15:57 +00:00
Henry WilsonandPeterN aa7ca7fe64 Codechange: Replaced SmallVector::Get(n) non-const with std::vector::data() + n 2019-03-26 20:15:57 +00:00
Henry WilsonandPeterN bc7dcaffca Codechange: Removed SmallVector::Assign() 2019-03-26 20:15:57 +00:00