Commit Graph

21693 Commits

Author SHA1 Message Date
Peter Nelson a9a0bfffc1
Change: Disable building rail infrastructure if train build limit is zero. (#11847)
This matches the behaviour of road, ship and aircraft infrastructure.
2024-01-21 16:51:23 +00:00
Peter Nelson 89474701bc
Codechange: Use templates to deduplicate goal widgets. (#11852) 2024-01-21 16:23:17 +00:00
Patric Stout fa8294ebe7
Remove: rdtsc and TIC/TOC based on CPU ticks (#11856)
Use TIC/TOC based on std::chrono instead. This information is also
easier to compare with others, as although it depends on CPU, it
means a bit more if "yours takes 4ms and mine takes 10ms".
2024-01-21 15:38:15 +00:00
Patric Stout fe035c306e
Codechange: prevent out-of-bound read (even if the result is never used) (#11853) 2024-01-21 14:25:00 +00:00
Peter Nelson 8797cc7ef2
Codechange: Replace GroupStatistics' num_engines with std::map. (#11849)
This removes manual memory management with calloc/free calls, and prevents potentially large arrays being allocated for each group.
2024-01-21 14:09:44 +00:00
Peter Nelson c0ab436077
Codechange: Store Colours in Colours type. (#11625)
This reduces casts, some magic numbers, and introduces a bit of type-safety.
2024-01-21 13:23:04 +00:00
Peter Nelson 0841978304
Codechange: Use vector and iterators to store old/new vehicles during autoreplace. (#11851)
This avoids malloc/free of 3 arrays along index counting, and the data for each part is kept together.
2024-01-21 09:21:22 +00:00
Rubidium 2d77f09a81 Codechange: use std::shared_ptr for vector of TCPConnecters 2024-01-20 23:03:44 +01:00
Patric Stout 71b8801b61
Fix bd85f61a: [Linux] don't include sys/random.h on older glibc systems (#11844) 2024-01-20 20:43:06 +00:00
Tyler Trahan fa479c4a7c
Cleanup: Describe modifier keys more consistently in tooltips (#11716) 2024-01-20 19:26:39 +00:00
Tyler Trahan 500870627d
Change: Rewrite a few main toolbar tooltips (#11717) 2024-01-20 13:49:34 -05:00
translators 4d79d86812 Update: Translations from eints
catalan: 18 changes by J0anJosep
2024-01-20 18:38:38 +00:00
Peter Nelson d6ccfdbbd9
Fix #11827: Make Layouter::GetCharPosition() aware of ligatures. (#11831)
When ligatures happen the precise individual character position is not known, so instead return the previous position (which is that of the ligature.)
2024-01-20 17:16:42 +00:00
Rubidium 086cbd0d72 Codechange: add constexpr to math functions where applicable 2024-01-20 17:30:36 +01:00
Rubidium dfe70181f1 Codechange: add constexpr to bitmath functions where applicable 2024-01-20 17:30:36 +01:00
Rubidium 4c51534b6a Remove: LeastCommonMultiple / GreatestCommonDivisor
Use std::lcm / std::gcd instead.
2024-01-20 16:45:21 +01:00
Rubidium 1403f24fa9 Codechange: replace LeastCommonMultiple with std::lcm 2024-01-20 16:45:21 +01:00
Patric Stout bd85f61a40 Change: use a stronger hash and actual random information to generate Uids 2024-01-20 14:23:03 +01:00
Patric Stout 37244bc8c5 Codechange: MacOS already has MIN/MAX macros defined
This is caused because we use PreCompile Headers, and one of them
includes a system headers which defines MIN/MAX.
2024-01-20 14:23:03 +01:00
Patric Stout 63a3d56b8a Add: monocypher 4.0.2
Monocypher will take care of all our encryption needs; as most
OSes and vcpkg doesn't have it available, we vendor it.
2024-01-20 14:23:03 +01:00
Rubidium 6b21368bc2 Codechange: replace FIND_FIRST_BIT/FindFirstBit2x64 with FindFirstBit 2024-01-19 21:10:39 +01:00
Rubidium 8faaedeff9 Codechange: replace hand written function to find first/last bit with C++ variant 2024-01-19 21:10:39 +01:00
Peter Nelson 903119115b
Fix 9602de4: FinaliseCargoArray did nothing. (#11839)
`CargoSpec::Iterate()` deliberately skips invalid cargo types, but `FinaliseCargoCarry()` is only interested in them.
2024-01-19 20:07:47 +00:00
translators db7697bcdf Update: Translations from eints
chinese (simplified): 22 changes by WenSimEHRP
romanian: 37 changes by bnegrut
2024-01-19 18:40:43 +00:00
Peter Nelson 9cf47af490
Change: Invalidate music volume when restarting music playback on Windows. (#11836) 2024-01-19 17:01:36 +00: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
Rubidium 1c694e433d Codechange: use std::popcount instead of hand written loop 2024-01-19 06:48:55 +01: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
Rubidium 2f8de227dc Remove: unused OTTD_ALIGNMENT define and ReadLE16(Un)aligned 2024-01-18 23:29:15 +01:00
Rubidium ee00c7b159 Codechange: use TO_LE16 directly when reading language file offsets 2024-01-18 23:29:15 +01:00
translators 32b99bf77c Update: Translations from eints
portuguese: 4 changes by azulcosta
2024-01-18 18:40:14 +00:00
Loïc Guilloux bf4b669628
Fix: [Script] Improve ScriptText validation (#11721)
The validation is now done in two steps:
 - First we get the list of parameters in the same order they used to be in encoded string
 - Then we validate the parameter types like FormatString would use them while encoding the string
2024-01-18 18:06:30 +01:00
Peter Nelson 28ef5146ba Fix #11646: Non-thread safe shared buffer returned from GetLogPrefix().
Return string from GetLogPrefix instead of shared string's buffer.
2024-01-18 17:40:25 +01:00
Patric Stout 2b599c9d00 Fix: [HarfBuzz] make HarfBuzz use the same glyphs as we render 2024-01-18 10:41:01 +01:00
Patric Stout a24c2bf10a Codechange: [HarfBuzz] hb-ft will set the scaling on its own 2024-01-18 10:41:01 +01:00
Peter Nelson 7faa3848de
Change: Mark whole screen dirty when toggling font AA. (#11825) 2024-01-17 23:04:07 +00:00
Rubidium 4cc97e04e6 Fix #11801, 51f1e93: CalcClosestTownFromTile needs the kd-tree to be valid 2024-01-17 23:40:19 +01:00
Peter Nelson 0be26f5856
Change: Remove extra padding from query text. (#11823)
This window uses 'modalpopup' padding so does not need extra padding on its text.
2024-01-17 22:17:14 +00:00
Rubidium 47c0184a0b Codechange: replace ROR/ROL with std::rotr/rotl 2024-01-17 23:05:40 +01:00
frosch f457be5a27
Fix #11819, aa5ba5b: Out-of-bounds access in linkgraph GUI. (#11821) 2024-01-17 22:26:33 +01:00
Rubidium 2d77cf9c80 Codechange: replace StrStartsWith/StrEndsWith with starts_with and ends_with 2024-01-17 19:48:22 +01:00
translators 384b804f9c Update: Translations from eints
english (au): 1 change by krysclarke
chinese (simplified): 21 changes by WenSimEHRP
danish: 4 changes by bscargo
french: 2 changes by ottdfevr
portuguese (brazilian): 5 changes by pasantoro
polish: 5 changes by pAter-exe
2024-01-17 18:39:56 +00:00
Peter Nelson 341bdabc70
Fix #11815, bb491127: Missing brackets prevented vehicles turning properly. (#11816) 2024-01-17 13:23:55 +00:00
Jonathan G Rennison fd0528a9b4 Fix: Excessive switching of horizontal scale for FPS graph 60 Hz categories 2024-01-17 06:34:17 +01:00
Jonathan G Rennison 17d47ba06f Fix 661bdae2: cargo_payment not cleared when aircraft loading cancelled 2024-01-17 06:33:54 +01:00
Patric Stout fd073a2810 Remove: replace custom span with std::span 2024-01-17 00:25:08 +01:00
Patric Stout bb49112784 Codechange: switch our codebase to C++20 2024-01-17 00:25:08 +01:00
Michael Lutz fd59393899
Fix #11791, e1f5be62: Run missing-glyph detection after toggling sprite font. (#11812) 2024-01-17 00:00:26 +01:00
Rubidium aa5ba5bd7f Codechange: allow certain enumeration to be added
Otherwise C++20 doesn't like it.
2024-01-16 23:30:23 +01:00
Peter Nelson 7737aa6640 Codechange: Make all NWidgetPart arrays constexpr.
This ensures that the arrays are not created at runtime and prevents using non-constexpr values.
2024-01-16 21:57:05 +00:00
Peter Nelson 71b7ba0daa Codechange: Allow constexpr NWidgetPart construction. 2024-01-16 21:57:05 +00:00
Peter Nelson a5b6e17556 Codechange: Make geometry methods constexpr. 2024-01-16 21:57:05 +00:00
Peter Nelson 68843e3a96 Codechange: Move WidgetDimensions::unscaled to header to allow const use. 2024-01-16 21:57:05 +00:00
Peter Nelson 7eecd7512f Codechange: Remove redundant struct keyword. 2024-01-16 21:57:05 +00:00
Patric Stout 6860a86d45
Codechange: remove all u8 prefix in favour of compile-time option (#11807) 2024-01-16 21:33:53 +00:00
Patric Stout 6550682b49
Codechange: minor bits and pieces related to fmt::format() (#11806)
- Don't make run-time formatting what can be done compile-time.
- Be explicit about run-time formatting.
- Fix datetime printing.
2024-01-16 21:10:34 +00:00
Patric Stout 0b7410d979
Codechange: compile-time validate the string format of IConsolePrint (#11804)
This means we can no longer use runtime picking what string to use.
2024-01-16 21:04:35 +00:00
Patric Stout 8b4c5a6269
Codechange: compile-time validate the string format of SlErrorCorruptFmt (#11805) 2024-01-16 20:58:55 +00:00
Peter Nelson d005e8f8bd
Fix 884b9e66: No need to include extra pixel for pressed state. (#11803) 2024-01-16 20:50:46 +00:00
translators 2efd897691 Update: Translations from eints
english (au): 4 changes by krysclarke
english (us): 4 changes by 2TallTyler
chinese (simplified): 8 changes by WenSimEHRP
korean: 4 changes by telk5093
russian: 4 changes by Ln-Wolf
finnish: 4 changes by hpiirai
french: 8 changes by ottdfevr
2024-01-16 18:39:39 +00:00
Rubidium 661bdae2e5 Fix #11785, cf16f45: when bumping aircraft into the air, remove them from the loading vehicle list again 2024-01-16 00:08:19 +01:00
Rubidium f99793547e Fix fbd71a9: for TTO savegames, getting the savegame type left the file pointing to the wrong location 2024-01-16 00:08:19 +01:00
Rubidium d5518f6263 Fix 36a0818: TTO did not save company shares 2024-01-16 00:08:19 +01:00
Rubidium 51f1e939e8 Change: be more resilient against missing towns in old loader 2024-01-16 00:08:19 +01:00
Rubidium 67b405d2f6 Fix #11783, 953445a: TTO savegames are not 65536 by 65536 2024-01-16 00:08:19 +01:00
Rubidium f5b320e502 Codechange: use range based for loop, instead of tile numbers 2024-01-16 00:08:19 +01:00
Rubidium b09a4384d9 Codechange: remove need to use separate array for old_map3 2024-01-16 00:08:19 +01:00
Peter Nelson 8510f7bd00
Fix: NWidgetParts must use unscaled dimensions. (#11794) 2024-01-15 23:02:25 +00:00
EmperorJake 64bc07ff4e
Change: Make "middle" the default stopping location for trains in platforms (#11605) 2024-01-15 22:10:27 +01:00
Patric Stout 375074577f
Fix: [SDL] remove hint to avoid hardware acceleration (#11790)
This hint was once needed because of the way we handled surfaces.
But as OpenGL already uses a hardware surface, we already had to
fix all the issues that comes with it. As that is generic code,
this hint is no longer actually needed. Further more, recent SDL
versions break because of it on Wayland.
2024-01-15 21:57:55 +01:00
Loïc Guilloux b18e78e21d
Change: Redesign script debug window (#11782) 2024-01-15 21:41:44 +01:00
Tyler Trahan 68814bd912
Codechange: Rename SIGTYPE_NORMAL to SIGTYPE_BLOCK (#11788) 2024-01-15 15:27:48 -05:00
Tyler Trahan 4a194482ea
Fix e1f5be6: Typo when selecting traditional sprite font (#11789) 2024-01-15 20:24:26 +00:00
translators a1690d5b7b Update: Translations from eints
portuguese (brazilian): 1 change by pasantoro
2024-01-15 18:39:20 +00:00
Jonathan G Rennison 94e74a45c2
Fix: Viewport virt coords not updated when sprite font toggled (#11784) 2024-01-15 19:16:04 +01:00
Peter Nelson 53fa54f8e9
Fix e1f5be62: Clear font cache when toggling sprite font. (#11780)
This is necessary for the sprite font height and ascender to be updated correctly.
2024-01-15 00:21:11 +00:00
Patric Stout 32fc740582
Fix: [SDL2] fullscreen always used the resolution of the first display (#11779) 2024-01-14 22:41:51 +00:00
Patric Stout 302ba93471
Fix: [SDL2] only resolutions of the first display were shown (#11778) 2024-01-14 22:25:54 +00:00
Michael Lutz e1f5be6244 Add: GUI options to select sprite font and AA mode for all fonts. 2024-01-14 22:50:56 +01: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 37610af0e4
Fix: Don't replace stripped characters with '?' in console (#11777) 2024-01-14 21:49:42 +00:00
Rubidium 564441e822 Remove: Debug redirect over network
It does not work for dedicated servers because upon starting the process to
resolve the address to redirect to gets killed. Also with all the async going
on in the network code, the debug redirection will start very late in the
process.
2024-01-14 22:14:31 +01:00
Peter Nelson a6873ef7dd
Codechange: Avoid repeatedly calling virtual methods in text drawing loop. (#11774) 2024-01-14 19:06:50 +00:00
translators e8d6b496c2 Update: Translations from eints
english (au): 1 change by krysclarke
english (us): 1 change by 2TallTyler
chinese (simplified): 9 changes by WenSimEHRP
korean: 1 change by telk5093
russian: 1 change by Ln-Wolf
finnish: 1 change by hpiirai
danish: 2 changes by bscargo
french: 2 changes by ottdfevr
portuguese: 1 change by azulcosta
2024-01-14 18:39:10 +00:00
Peter Nelson f219557cf2
Codechange: List functions in gui.h under correct source file. (#11775) 2024-01-14 18:12:40 +00:00
Peter Nelson 71aaed860b
Codechange: Missing some conversions to WidgetID. (#11773) 2024-01-14 16:47:10 +00:00
Loïc Guilloux 93ba6d6776
Fix: compilation without precompiled headers (#11770) 2024-01-14 13:27:03 +01:00
Peter Nelson e3bb6497f7 Codechange: Don't assume game options widget is a dropdown list. 2024-01-14 11:41:11 +00:00
Peter Nelson 8ca867ef63 Codechange: Replace game options' style-breaking if-condition with switch. 2024-01-14 11:41:11 +00:00
translators 341d022024 Update: Translations from eints
chinese (simplified): 141 changes by WenSimEHRP
russian: 3 changes by Ln-Wolf
danish: 6 changes by bscargo
latvian: 10 changes by lexuslatvia
dutch: 16 changes by Afoklala
french: 2 changes by ottdfevr
2024-01-13 18:38:17 +00:00
Jonathan G Rennison b3f31a6523
Fix #11696: Graphics set parameters missing from survey data (#11764) 2024-01-12 21:53:31 +00:00
Jonathan G Rennison 479490d7e8
Codechange: Remove unnecessary vector for writing GRF parameter JSON (#11763) 2024-01-12 21:38:31 +00:00
Loïc Guilloux 54b57fbfeb
Codechange: [Script] Use ScriptList::FillList() in more locations (#11762) 2024-01-12 21:19:08 +01:00
Tyler Trahan 60da6b992e
Fix #4415: Land info build date is also renovation date (#11759)
Co-authored-by: Gadg8eer <64449092+Gadg8eer@users.noreply.github.com>
2024-01-12 14:27:33 -05: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
Loïc Guilloux 28efa65e0c
Revert a2edf52: SQOpsLimiter does a more precise job (#11754) 2024-01-12 17:04:43 +01:00
Jonathan G Rennison 1101b04371 Fix: Build button text when train purchase window using "Engines" filter 2024-01-12 16:34:39 +01:00