Commit Graph

389 Commits

Author SHA1 Message Date
Peter Nelson d78f39a9df
Cleanup: Remove GetUnitsPerEM and units_per_em. (#12656)
GetUnitsPerEM is never called.
2024-05-11 14:50:34 +01:00
Peter Nelson ec61951512
Cleanup: Remove Windows 9x font locale workaround. (#12644) 2024-05-09 07:03:02 +01:00
Peter Nelson a1a01e21cf
Change: Use std::make_unique instead of passing new() (#12539) 2024-04-20 11:20:49 +01:00
Peter Nelson a28ab8cac2
Codechange: Replace C-style casts to size_t with static_cast. (#12455)
* Codechange: Replace C-style casts to size_t with static_cast.

This touches only simple value-type casts.

* Codechange: Replace static_cast<size_t>(-1) with SIZE_MAX

Co-authored-by: Rubidium <rubidium@openttd.org>
2024-04-19 20:34:36 +01:00
Peter Nelson 63ce81570c Remove: Custom opendir implementation for Windows no longer needed.
std::filesystem::directory_iterator is now used instead.
2024-04-18 01:41:14 +01:00
Peter Nelson d7c547d0db Codechange: Use directory_iterator to list directories in file list windows.
This replaces use of custom ttd_opendir. Files are listed separately using ScanPath as that handles downloaded content.
2024-04-18 01:41:14 +01:00
Rubidium eda10abc8c Codechange: pass command line arguments as std::span to openttd_main 2024-04-11 21:57:53 +02:00
rubidium42 442daf58da Codechange: replace lengthof with std::size in Windows specific code 2024-04-10 23:17:13 +02:00
Peter Nelson 3c94e81665 Codechange: Use ZOOM_LVL_MIN to refer to first zoom level.
Many uses of ZOOM_LVL_NORMAL actually just want the first zoom level slot, so use ZOOM_LVL_MIN to make this clearer.
2024-04-04 22:27:03 +01:00
Loïc Guilloux 11aa3694fa
Fix: [Win32] Force font mapper to only use TrueType fonts (#12406) 2024-04-01 22:59:13 +02:00
Rubidium caa7c44052 Cleanup: remove checks for old MSVC versions 2024-03-24 10:09:15 +01:00
Patric Stout a3cfd23cf9
Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
Peter Nelson 466e6bb524
Fix #12037: Blurry OpenTTD font on Mac OS. (#12047) 2024-02-09 21:36:13 +01:00
frosch b1718478c8 Codechange: Replace old non-standard attributes with C++17/20 standard attributes. 2024-02-02 22:29:28 +01:00
Loïc Guilloux 0e738dda88
Fix #11948: [Win32] Convert error messages to utf8 (#11951) 2024-02-02 16:30:23 +01:00
Peter Nelson 6a2c37b4ed
Fix 09f585b: Crash if font name ends with comma or comma and whitespace on Linux. (#11838) 2024-01-19 08:03:32 +00:00
Peter Nelson ae575a7a5b Codechange: Store text run positions in vector of points.
This simplifies the interlaced vector of x/y positions.
2024-01-19 00:08:31 +00:00
Peter Nelson f7cc88f370 Codechange: Return vector references instead of pointer to first item. 2024-01-19 00:08:31 +00:00
Michael Lutz 20f1a0dc57 Fix: [OSX] Spurious log message when a sprite glyph was layouted. 2024-01-14 22:50:56 +01:00
Michael Lutz 36cf6b1d13 Feature: Scalable OpenTTD TrueType font made by Zephyris.
This uses the normal variant for the small font, not the all-caps version.
2024-01-14 22:50:56 +01:00
Michael Lutz 6e766a2e81 Change: Allow TrueType fonts to provide our private-use glyphs. 2024-01-14 22:50:56 +01:00
Loïc Guilloux 93ba6d6776
Fix: compilation without precompiled headers (#11770) 2024-01-14 13:27:03 +01:00
Loïc Guilloux 03df70ce8a
Fix #11752: [Win32] Wrong multi-line text layout due to incorrect partial run handling (#11761) 2024-01-12 19:40:08 +01:00
Patric Stout d3ee045c2d
Codechange: refactor the Windows-only DllLoader in a cross-platform LibraryLoader (#11751) 2024-01-10 21:38:58 +00:00
Rubidium 3a676a5af0 Codechange: replace static inline with static for non-class functions 2024-01-06 13:37:33 +01:00
Rubidium e3f49ee7a0 Codechange: coding style fixes 2024-01-04 16:23:54 +01:00
Peter Nelson b85ecf9ac2
Codechange: Replace pointer to Sprite array with reference to SpriteCollection. (#11580)
Add `SpriteLoader::SpriteCollection` type which is an array of `SpriteLoad::Sprite`.

This removes the ambiguity of what `SpriteLoader::Sprite *` is pointing to,
and cleans up mismatches using both dereference -> and array access [] for the
same object.
2023-12-20 20:38:21 +00:00
rubidium42 27082f9efa Codechange: pass std::string references to OpenBrowser 2023-11-29 02:02:30 +01:00
Peter Nelson 1071acb483
Codechange: Redundant use of char * and c_str(). (#11454) 2023-11-10 00:17:36 +00:00
Peter Nelson d4008850e3 Codechange: Ensure function opening `{` is on new line. 2023-11-09 20:15:38 +00:00
Michael Lutz 86e28e79fb Fix #11402: Make string filter locale-aware. 2023-11-03 22:34:01 +01:00
Rubidium c6411168d8 Cleanup: missing spaces before continuation * in some comments 2023-11-01 22:56:11 +01:00
Rubidium f16399f4c9 Codechange: replace x.size() > 0 with !x.empty() 2023-10-20 23:05:43 +02:00
Rubidium c9276c2959 Codechange: replace x.size() == 0 with x.empty() 2023-10-20 23:05:43 +02:00
Loïc Guilloux 0458c15060
Cleanup: [MacOS] Remove unneeded WITH_SDL checks (#11360) 2023-10-09 19:35:15 +02:00
frosch 55da426d44 Codechange: All ParagraphLayoutFactory::AppendToBuffer assume that the buffer has at least some space.
Assert on that.
2023-09-19 22:49:59 +02:00
frosch 5733145c59 Cleanup: Remove unneeded parameters. 2023-09-19 22:49:59 +02:00
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
frosch a3f661cb66
Fix: compilation failed on gcc 10.2 due to missing include. (#11300)
'_exit' is defined in 'unistd.h'.
2023-09-15 09:26:03 +01:00
Patric Stout 37e2f99c09
Change: store crash logs in JSON format (#11232) 2023-09-14 20:13:27 +02:00
Patric Stout ba67f39db6
Codechange: vendor the nlohmann-json library (#11290) 2023-09-13 16:11:34 +02:00
Patric Stout a3d631ffed
Change: make nlohmann a mandatory library to build OpenTTD (#11235) 2023-08-28 19:04:36 +02:00
Patric Stout b0d7cfaa3d
Change: [Win32] don't allocate 192KiB of memory on the stack on crash (#11240)
Heap is out of the question, as it might be corrupted.
Allocating this much on stack is silly.

So instead, allocate virtual pages to write the information in.
2023-08-28 12:14:11 +02:00
Patric Stout d4312c59a4
Codechange: [MacOS] use backtrace() instead of our custom variant (#11233)
As mentioned in the comment, we only did it ourselves as we once
were compatible with versions before 10.5. But that time has long
gone. So let's update the code to a bit more modern approach.
2023-08-27 22:32:11 +02:00
Patric Stout b00e483b0f
Change: recover when possible from crashes during a crash (#11238) 2023-08-27 21:54:05 +02:00
Patric Stout 29a37c2e0b
Change: [Win32] unify the crashlog handler with the other OSes (#11236)
While at it, make the crash text a bit more readable, and sync
this with MacOS.
2023-08-27 17:58:31 +00:00
Patric Stout 45cc3acaf5
Codechange: [Win32] unify AppendDecodedStacktrace and LogStacktrace (#11220)
AppendDecodedStacktrace was already doing the same as LogStacktrace,
just with a different name.
2023-08-20 18:57:01 +00:00
Patric Stout 352ac264a5
Remove: [Win32] module-list from crash.log (#11219)
Only Windows implemented this, and it opens the files to read them
to get a CRC. Doing this in a crash-handler is strange at best.

Lastly, nobody has actually ever used this information to come to
some sort of conclusion. The module-list is used in combination
with the crash.dmp, but this information is already embedded in
there.
2023-08-20 17:09:21 +00:00
Patric Stout f120d2beb8
Add: use breakpad to create crash.dmp on MacOS / Linux too (#11202)
Normally only the Windows platform could create a crash.dmp, making
analysing crash-reports from MacOS / Linux rather tricky.
2023-08-20 17:16:08 +02:00
Patric Stout 8f6df242c4
Remove: [Win32] (pointer-only) stack trace in crash.log (#11211)
It only contains pointers, which nobody can decipher anyway.
So instead, just report "Not supported", like other targets do
when they can't print a sane stack trace.
2023-08-20 17:08:16 +02:00