Commit Graph

21 Commits

Author SHA1 Message Date
Peter Nelson 3ad143c43a
Codechange: Use `x = y` instead of `x{y}` for value-type member initialisation. (#12501)
This is easier to read and less likely to look like an array definition.
2024-04-15 23:07:36 +01:00
Peter Nelson de4e00c93f
Codechange: Pass by reference to UpdateWidgetSize. (#12457)
These parameters are always provided and not optional.
2024-04-09 08:34:45 +01:00
Peter Nelson fef0bfcfd3
Fix: TextfileWindow called virtual methods before constructor completed. (#11889)
SetStringParameters() was called during widget tree init in the constructor.

Calls within a constructor cannot call the derived classes methods. This would result in invalid data being passed to the string system, which could then crash.
2024-01-27 14:45:37 +00:00
Peter Nelson a0dfb76e34 Codechange: Replace mishmash of types for widget index with WidgetID.
Indices were stored as int, but often passed around as uint/uint8_t and casts.

Now they should all use WidgetID.
2023-12-30 00:23:57 +00:00
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
Niels Martin Hansen 41de0d46f3 Feature: Help and manuals access window 2023-09-13 16:11:08 +02:00
Patric Stout 7634553d22 Feature: opt-in survey when exiting a game
On first start-up, the game will ask if you want to participate
in our automated survey. You have to opt-in, and can easily opt-out
(via the Options) at any time.

When opt-in, whenever you exit a game, a JSON blob will be send
to the survey server hosted by OpenTTD. This JSON blob contains
information that gives a global picture of the game just played:
- What settings were used
- How many humans vs AIs
- How long the game has been played
- Basic information about the OS / CPU

All this information is kept very generic, so there is no
chance we send private information to our survey server.
Nothing in the JSON blob could identify you as a person; it
mostly tells about the game played. At any time you can see
what the JSON blob includes, by pressing the "Preview Survey
Results" button in-game.
2023-05-14 23:22:02 +02:00
Patric Stout febe394806
Codechange: replace C-style strings with C++-style strings in textfile (#10772) 2023-05-09 19:35:50 +00:00
Rubidium 68ff3fd062 Change: include fmt.h C++ headers in stdafx.h
This to prevent compilation issues between runs with and without precompiled
headers. Also remove the headers from the rest of the code base as they are
not needed there anymore, although they do relatively little harm.
2023-05-08 16:49:23 +02:00
Rubidium 877349c13d Codechange: use std::string for text file name resolution 2023-05-05 08:54:29 +02:00
Peter Nelson 890b2666d3 Change: Use scaled WidgetDimensions. 2022-11-12 18:28:39 +00:00
Peter Nelson f6ad8e1c9c Change: Rename some freetype things to fontcache.
The font cache supports more than just FreeType as a font provider, but still used freetype in some naming.

This now uses more suitable terms.
2022-09-25 18:34:24 +01:00
PeterN 0b460bf4a1
Fix: 'Cache' top and bottom lines of textfile viewer to avoid overdraw. (#9131)
* Fix: 'Cache' top and bottom lines of textfile viewer to avoid overdraw.

The text file viewer calculated the number of lines required to set the scrollbar, but did not retain this information, so this was recalculated on every draw operation. This includes overdrawing text outside the bounds of the current scroll position.

With this change the top and bottom lines for each line of text are remembered, and reflowing is avoided where possible. Text outside the current scroll bounds is not drawn.
Additionally the scroll interval is now based on text lines instead of pixel lines, which increases the text capacity depending on the font size.

* Fix: Limit text viewer to showing 64k lines.

Text files with more than 64k wrapped lines would exceed the scrollbar capacity and cause an assert. This is harder to reach now that the scrollbar counts lines instead of pixels.
2021-04-29 18:58:26 +01:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
Michael Lutz d2ed426077 Codechange: [Win32] Pass a native GDI font description around when we have one, instead of repeatedly guessing the font. 2019-05-14 11:21:36 +01:00
Henry Wilson c01a2e2a81 Codechange: Removed SmallVector completely 2019-03-26 20:15:57 +00:00
peter1138 b1fb3f4fb8 Codechange: More use of override keyword. 2019-03-24 17:38:42 +00:00
frosch dfa0e61f25 (svn r25816) -Add [FS#5748]: Toggle button for wrapping lines in the textfile GUI (LordAro) 2013-10-06 11:29:14 +00:00
rubidium 6356178a25 (svn r23936) -Feature [FS#5047]: readme/licence/changelog viewer for AI and game scripts (LordAro) 2012-02-12 10:58:18 +00:00
rubidium 58269b7ad2 (svn r23935) -Codechange: generalise GetTextfile 2012-02-12 10:51:43 +00:00
rubidium e8dbcf9043 (svn r23932) -Codechange: split the NewGRF text window into its own source files 2012-02-12 10:32:41 +00:00