Commit Graph
170 Commits
Author SHA1 Message Date
Rubidiumandrubidium42 c1a287ad17 Codechange: make some saveload functions work natively with std::string_view 2025-04-30 23:49:06 +02:00
Rubidiumandrubidium42 f4ad614285 Codechange: use std::string_view for FS2OTTD and OTTD2FS 2025-04-29 22:33:32 +02:00
Rubidiumandrubidium42 af25eecc15 Codechange: use const for std::string_view where appropriate 2025-04-29 10:15:18 +02:00
Rubidiumandrubidium42 78250c3bba Codechange: remove const char* overloads when there are std::string_view and std::string& overloads 2025-04-29 10:14:53 +02:00
Rubidiumandrubidium42 360670626b Codechange: replace char* with std::string_view 2025-04-28 21:31:12 +02:00
Rubidiumandrubidium42 29ceaf0a84 Codechange: use std::string_view over const char * 2025-04-27 18:04:04 +02:00
froschandGitHub 26db4ccf09 Codechange: Turn bit-stuffed FiosType enum into a struct. (#14019) 2025-04-18 15:20:55 +02:00
Peter NelsonandPeter Nelson 7b31f26611 Codechange: Pass ContentInfo by reference.
Many functions take a ContentInfo pointer, but do not check for nullptr.
Pass by reference instead to assure it is present.
2025-04-11 23:08:59 +01:00
froschandGitHub 2cdf2bedfa Codechange: Add a std::string overload for StrMakeValidInPlace() and a moving std::string&& overload for StrMakeValid(). (#13962) 2025-04-07 18:22:47 +02:00
froschandGitHub 25005cff16 Codefix: std::string_view::data() is not necessarily null terminated. (#13891) 2025-03-25 20:32:19 +01:00
Peter NelsonandGitHub 20e57a02a2 Codechange: Use GetString() with argument parameters in simple cases. (#13551)
Avoids using global string parameters.
2025-02-14 00:10:56 +00:00
Rubidiumandrubidium42 04d53ed6f5 Codechange: remove operator!=s that are synthesized 2025-02-08 06:37:36 +01:00
Jonathan G Rennisonandrubidium42 9f1bb055b7 Change: Exclude parent item from directory sort in FiosGetFileList 2024-09-18 06:49:30 +02:00
Tyler TrahanandGitHub ad020759c7 Feature: Import town data from JSON file (#10409) 2024-09-16 09:29:10 -04:00
Peter NelsonandGitHub 908ee7292b Codechange: Replace all FILE * with FileHandle RAII class. (#12718)
This removes the need to manually ensure all files are closed.
2024-09-16 08:45:26 +01:00
Peter NelsonandPeter Nelson 440a633fcc Codechange: Remove shrink_to_fit for more lists.
A comment about "will actually do nothing" is out of date as that is not the case with std::vector.

These lists are always short lived (either within a command handler or in a window) so don't shrink_to_fit.
2024-04-27 19:25:34 +01:00
Peter NelsonandGitHub d57bf84196 Codechange: Remove some unnecessary c_str() when passing std::strings. (#12532)
Functions have been updated from `char *` to `std::string` since without removing `c_str()`.
2024-04-18 22:13:13 +01:00
Peter NelsonandPeter Nelson 42523379d9 Codechange: Use directory_iterator in ScanPath.
Replaces use of custom ttd_opendir.
2024-04-18 01:41:14 +01:00
Peter NelsonandPeter 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 NelsonandGitHub a1b03ee69e Codechange: Replace platform-specific calls with std::filesystem::last_write_time. (#12487) 2024-04-15 18:10:19 +00:00
Peter NelsonandGitHub 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
Patric StoutandGitHub a1487ce620 Add: list_[scenario|heightmap] and load_[scenario|height] console commands (#11867) 2024-01-23 14:01:25 +01:00
Patric StoutandGitHub 090616b4c9 Add: allow loading heightmaps from command-line (#11870)
If you want to load a file from tar, you have to give the file
inside the tar in order for it to work:

<tar-file>/<dir-in-tar>/<file>.png
2024-01-22 22:35:25 +00:00
Rubidiumandrubidium42 2d77cf9c80 Codechange: replace StrStartsWith/StrEndsWith with starts_with and ends_with 2024-01-17 19:48:22 +01:00
Rubidiumandrubidium42 c6411168d8 Cleanup: missing spaces before continuation * in some comments 2023-11-01 22:56:11 +01:00
froschandfrosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
Rubidiumandrubidium42 eaae0bb5e7 Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
2023-07-19 19:30:14 +02:00
Rubidiumandrubidium42 af9b9327af Codechange: do not keep local variable for temporary string parameters 2023-07-03 18:08:03 +02:00
Owen Rudge 1a3d1bca59 Remove: OS/2 port 2023-06-16 14:29:14 +01:00
Rubidiumandrubidium42 fbd71a9d72 Codechange: replace C-style string processing with C++-style for the listing callbacks 2023-06-05 23:25:49 +02:00
Rubidiumandrubidium42 324c43eeb2 Codechange: let FiosGetDiskFreeSpace only return disk space and split FiosGetCurrentPath off 2023-05-31 10:56:33 +02:00
Rubidiumandrubidium42 f2e704b9a7 Codechange: use std::string for FiosIsRoot 2023-05-31 10:56:33 +02:00
Rubidiumandrubidium42 13789d1703 Codechange: use std::string for FiosIsValidFile 2023-05-31 10:56:33 +02:00
Rubidiumandrubidium42 d9a04ba446 Codechange: make the MD5 hash/digest/checksum variables a std::array 2023-05-19 11:24:44 +02:00
Rubidiumandrubidium42 98972a0748 Codechange: use C++ strings for constructing script file paths 2023-05-14 22:54:10 +02:00
Rubidiumandrubidium42 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
Rubidiumandrubidium42 397221b94a Codechange: Make ScenarioIdentifier use std::string for the filename 2023-04-29 13:23:34 +02:00
Rubidiumandrubidium42 3a822fcd01 Codechange: Make FiosItem's name and title std::string 2023-04-29 13:23:34 +02:00
Rubidiumandrubidium42 f0a1ddd81c Codechange: let FiosBrowseTo return a bool 2023-04-29 13:23:34 +02:00
Rubidiumandrubidium42 c829930440 Codechange: replace strnatcmp with C++ string capable version 2023-04-29 12:07:45 +02:00
Rubidiumandrubidium42 4dd5f994be Codechange: replace strncasecmp with case ignoring variant of StrStarts/EndsWith 2023-04-29 10:25:25 +02:00
Rubidiumandrubidium42 86786a7af6 Codechange: introduce StrEqualsIgnoreCase/StrCompareIgnoreCase to replace strcasecmp 2023-04-29 10:25:25 +02:00
Charles PigottandGitHub 80bd5ad727 Codechange: Use std::strto* variants everywhere (#10720) 2023-04-26 12:56:14 +01:00
Rubidiumandrubidium42 ae422be979 Cleanup: remove/replace trailing ; with . in comments 2023-01-26 23:47:55 +01:00
Loïc GuillouxandGitHub 460991ecf4 Feature: Persistant rotation of numbered auto/netsave after restart (#9397)
It was always starting from 0 on openttd restart.
Now the most recent auto/netsave number will be used as a base to generate the next filename.
2021-07-17 12:48:35 +02:00
Patric StoutandGitHub ca9a7df752 Codechange: rename str_validate to StrMakeValid(InPlace) (#9304)
This to be more explicit the function changes the value, and not
returns yes/no.
2021-05-29 11:21:38 +02:00
rubidium42andrubidium42 6bca9e090d Codechange: add SetDParamStr that accepts std::string& 2021-05-06 21:45:36 +02:00
glx22andLoïc Guilloux 983c7ade60 Codechange: Replace FOR_ALL_SEARCHPATHS with range-based for loops 2021-05-03 19:46:57 +02:00
PeterNandGitHub f018471b36 Cleanup: Remove old FiosList helper methods. (#9139) 2021-04-29 22:46:42 +01: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