Peter Nelson
47dd04d16c
Fix: Don't crash when saving a crashlog save with no main window open.
2023-12-14 20:54:31 +00:00
Tyler Trahan
2a62caa30b
Codechange: Use Ticks for BaseConsist timetable fields
2023-12-11 07:12:45 -05:00
Peter Nelson
10f94fb0dd
Codechange: Remove runtime variable size assertion.
2023-12-09 08:13:03 +00:00
Peter Nelson
9f853c10b0
Codechange: Add compile-time check that variable size matches saveload entry.
2023-12-09 08:13:03 +00:00
Peter Nelson
cb53fed229
Codechange: Move VarType helpers to allow earlier use.
2023-12-09 08:13:03 +00:00
Peter Nelson
54ba757910
Fix #11556 : Missing saveload change for OrderBackup. ( #11557 )
...
Apply the saveload change from #11468 to OrderBackup and bump again.
2023-12-07 19:31:30 +00:00
Tyler Trahan
1f41e773d6
Codechange: Use consistent name for bay road stops
...
As of #10494 , this is how we describe original dead-end road stops.
2023-11-28 14:24:33 -05:00
Tyler Trahan
d28caa3ced
Codechange: Use ticks for timetable start date
2023-11-25 11:50:46 -05:00
Peter Nelson
ab535c0a86
Codechange: Add base() method to StrongType to allow access to the base type without casting. ( #11445 )
...
This removes the ability to explicitly cast to the base type, but the requirement
to use .base() means the conversion is still explicit.
2023-11-06 20:29:35 +00:00
Tyler Trahan
2dd2910ab3
Feature: Cheat to fix station ratings at 100% ( #11346 )
2023-10-21 08:35:52 -04:00
Rubidium
c9276c2959
Codechange: replace x.size() == 0 with x.empty()
2023-10-20 23:05:43 +02:00
Peter Nelson
9602de474d
Codechange: Use iterators and/or range-for on cargo related loops.
2023-10-19 17:03:25 +01:00
Peter Nelson
b5dc9328f2
Change: Store station blocked/wires/pylons flags in map. ( #11337 )
...
This stores three flags in unused map bits, and avoids having to look up
station graphics and custom station specs to determine blocked/wires/pylons
status.
This potentially affects rail pathfinding performance.
Savegame version is not bumped, as the flags can just be updated every
time.
2023-09-30 12:30:25 +01:00
Peter Nelson
49dae08a3b
Codechange: Add missing override specifiers.
2023-09-25 21:27:45 +01: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
Patric Stout
df400ef84a
Fix: only count distance traveled in vehicles for cargo payment ( #11283 )
...
No longer you can utilize the free (and instant) labour of station
workers, transporting your cargo from one part of the station to
the other. No more!
Based on patch by dP.
2023-09-19 22:16:31 +02:00
Patric Stout
d1a0ca67be
Codechange: simplify splitting of CargoPacket ( #11286 )
2023-09-13 09:40:01 -04:00
PeterN
acd7d3c913
Codechange: Rename *Railtype* to *RailType* for consistency. ( #11287 )
2023-09-11 08:55:12 +00:00
Patric Stout
7e3cdbaf62
Fix: mark next_station as INVALID_STATION when loading from older savegames
2023-09-11 00:25:47 +02:00
Patric Stout
9e3763cfb3
Fix b0e73277: save/load next_station for CargoPacket again
2023-09-11 00:25:47 +02:00
Patric Stout
e6c02ebee6
Fix b0e73277: cargodist information got lost when splitting of cargo ( #11280 )
...
During b0e73277
we removed loaded_at_xy, but I kinda forgot that
it was a union with next_station. Now next_station wasn't copied
anymore, or checked in AreMergable.
2023-09-10 15:20:58 +02:00
Tyler Trahan
701a61c9af
Codechange: Delete date_type.h
2023-09-10 08:40:25 -04:00
Tyler Trahan
77173a6a10
Codechange: Move date consts and functions to CalendarTime and TimerGameCalendar classes
2023-09-10 08:40:25 -04:00
Tyler Trahan
fca2b37726
Codechange: Move Ticks into their own class
2023-09-10 08:40:25 -04:00
Patric Stout
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 Stout
b0e73277d6
Codechange: remove loaded_at_xy from CargoPacket as it was unused ( #11276 )
2023-09-09 20:24:46 +01:00
Peter Nelson
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 Stout
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 Stout
299570b2c1
Codechange: make TimerGameCalendar Date and Year types strongly typed ( #10761 )
2023-08-12 18:14:21 +00:00
Tyler Trahan
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
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
PeterN
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
rubidium42
9f6fec01cd
Codechange: rename cargo aging days to periods, as they are not really days ( #11112 )
2023-07-12 13:20:02 -04:00
Rubidium
18a31cca7c
Codechange: do not make a string valid in place, to then copy it
2023-07-06 19:59:50 +02:00
PeterN
ed06c6bdcf
Codechange: Use vector when migrating old savegame orders. ( #11020 )
2023-06-16 19:40:24 +01: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
fbd71a9d72
Codechange: replace C-style string processing with C++-style for the listing callbacks
2023-06-05 23:25:49 +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
PeterN
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 Nelson
76516d7f70
Codechange: Use IsValidCargoID/IsValidCargoType.
...
IsValidCargoType() is used only for unmapped IDs.
2023-05-22 20:43:40 +01: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
Rubidium
3323402aaa
Codechange: rename smallvec_type to container_func and use only when needed
2023-05-20 16:53:10 +02:00
Rubidium
acec34a0fe
Cleanup: remove MD5SumToString in lieu of FormatArrayAsHex
2023-05-19 11:24:44 +02:00
Peter Nelson
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 Nelson
c38df2d589
Codechange: Use std::map instead of custom SmallMap.
2023-05-18 12:18:30 +01: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
52a7c69974
Codechange: rework Gamelog changes from union to classes
2023-05-16 18:32:52 +02:00
Patric Stout
199e41c762
Codechange: use default dtor instead of empty ( #10826 )
2023-05-14 23:31:03 +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
Rubidium
9f2fc860ad
Codechange: use std::optional<std::string> for changing the script over char *
2023-05-14 22:54:10 +02:00
Michael Lutz
72c7536325
Codechange: Use a dedicated variable for disaster vehicle action state. ( #10798 )
2023-05-12 21:41:36 +02:00
Peter Nelson
e6740046ee
Codechange: Use range-for iteration.
2023-05-11 07:58:55 +01:00
Peter Nelson
cef3a2570d
Codechange: Use standard iterator-erase-loop pattern.
2023-05-11 07:58:55 +01: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
fb856e16c1
Codechange: replace some min/clamp constructs to ClampTo
2023-05-06 21:26:13 +02:00
Loïc Guilloux
31d1a323ef
Fix #10771 , 3901ef9: GRFConfig.filename is now a std::string ( #10774 )
2023-05-06 14:58:47 +00:00
Peter Nelson
912eb68981
Change: Extend entity override manager and station spec lists to support 16 bit IDs.
2023-05-05 07:08:40 +01:00
Rubidium
a312a6c1b2
Codechange: make md5sumToString std::string compatible
2023-05-04 23:23:32 +02:00
Peter Nelson
7ccdefa1c1
Change: Increase vehicle random data from 8 to 16 bits.
2023-05-04 21:42:28 +01: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
Peter Nelson
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
Rubidium
1f3b7e2efd
Codechange: use std::string instead of stredup for saveload error messages
2023-05-01 16:23:24 +02:00
Rubidium
aac95eeaf5
Codechange: use std::string instead of stredup/free for stories
2023-05-01 16:23:24 +02:00
Rubidium
3342967ad9
Codechange: use std::string instead of stredup/free for goals
2023-05-01 16:23:24 +02:00
Rubidium
ee723f26ba
Codechange: Make FileToSaveLoad's title std::string and simplify assignments
2023-04-29 13:23:34 +02:00
Patric Stout
36a0818bc5
Remove: buying/selling/owning company shares ( #10709 )
2023-04-29 10:16:49 +02:00
Rubidium
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 Stout
31ad990831
Codechange: move tick-counter into TimerGameTick ( #10712 )
2023-04-24 16:55:40 +00:00
Patric Stout
7aa2b9ab0a
Codechange: move all date-related variables inside the timer ( #10706 )
2023-04-24 15:56:01 +00:00
Rubidium
f5f6306af3
Codechange: use string/fmt instead of printf for ShowInfo(F)
2023-04-24 17:51:54 +02:00
PeterN
e97bf271dc
Codechange: Make SpriteType, CargoSortType, SourceType and ScriptType enum classes. ( #10663 )
...
This avoids a (soft) namespace conflict between the four ST_* enums.
2023-04-16 20:00:55 +01:00
Patric Stout
ed83c4b0da
Change: replace per-AI "start_date" with a global "competitors_interval" ( #10653 )
...
The per-AI "start_date" is a lot of custom code, and was rarely
used in the way it was meant.
While at it, also ported this part over to the new timer system.
2023-04-16 20:14:22 +02:00
Charles Pigott
6fc28d649e
Cleanup: Unused alloca definitions and includes
2023-04-15 16:57:00 +01:00
Charles Pigott
b282664242
Codechange: Replace all usages of alloca/AllocaM with more modern/less discouraged alternatives
2023-04-15 16:57:00 +01:00
Tyler Trahan
646a7e625b
Change: Use seconds for Linkgraph update settings ( #10610 )
2023-04-14 22:49:12 +02:00
PeterN
ce046f6d17
Fix: Abort loading savegame if road vehicle is on invalid road type. ( #10622 )
...
This can happen if NewGRFs are missing so that engine or road type definitions are wrong.
2023-04-10 19:23:18 +01:00
Charles Pigott
ce24709576
Add: Some additional debugging information when chunk sizes are incorrect
2023-04-10 18:58:48 +01:00
Charles Pigott
8aea13a85b
Codechange: Use fmt for SlErrorCorruptFmt
2023-04-10 18:58:48 +01:00
dP
e2f1cd44dc
Change: Increase max cargo age and let min cargo payment approach zero. ( #10596 )
...
Co-authored-by: Michael Lutz <michi@icosahedron.de>
2023-04-10 12:34:28 +02:00
PeterN
078e27bd84
Fix #10619 : Crash loading linkgraph for older savegames. ( #10620 )
2023-04-09 19:28:55 +01:00
Rubidium
9d2a0f3d0b
Change: make GetPartialZ consistent, meaning Z of adjacent slopes continue
...
Previously, on a straight line of a one corner up slope with the adjacent
steep sloop the Z would increase one step every two sub pixels, except for one
case where one sub pixel is skipped. Similarly, a steep slope with two
adjacent one corner up slopes, would have a bump in the height line along the
diagonal whenever it enters/leaves the steep slope tile.
2023-04-09 19:00:26 +02:00
Rubidium
e8af8daa68
Codechange: pass "ground vehicle" to GetTileSlopeZ since for tunnel/bridges there are two states
...
Previously it checked the position in non-driving direction to "guess" whether
a ground vehicle was using the function, so on tunnels/bridges it could either
return the Z of the (virtual) ground compared to the Z of the path the vehicle
would take.
2023-04-09 19:00:26 +02:00
PeterN
f1144de509
Feature: Separate rail/road and sea/air velocity units, and add knots. ( #10594 )
...
This is achieved by packing vehicle type along with the velocity so that
the string system can decode and pick the appropriate unit.
2023-04-08 12:26:13 -04:00
Peter Nelson
65e0b0dcb7
Codechange: Be consistent with how company masks are set to all.
2023-04-07 22:09:55 +01:00
Tyler Trahan
e5438891e2
Cleanup: Keep spacing saveload versions by groups of five ( #10576 )
2023-03-19 11:02:54 -04:00
Rubidium
580d0a6343
Codechange: make use of Tile in for all direct map accesses
2023-02-28 07:11:48 +01:00
Rubidium
0fb0469e47
Codechange: introduce iterator to iterate over the Tiles of a Map
...
Note: this version is using TileIndex, but that changes later
2023-02-28 07:11:48 +01:00
dP
b0542c8c49
Codechange: Don't store tree counter in the map array ( #10018 )
2023-02-26 16:39:44 -05:00
SamuXarick
6eabbaa751
Fix #10469 , 5e14a20: [Script] League Table rating element is a int64 everywhere else
2023-02-26 22:25:13 +01:00
Michael Lutz
aab580e0ac
Codechange: [Linkgraph] Drop node/edge wrappers from LinkGraph.
2023-02-26 21:41:24 +01:00
Michael Lutz
7352f812e6
Codechange: [Linkgraph] Only store present link graph edges and not all possible edges.
2023-02-26 21:41:24 +01:00
Michael Lutz
178249e7cc
Codechange: Saveload macros for entries with a custom table name.
2023-02-26 21:41:24 +01:00
Michael Lutz
fe27db3dfd
Codechange: [Linkgraph] Store edges in each node and not in a global matrix.
2023-02-26 21:41:24 +01:00