Commit Graph

246 Commits

Author SHA1 Message Date
Peter Nelson b30fe0d7da Feature: Ctrl-click to toggle favourites in build-pickers.
This allows ctrl-click on a type in a build-picker window to remember it
as a favourite. An new filter button to show only favourites makes it
simpler to use these types.

Favourite types are saved locally in favs.cfg, so are remembered between
games.
2024-05-11 02:12:41 +01:00
Peter Nelson ef55cc7979
Codechange: Remove support for links in tar files. (#12571)
This was a feature to support the original 32bpp sprite system and is no longer relevant.
2024-04-28 15:18:24 +01:00
Loïc Guilloux 99b74c1064
Fix #12584: Improved error handling during tar scan (#12586) 2024-04-28 16:08:32 +02:00
Peter Nelson e8249e9075
Codechange: Pass buffers for TarFile's ExtractString as span. (#12567)
ExtractString does not need to find a string terminator as StrMakeValid already does this, so simply pass the full bounds of the buffer.

Removes lengthof, array indices, and needs only the buffer as a parameter.
2024-04-24 21:34:21 +01:00
Peter Nelson ac6a945e26
Revert 2408a68910: Remove work around for an MSVC bug from 17 years ago. (#12557) 2024-04-23 17:05:08 +01:00
Peter Nelson 42523379d9 Codechange: Use directory_iterator in ScanPath.
Replaces use of custom ttd_opendir.
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
Peter Nelson 5a523cf212 Codechange: Simplify FioCreateDirectory.
`std::filesystem` provides `create_directories()` as a cross-platform way to create a directory tree.
2024-04-18 01:41:14 +01:00
Peter Nelson 4eaeccdaeb
Codechange: Introduce FioRemove() to remove files. (#12491)
New function FioRemove() handles OTTD2FS conversion, and uses std::filesystem::remove instead of unlink, all in one location.
2024-04-14 23:43:50 +01:00
Rubidium 4f2412a272 Codechange: range based for loops instead of C-style for loops 2024-04-11 07:05:04 +02:00
rubidium42 442daf58da Codechange: replace lengthof with std::size in Windows specific code 2024-04-10 23:17:13 +02:00
Loïc Guilloux 165f92c00b
Fix #12041, 0c81579: Tarball extraction failing due to incorrect filename (#12044) 2024-02-09 17:25:56 +01:00
frosch b1718478c8 Codechange: Replace old non-standard attributes with C++17/20 standard attributes. 2024-02-02 22:29:28 +01:00
Patric Stout d3b2a576de
Feature: Plugin framework for Social Integration with Steam, Discord, GOG, etc (#11628) 2024-01-22 19:22:45 +00:00
Patric Stout 0c81579363
Fix #6377: two tarballs with the same folder in them were considered as one (#11855) 2024-01-21 19:06:58 +01:00
Rubidium 2d77cf9c80 Codechange: replace StrStartsWith/StrEndsWith with starts_with and ends_with 2024-01-17 19:48:22 +01:00
Jonathan G Rennison 88324a253e
Fix #11644: Off by one error/buffer over-read in StrMakeValid (#11645)
* Fix #11644: Off by one error in StrMakeValid UTF-8 decode overrun detection

* Fix #11644: Off by one error in StrMakeValid buffer last character

* Fix: Unnecessary string duplication at StrMakeValid call sites
2024-01-01 13:26:31 -05:00
Patric Stout c059ce0c97
Fix cda6f24f: don't ignore binary-dir if it happens to be working-dir (#11431)
Some of our code ignores the SP_WORKING_DIR for some actions, which
means that if, for example, your SP_BINARY_DIR is the same as your
SP_WORKING_DIR, neither is scanned.

Instead, only add SP_WORKING_DIR if it is unique.
2023-11-04 10:39:18 +00:00
Peter Nelson cda6f24fe8
Change: Filter duplicate paths from valid search path list. (#11363) 2023-10-09 21:38:13 +00:00
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
Owen Rudge 1a3d1bca59 Remove: OS/2 port 2023-06-16 14:29:14 +01:00
Rubidium 81f957b9f8 Codechange: use std::string to find the executable's working directory 2023-06-09 19:58:18 +02:00
Rubidium 993f90b6a0 Codechange: let GenerateDefaultSaveName return std::string 2023-06-04 14:11:13 +02:00
Rubidium 513ede7669 Codechange: use C++ strings/paths to resolve links in tars 2023-06-02 21:06:24 +02:00
Rubidium 13789d1703 Codechange: use std::string for FiosIsValidFile 2023-05-31 10:56:33 +02:00
Peter Nelson 56085be9bd Codechange: Move includes for common STL headers to stdafx. 2023-05-17 10:14:41 +01:00
Rubidium 98972a0748 Codechange: use C++ strings for constructing script file paths 2023-05-14 22:54:10 +02:00
Peter Nelson e6740046ee Codechange: Use range-for iteration. 2023-05-11 07:58:55 +01:00
Rubidium 4dd5f994be Codechange: replace strncasecmp with case ignoring variant of StrStarts/EndsWith 2023-04-29 10:25:25 +02:00
Rubidium 86786a7af6 Codechange: introduce StrEqualsIgnoreCase/StrCompareIgnoreCase to replace strcasecmp 2023-04-29 10:25:25 +02:00
Charles Pigott 80bd5ad727
Codechange: Use std::strto* variants everywhere (#10720) 2023-04-26 12:56:14 +01:00
Rubidium 43c65a3fec Codechange: use std::string for base media filename/warning storage 2023-04-25 15:01:08 +02:00
Rubidium 4e65ec1dc4 Codechange: do not declare functions in blocks 2023-01-29 20:28:45 +01:00
Eddi-z 8db4892f49
Codechange: Reshuffle debuglevels in fileio to address spammyness (#10240) 2022-12-15 13:25:06 -05:00
Rubidium 3e4d327451 Codechange: use the C++ std::getenv over the POSIX/C getenv
The C++ std::getenv is guaranteed thread-safe by the C++11 specification,
whereas the POSIX/C getenv might not be thread-safe by the C11 specification.
2021-07-10 22:55:46 +02:00
Patric Stout 75b6051b7a Change: move sensitive information to secrets.cfg and private information to private.cfg
We often ask people for their openttd.cfg, which now includes their
passwords, usernames, etc. It is easy for people to overlook this,
unwillingly sharing information they shouldn't.

By splitting this information over either private.cfg or secrets.cfg,
we make it more obvious they shouldn't be sharing those files, and
hint to what is inside them.
2021-07-02 14:30:14 +02:00
SamuXarick 1e6a2163a5
Fix #9358: Don't skip empty files in tar (#9367) 2021-06-18 00:08:49 +02:00
rubidium42 55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 2021-06-13 12:45:45 +02:00
Patric Stout ed3946e295
Add: '-X' option to ignore global folders in the search path (#9341)
This is extreme useful for automated testing. Without this, OpenTTD
will always look in your personal-dir (like ~/.local/share/openttd
or %USER%\Documents\OpenTTD). For most users this is exactly what
we want, that there is a shared place for all their files.

However, for automated testing this is rather annoying, as your
local development files influence the automated test. As such,
'-X' counters this, and only gives the local folders. This is
especially useful in combination with '-x' and '-c'.
2021-06-10 23:13:34 +02:00
Rubidium fa6abe1646 Cleanup: remove the old FIO slot functions 2021-05-08 12:39:34 +02:00
Rubidium fdc11a9f94 Codechange: introduce SpriteFile to be used by the sprite loader instead of the global FIO slot functionality 2021-05-08 12:39:34 +02:00
Rubidium c097bc9d7d Codechange: let NewGRF sounds make use of RandomAccessFile instead of the FIO slot functions 2021-05-08 12:39:34 +02:00
Rubidium b144e56b2c Codechange: use the new RandomAccessFile as backend for the FIO slot functions 2021-05-08 12:39:34 +02:00
glx22 983c7ade60 Codechange: Replace FOR_ALL_SEARCHPATHS with range-based for loops 2021-05-03 19:46:57 +02:00
glx22 34215f7faa Codechange: Replace FOR_ALL_TARS with range-based for loops 2021-05-03 19:46:57 +02:00
Niels Martin Hansen e0561dbded Fix #8713: Change OTTD2FS and FS2OTTD to return string objects instead of static buffers 2021-04-07 09:31:47 +02:00
milek7 295f34a9df Fix: Freeing LanguagePack with wrong size. 2021-04-02 10:12:25 +02:00
Charles Pigott 2d7b34bc68 Fix #8886: Don't try to resolve folders within tars named '.' 2021-03-28 09:52:15 +01:00
Niels Martin Hansen beeb9e0a1b Remove: [Win32] Last pretenses of being able to build for Windows 95 2021-02-23 11:25:39 +01:00
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00