Commit Graph
1142 Commits
Author SHA1 Message Date
Patric StoutandGitHub 30172fc037 Codechange: cleanup CargoPacket in terms of variable/function names (#11278)
Over the years, things got reused and changed, making the current
names somewhat unclear in what they actually mean and do.
2023-09-09 23:21:21 +02:00
Patric StoutandGitHub b0e73277d6 Codechange: remove loaded_at_xy from CargoPacket as it was unused (#11276) 2023-09-09 20:24:46 +01:00
Peter NelsonandPeterN 9040d7813d Codechange: Use std::array and std::unique_ptr for PersistentStorageArrays.
This (mostly) avoids the need for manual memory management and copying.
2023-09-09 15:26:03 +01:00
Patric StoutandGitHub 07730584d7 Codechange: make explicit when a TileIndex is cast to its basetype (#11190)
This prevents people accidentially assigning a TileIndex to a Date
or any other type they shouldn't.
2023-08-15 18:12:05 +02:00
Patric StoutandGitHub 299570b2c1 Codechange: make TimerGameCalendar Date and Year types strongly typed (#10761) 2023-08-12 18:14:21 +00:00
9a602ff304 Fix #10334: Store separate newgrf-safe version of date_of_last_service. (#11124)
This value is not changed when the date cheat is used, which caused issues with changing properties based on service date.

Co-authored-by: Peter Nelson <peter1138@openttd.org>
2023-08-06 12:57:10 -04: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
PeterNandGitHub c3d1264a4b Change: Don't save industry history if cargo slot isn't used. (#11133)
This avoids saving history of 16 slots per industry when in many cases (NewGRF dependent) only a couple are used.
2023-07-14 11:12:22 +01:00
rubidium42andGitHub 9f6fec01cd Codechange: rename cargo aging days to periods, as they are not really days (#11112) 2023-07-12 13:20:02 -04:00
Rubidiumandrubidium42 18a31cca7c Codechange: do not make a string valid in place, to then copy it 2023-07-06 19:59:50 +02:00
PeterNandGitHub ed06c6bdcf Codechange: Use vector when migrating old savegame orders. (#11020) 2023-06-16 19:40:24 +01:00
Rubidiumandrubidium42 97dd84d1e0 Codechange: move saveload string fixing code to saveload 2023-06-08 20:36:27 +02:00
Rubidiumandrubidium42 9408ab4799 Codechange: only one '\0' is required 2023-06-08 18:51:02 +02:00
Rubidiumandrubidium42 55dfca1936 Codechange: replace seprintf with C++ style formatting 2023-06-05 23:25:59 +02: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 993f90b6a0 Codechange: let GenerateDefaultSaveName return std::string 2023-06-04 14:11:13 +02:00
Rubidiumandrubidium42 d9f8a4c380 Codechange: use std::string GetString variant 2023-05-31 19:31:09 +02:00
PeterNandGitHub 584faaf064 Change: Reorganise industry accept/produce arrays. (#10853)
Use a array of struct for each cargo instead of an array for each statistic.
This makes iterating for acceptance and production much simpler.
pct_transported is now calculated when needed.
2023-05-25 21:25:46 +01:00
Peter NelsonandPeterN 76516d7f70 Codechange: Use IsValidCargoID/IsValidCargoType.
IsValidCargoType() is used only for unmapped IDs.
2023-05-22 20:43:40 +01:00
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
Rubidiumandrubidium42 3323402aaa Codechange: rename smallvec_type to container_func and use only when needed 2023-05-20 16:53:10 +02:00
Rubidiumandrubidium42 acec34a0fe Cleanup: remove MD5SumToString in lieu of FormatArrayAsHex 2023-05-19 11:24:44 +02:00
Peter NelsonandPeterN 91e140c722 Codechange: Use unique_ptr for fios company properties.
This is the data used to show company names in the saveload window.
2023-05-18 12:18:30 +01:00
Peter NelsonandPeterN c38df2d589 Codechange: Use std::map instead of custom SmallMap. 2023-05-18 12:18:30 +01:00
Peter NelsonandPeterN 56085be9bd Codechange: Move includes for common STL headers to stdafx. 2023-05-17 10:14:41 +01:00
Rubidiumandrubidium42 e9c03f0dad Cleanup: remnants of C-style strings in saveload 2023-05-16 18:32:52 +02:00
Rubidiumandrubidium42 52a7c69974 Codechange: rework Gamelog changes from union to classes 2023-05-16 18:32:52 +02:00
Patric StoutandGitHub 199e41c762 Codechange: use default dtor instead of empty (#10826) 2023-05-14 23:31:03 +02:00
Patric StoutandPatric 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
Rubidiumandrubidium42 9f2fc860ad Codechange: use std::optional<std::string> for changing the script over char * 2023-05-14 22:54:10 +02:00
Michael LutzandGitHub 72c7536325 Codechange: Use a dedicated variable for disaster vehicle action state. (#10798) 2023-05-12 21:41:36 +02:00
Peter NelsonandPeterN e6740046ee Codechange: Use range-for iteration. 2023-05-11 07:58:55 +01:00
Peter NelsonandPeterN cef3a2570d Codechange: Use standard iterator-erase-loop pattern. 2023-05-11 07:58:55 +01: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 fb856e16c1 Codechange: replace some min/clamp constructs to ClampTo 2023-05-06 21:26:13 +02:00
Loïc GuillouxandGitHub 31d1a323ef Fix #10771, 3901ef9: GRFConfig.filename is now a std::string (#10774) 2023-05-06 14:58:47 +00:00
Peter NelsonandPeterN 912eb68981 Change: Extend entity override manager and station spec lists to support 16 bit IDs. 2023-05-05 07:08:40 +01:00
Rubidiumandrubidium42 a312a6c1b2 Codechange: make md5sumToString std::string compatible 2023-05-04 23:23:32 +02:00
Peter NelsonandPeterN 7ccdefa1c1 Change: Increase vehicle random data from 8 to 16 bits. 2023-05-04 21:42:28 +01:00
Tyler TrahanandGitHub 6501f84b4a Codechange: Move calendar date functions inside TimerGameCalendar (#10753) 2023-05-04 13:14:12 +00:00
Patric StoutandGitHub 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
Peter NelsonandPeterN 00bf42353a Codechange: Place gamelog into its own class, along with internal data.
Data is now stored in vectors to avoid manual memory management and
passing lengths around.
2023-05-02 19:47:55 +01:00
Rubidiumandrubidium42 1f3b7e2efd Codechange: use std::string instead of stredup for saveload error messages 2023-05-01 16:23:24 +02:00
Rubidiumandrubidium42 aac95eeaf5 Codechange: use std::string instead of stredup/free for stories 2023-05-01 16:23:24 +02:00
Rubidiumandrubidium42 3342967ad9 Codechange: use std::string instead of stredup/free for goals 2023-05-01 16:23:24 +02:00
Rubidiumandrubidium42 ee723f26ba Codechange: Make FileToSaveLoad's title std::string and simplify assignments 2023-04-29 13:23:34 +02:00
Patric StoutandGitHub 36a0818bc5 Remove: buying/selling/owning company shares (#10709) 2023-04-29 10:16:49 +02:00
Rubidiumandrubidium42 33c4fbff8f Codechange: use fmt::format_to instead of seprintf to fill load crash message 2023-04-28 19:53:03 +02:00
Tyler Trahan 930f0a16d8 Codechange: Define Date/Year/Month/Day within TimerGameCalendar class 2023-04-26 07:14:03 -04:00
Patric StoutandGitHub 31ad990831 Codechange: move tick-counter into TimerGameTick (#10712) 2023-04-24 16:55:40 +00:00