Peter Nelson
edf9f597ec
Codechange: Use parameterised GetString() for remaining windows.
2025-03-02 07:29:25 +00:00
Peter Nelson
2d7d085e8e
Codechange: Use EncodedString for error messages. ( #13569 )
2025-02-16 10:04:32 +00:00
Peter Nelson
dccc6185b9
Codechange: Change internal format of encoded strings to improve robustness and allow expansion. ( #13499 )
2025-02-09 12:45:50 +00:00
Rubidium
83479a4e12
Codechange: add method for reading a string from a savegame given a length
2025-02-07 22:49:17 +01:00
Peter Nelson
bf6293a13f
Fix: Rail/road type conversion data is not populated on new game. ( #13403 )
...
This means that the rail/road type conversion that happens if NewGRFs are changed does not work the first time for a new game, only with a savegame.
2025-01-29 21:45:16 +00:00
Peter Nelson
afc0745aa2
Codechange: Specify underlying type for all enums excluding those exposed to scripts. ( #13383 )
2025-01-28 22:17:34 +00:00
Peter Nelson
fb6781015a
Codechange: Use std::endian instead of TTD_ENDIAN defines.
2025-01-28 19:37:34 +00:00
Rubidium
4099acb946
Codechange: replace BSWAP32/BSWAP16 with std::byteswap
2025-01-28 19:22:12 +01:00
Peter Nelson
f6ab2b69c6
Codechange: Define GRFConfigList alias and pass by reference. ( #13358 )
...
This adds the distinction between a single GRFConfig and a GRFConfig list, and simplifies how GRFConfig lists are passed to various functions.
2025-01-22 22:30:32 +00:00
Peter Nelson
b653f875b0
Codechange: Space between `template` and `<` ( #13278 )
...
Make it all consistent so it matches CODINGSTYLE.
2025-01-04 17:56:14 +00:00
Peter Nelson
177e2ebf80
Codechange: Support saveload of reference vectors.
...
This uses the same data format as reference lists, but for vectors, so allows data structures to be changed without affecting savegame format.
2024-11-27 12:35:27 +00:00
Peter Nelson
059a4b22f7
Codechange: Use projection-based std::range::find where possible.
...
This simplifies matching by class members and avoids wordy lambdas.
2024-11-24 10:36:03 +00:00
Peter Nelson
d4f8453c22
Codefix: Clear and reserve storage when loading vectors from savegames.
2024-11-18 08:59:41 +00:00
Peter Nelson
74910d3d14
Fix 908ee729: Inverted condition prevented actually writing data to files. ( #12941 )
2024-09-16 13:45:23 +00:00
Peter Nelson
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
Jonathan G Rennison
2a5a0b0990
Codechange: No longer allow saving of incorrect string container table fields
...
See: 1250ce8f
2024-09-14 15:32:48 +01:00
Peter Nelson
7f5a3eaf83
Codefix: Avoid type-casting function pointer with incorrect type. ( #12929 )
...
Make `AutolengthProc` take `int` instead of `void *`, avoiding pointer parameters.
2024-09-12 06:49:45 +01:00
Jonathan G Rennison
65c666cb57
Codechange: Remove unused size field from struct SaveLoad ( #12859 )
2024-07-14 14:30:35 -04:00
Peter Nelson
b4bcb330c7
Codechange: Replace GetSavegameFormat's compression output pointer with std::pair return. ( #12850 )
...
This avoids using an unchecked pointer as an out-parameter.
2024-07-09 18:57:47 +01:00
Peter Nelson
100dd7b6d1
Codechange: Use find_if to get default writeable saveload format. ( #12849 )
...
* Codechange: Use find_if to get default writeable savegame format.
This removes the last of lastof, and so the lastof macro is removed.
2024-07-09 17:07:40 +01:00
Peter Nelson
79c1492a73
Codechange: Use unique_ptr in MemoryDumper. ( #12766 )
...
This replaces C-style manual memory management.
2024-06-08 21:59:56 +01:00
Rubidium
1250ce8fdc
Codechange: support storing std::string vectors/deques in the savegame
2024-05-07 00:03:15 +02:00
Peter Nelson
26bb87ebf1
Codechange: Replace SaveLoad var length arrays with switch block and sizeof. ( #12570 )
...
SlCalcConvMemLen(), SlCalcConfFileLen() and CalcOldVarLen() follow a pattern of looking up part of a value in an array.
These function returns the size of bytes of a variable type, but is not very clear. Replace with a switch block instead.
Removes lengthof, array indices, and magic numbers.
2024-04-24 21:33:29 +01:00
Rubidium
df8eeb1b10
Codechange: use C++ algorithms to determine the SaveLoadFormat
2024-04-09 23:36:39 +02:00
Rubidium
4e6d4fcf32
Codechange: replace for loops with endof with range-based for loops
2024-04-08 07:00:55 +02:00
merni-ns
6f36f3d714
Fix #11055 : Make saveload failure error messages consistent with others ( #12247 )
...
The save/load error messages were combined using string parameters, rather than using the built-in functionality of error dialogs.
2024-04-01 17:57:03 +01:00
Patric Stout
a3cfd23cf9
Codechange: rename byte to uint8_t ( #12308 )
2024-03-16 23:59:32 +01:00
Patric Stout
3e625b5b1a
Add: track savegame size to report with survey ( #12304 )
2024-03-16 08:58:56 +01:00
Rubidium
e67fc33172
Codechange: Add support for NULL strings in SaveLoadCompat
2024-02-17 14:33:16 +01:00
Loïc Guilloux
3ffa176870
Change: [Script] Store randomizers in savegame ( #12063 )
2024-02-12 01:22:57 +01:00
Rubidium
7a740eefa0
Codechange: use std::unique_ptr for managing SaveLoadParams
2024-02-03 21:38:33 +01:00
Rubidium
4b372b6050
Codechange: use std::shared_ptr to manage saveload filters instead of manually trying to avoid double frees
2024-02-03 21:38:33 +01:00
frosch
b1718478c8
Codechange: Replace old non-standard attributes with C++17/20 standard attributes.
2024-02-02 22:29:28 +01:00
Tyler Trahan
2b1f78d2ca
Fix: Use alternate timekeeping units in savegame title ( #11912 )
2024-01-29 22:11:00 +00:00
Kuhnovic
f1e999ec59
Feature: Region-based pathfinder for ships ( #10543 )
2024-01-08 20:29:05 +01:00
Peter Nelson
10f94fb0dd
Codechange: Remove runtime variable size assertion.
2023-12-09 08:13:03 +00:00
frosch
a7707302e6
Codechange: silence false warning.
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
Rubidium
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
Rubidium
97dd84d1e0
Codechange: move saveload string fixing code to saveload
2023-06-08 20:36:27 +02:00
Rubidium
9408ab4799
Codechange: only one '\0' is required
2023-06-08 18:51:02 +02:00
Rubidium
55dfca1936
Codechange: replace seprintf with C++ style formatting
2023-06-05 23:25:59 +02:00
Rubidium
993f90b6a0
Codechange: let GenerateDefaultSaveName return std::string
2023-06-04 14:11:13 +02:00
Rubidium
d9f8a4c380
Codechange: use std::string GetString variant
2023-05-31 19:31:09 +02:00
axet
60540f7df6
Change: Allow dedicated server to use threaded saves. ( #10787 )
...
Co-authored-by: Jonathan G Rennison <j.g.rennison@gmail.com>
2023-05-21 19:55:12 +02:00
Peter Nelson
56085be9bd
Codechange: Move includes for common STL headers to stdafx.
2023-05-17 10:14:41 +01:00
Rubidium
e9c03f0dad
Cleanup: remnants of C-style strings in saveload
2023-05-16 18:32:52 +02: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
Tyler Trahan
6501f84b4a
Codechange: Move calendar date functions inside TimerGameCalendar ( #10753 )
2023-05-04 13:14:12 +00:00
Patric Stout
018a26d9b6
Fix: crash in emscripten when saving games ( #10758 )
...
Don't allocate 128KB on stack, but rather on the heap.
2023-05-02 21:22:09 +00:00