Commit Graph

79 Commits

Author SHA1 Message Date
Rubidium 80d0c7763a Codechange: use Label for the ChunkId over multi-character-literals 2026-07-14 11:49:15 +02:00
Rubidium 05e596661e Codechange: move VarType constants into 'VarTypes' 2026-07-08 17:51:45 +02:00
Rubidium 0a9aa3d20b Codechange: make VarMemType scoped 2026-06-30 00:19:27 +02:00
Rubidium 8db7db5569 Codechange: make VarFileType scoped 2026-06-30 00:19:27 +02:00
Rubidium a76ba0d3d4 Codechange: make ChunkType scoped 2026-06-28 21:07:12 +02:00
Rubidium fc0ad4bb0a Codechange: remove unneeded spaces 2026-06-26 13:04:33 +02:00
Rubidium 5bb87d39b7 Codechange: make SaveLoadVersion a scoped enum 2026-06-26 13:04:33 +02:00
rubidium42 578ec33556 Codechange: use proper names for SLV_145 - SLV_198 (#15767)
* Codechange: rename SLV_145 to SLV_NEWGRF_AIRPORT_SMOKE
* Codechange: rename SLV_146 to SLV_UNIFY_WATER_CLASS
* Codechange: rename SLV_147 to SLV_UNIFY_ANIMATION_FRAME
* Codechange: rename SLV_148 to SLV_INDUSTRY_PLATFORM
* Codechange: rename SLV_149 to SLV_CUSTOM_SEA_LEVEL
* Codechange: rename SLV_150 to SLV_FRACTIONAL_CARGO_DELIVERY
* Codechange: rename SLV_151 to SLV_STORE_NEWGRF_VERSION
* Codechange: rename SLV_152 to SLV_INDUSTRY_MANAGEMENT
* Codechange: rename SLV_153 to SLV_LEAVE_ROAD_STOP_SEPARATELY
* Codechange: rename SLV_154 to SLV_PAUSE_LEVEL
* Codechange: rename SLV_155 to SLV_NEWGRF_OBJECT_VIEW
* Codechange: rename SLV_156 to SLV_TERRAFORM_LIMITS
* Codechange: rename SLV_157 to SLV_UNIFY_GROUND_VEHICLES
* Codechange: rename SLV_158 to SLV_TRACK_REAL_AND_AUTO_ORDERS
* Codechange: rename SLV_159 to SLV_MAX_LENGTH_AND_REVERSE_SIGNALS
* Codechange: rename SLV_160 to SLV_DISALLOW_ROAD_RECONSTRUCTION
* Codechange: rename SLV_161 to SLV_PERSISTENT_STORAGE_POOL
* Codechange: rename SLV_162 to SLV_NEWGRF_CUSTOM_CARGO_AGING
* Codechange: rename SLV_163 to SLV_RIVERS
* Codechange: rename SLV_164 to SLV_VEHICLE_CENTRE_AND_Z_POS
* Codechange: rename SLV_165 to SLV_SCRIPT_TOWN_GROWTH
* Codechange: rename SLV_166 to SLV_INFRASTRUCTURE_MAINTENANCE_COSTS
* Codechange: rename SLV_167 to SLV_NEWGRF_AIRCRAFT_RANGE
* Codechange: rename SLV_168 to SLV_SCRIPT_TOWN_TEXT
* Codechange: rename SLV_169 to SLV_MOVE_SCC_ENCODED
* Codechange: rename SLV_170 to SLV_COUNT_INDIVIDUAL_CARGOES
* Codechange: rename SLV_171 to SLV_SCENARIO_DEITY_SIGNS
* Codechange: rename SLV_172 to SLV_ORDER_MAX_SPEED
* Codechange: rename SLV_173 to SLV_FIX_ROAD_OWNERSHIP
* Codechange: rename SLV_174 to SLV_CURRENT_ORDER_MAX_SPEED
* Codechange: rename SLV_175 to SLV_AUTOREPLACE_WHEN_OLD_TREE_LIMIT
* Codechange: rename SLV_176 to SLV_BACKUP_ORDER_STATE
* Codechange: rename SLV_177 to SLV_MONTHLY_BANKRUPTCY_CHECK
* Codechange: rename SLV_178 to SLV_SCRIPT_SETTINGS_PROFILE
* Codechange: rename SLV_179 to SLV_ROBUST_ENGINE_PREVIEW
* Codechange: rename SLV_180 to SLV_SERVICE_INTERVAL_PERCENT
* Codechange: rename SLV_181 to SLV_CARGO_RESERVATION
* Codechange: rename SLV_182 to SLV_GOAL_PROGRESS_PLANE_ACCELERATION
* Codechange: rename SLV_183 to SLV_CARGODIST
* Codechange: rename SLV_184 to SLV_SEPARATE_LOCALE_UNITS
* Codechange: rename SLV_185 to SLV_STORYBOOKS
* Codechange: rename SLV_186 to SLV_OBJECT_TYPE_TO_POOL
* Codechange: rename SLV_187 to SLV_LINKGRAPH_RESTRICTED_FLOW
* Codechange: rename SLV_188 to SLV_UNIFY_RV_TRAVEL_TIME
* Codechange: rename SLV_189 to SLV_GROUP_HIERARCHY
* Codechange: rename SLV_190 to SLV_SEPARATE_ORDER_TRAVEL_WAIT_TIME
* Codechange: rename SLV_191 to SLV_LINKGRAPH_LOCATION_DISASTER_STORE
* Codechange: rename SLV_192 to SLV_FIX_ORDER_BACKUP
* Codechange: rename SLV_193 to SLV_HIDE_ENGINES_FOR_COMPANY
* Codechange: rename SLV_194 to SLV_MAX_BRIDGE_MAP_HEIGHT
* Codechange: rename SLV_195 to SLV_DISTINGUISH_1_6
* Codechange: rename SLV_196 to SLV_DISTINGUISH_1_7
* Codechange: rename SLV_197 to SLV_STORE_MAP_VARIETY
* Codechange: rename SLV_198 to SLV_TOWN_GROWTH_IN_GAME_TICKS
2026-06-23 22:01:31 +00:00
rubidium42 2a5607d373 Codechange: use proper names for SLV_90 - SLV_114 (#15765)
* Codechange: rename SLV_90 to SLV_PLANE_SPEED_FACTOR
* Codechange: rename SLV_91 to SLV_MORE_HOUSE_ANIMATION_FRAMES
* Codechange: rename SLV_92 to SLV_REMOVE_HOUSE_COUNT
* Codechange: rename SLV_93 to SLV_IMPROVED_ORDERS
* Codechange: rename SLV_94 to SLV_FIX_COMPANY_CARGO_TYPES
* Codechange: rename SLV_95 to SLV_MORE_ENGINE_TYPES
* Codechange: rename SLV_96 to SLV_AIRPORT_NOISE
* Codechange: rename SLV_97 to SLV_MERGE_OPTS_PATS
* Codechange: rename SLV_98 to SLV_GAMELOG
* Codechange: rename SLV_99 to SLV_INDUSTRY_TILE_WATER_CLASS
* Codechange: rename SLV_100 to SLV_YAPP
* Codechange: rename SLV_101 to SLV_NEWGRF_PALETTE
* Codechange: rename SLV_102 to SLV_SPREAD_INDUSTRY_PRODUCTION_CHANGES
* Codechange: rename SLV_103 to SLV_NEWGRF_SUPPLIED_STATION_NAME
* Codechange: rename SLV_104 to SLV_MORE_COMPANIES
* Codechange: rename SLV_105 to SLV_ORDER_LIST
* Codechange: rename SLV_106 to SLV_DISTANT_STATION_JOINING
* Codechange: rename SLV_107 to SLV_NOAI
* Codechange: rename SLV_108 to SLV_STORE_AI_VERSION
* Codechange: rename SLV_109 to SLV_NEXT_COMPETITOR_START_OVERFLOW
* Codechange: rename SLV_110 to SLV_REMOVE_OLD_AI_SETTINGS
* Codechange: rename SLV_111 to SLV_FREEFORM_EDGES
* Codechange: rename SLV_112 to SLV_SPLIT_HQ
* Codechange: rename SLV_113 to SLV_ROAD_LAYOUT_PER_TOWN
* Codechange: rename SLV_114 to SLV_SEPARATE_ROAD_OWNERS
2026-06-23 13:56:17 +02:00
rubidium42 366ec786f1 Codechange: use proper names for SLV_20 - SLV_39 (#15762)
* Codechange: rename SLV_20 to SLV_NO_MULTIHEAD_REFERENCE
* Codechange: rename SLV_21 to SLV_REMOVE_OLD_PBS
* Codechange: rename SLV_22 to SLV_SAVE_PATCHES
* Codechange: rename SLV_23 to SLV_REMOVE_AUTOSAVE_INTERVAL
* Codechange: rename SLV_24 to SLV_ELRAIL
* Codechange: rename SLV_25 to SLV_IMPROVE_MULTISTOP
* Codechange: rename SLV_26 to SLV_LAST_VEHICLE_TYPE
* Codechange: rename SLV_27 to SLV_NEWGRF_STATIONS
* Codechange: rename SLV_28 to SLV_YAPF
* Codechange: rename SLV_29 to SLV_MORE_UNDER_BRIDGES
* Codechange: rename SLV_30 to SLV_TGP
* Codechange: rename SLV_31 to SLV_BIG_DATES
* Codechange: rename SLV_32 to SLV_LINK_FARM_FIELD_TO_INDUSTRY
* Codechange: rename SLV_33 to SLV_SAVE_YAPF_SETTINGS
* Codechange: rename SLV_34 to SLV_LIVERIES
* Codechange: rename SLV_35 to SLV_LIVERY_REFIT
* Codechange: rename SLV_36 to SLV_REFIT_ORDERS
* Codechange: rename SLV_37 to SLV_UTF8
* Codechange: rename SLV_38 to SLV_DISABLE_ELRAIL_SETTING
* Codechange: rename SLV_39 to SLV_FREIGHT_WEIGHT
2026-06-22 12:57:49 +00:00
rubidium42 d81eefcdc8 Codechange: use proper names for SLV_1 - SLV_19 (#15750)
* Codechange: rename SLV_1 to SLV_BIG_CURRENCY
* Codechange: rename SLV_2 to SLV_VEHICLE_CURRENCY_STATION_CHANGES
* Codechange: rename SLV_3 to SLV_BIGGER_STATION_VARIABLES
* Codechange: rename SLV_4 to SLV_TOWN_TOLERANCE_PAUSE_MODE
* Codechange: rename SLV_5 to SLV_BIG_MAP
* Codechange: rename SLV_6 to SLV_MULTIPLE_ROAD_STOPS
* Codechange: rename SLV_7 to SLV_LARGER_CARGO_SOURCE
* Codechange: rename SLV_8 to SLV_LARGER_UNIT_NUMBER
* Codechange: rename SLV_9 to SLV_LARGER_TOWN_CARGO_STATISTICS
* Codechange: rename SLV_10 to SLV_LARGER_TOWN_COUNTER
* Codechange: rename SLV_11 to SLV_LARGER_TOWN_ITERATOR
* Codechange: rename SLV_12 to SLV_LINK_WAYPOINT_TO_TOWN
* Codechange: rename SLV_13 to SLV_LARGER_AI_STATE_COUNTER
* Codechange: rename SLV_14 to SLV_TRANSFER_ORDER
* Codechange: rename SLV_15 to SLV_MOVE_SEMAPHORE_BITS
* Codechange: rename SLV_16 to SLV_ENGINE_RENEW
* Codechange: rename SLV_17 to SLV_STORE_WAYPOINT_ID_IN_MAP
* Codechange: rename SLV_18 to SLV_REMOVE_MINOR_VERSION
* Codechange: rename SLV_19 to SLV_ENGINE_RENEW_POOL
2026-06-21 19:27:53 +02:00
Rubidium bcda4a72ee Codechange: make WindowClass a scoped enum 2026-05-20 21:39:04 +02:00
Peter Nelson 7eafa497d1 Fix 47dd04d: crash when loading crash save with no viewport coordinates (#15550) 2026-04-28 21:45:35 +01:00
Cyprian Klimaszewski 5943382cf5 Codechange: Make documentation comments for some types recognised by doxygen. 2026-02-21 15:05:13 +01:00
Cyprian Klimaszewski 21bee91fa7 Codechange: Make some variables and constants documentation comments recognised by doxygen. 2026-02-21 15:05:13 +01:00
Jonathan G Rennison 9ac7623608 Fix #14951: Init and save/load TimerGameEconomy::days_since_last_month (#14962) 2025-12-24 13:00:09 +00:00
Rito12 859b56a066 Doc: Correct file descriptions to match coding style and doxygen. 2025-12-15 17:31:00 +01:00
Cyprian Klimaszewski 99f04f27de Doc: Update information for receiving a copy of GPL. (#14869) 2025-12-07 11:25:08 +00:00
frosch 8571af9833 Codechange: Turn ZoomLevel into enum class. 2025-05-03 23:21:09 +02:00
Peter Nelson 8275bbfb87 Codechange: Pass Viewport by reference.
This means we do not have to care what type of pointer is used.
2025-04-09 22:03:23 +01:00
Jonathan G Rennison 11ec156b64 Codechange: Add a priority field to TimerGameTick::TPeriod
Use this as the primary sort key for TimerGameTick::TPeriod,
to avoid container sort order changes on timer period saveload.
See: #12509
2024-04-25 20:08:24 +02: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
Tyler Trahan 21581b6ab3 Feature: Setting for minutes per calendar year (#11428) 2024-01-23 18:33:54 -05:00
Tyler Trahan 735abfe111 Codechange: Split dates and timers into Economy and Calendar time (#10700) 2024-01-22 09:04:34 -05:00
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 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
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
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
Tyler Trahan 6501f84b4a Codechange: Move calendar date functions inside TimerGameCalendar (#10753) 2023-05-04 13:14:12 +00: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
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
Rubidium bcfe0fb076 Codechange: introduce GetMainWindow() to properly account for nullptr checks
Some nullptr checks have been removed as they were not triggered with nullptr
with the null video driver and in dedicated server mode.
2023-01-14 21:15:23 +01:00
dP 548f0496a9 Change: Make _tick_counter 64bit to avoid wrapping (#10035) 2022-09-21 12:42:29 +02:00
glx22 6e627f35ac Cleanup: Remove now unneeded ChunkHandler members 2021-07-06 22:29:08 +02:00
glx22 2c941cd8b3 Codechange: Use ChunkHandlers sub-classes 2021-07-06 22:29:08 +02:00
glx22 c1a9fe6fbd Codechange: Use static array of references to ChunkHandler 2021-07-06 22:29:08 +02:00
Patric Stout cdb3dd0493 Add: store headers for most savegame chunks
When a header is added, the chunk changes from CH_ARRAY type to
CH_TABLE type.
2021-07-02 22:21:58 +02:00
Patric Stout 7dd5fd6ed4 Feature: framework to make savegames self-descriptive
We won't be able to make it fully self-descriptive (looking at you
MAP-chunks), but anything else can. With this framework, we can
add headers for each chunk explaining how each chunk looks like
in detail.

They also will all be tables, making it a lot easier to read in
external tooling, and opening the way to consider a database
(like SQLite) to use as savegame format.

Lastly, with the headers in the savegame, you can freely add
fields without needing a savegame version bump; older versions
of OpenTTD will simply ignore the new field. This also means
we can remove all the SLE_CONDNULL, as they are irrelevant.

The next few commits will start using this framework.
2021-07-02 22:21:58 +02:00
Patric Stout 88edfd4ef1 Change: rework several CH_RIFF chunks to use CH_ARRAY instead
This adds two byte extra to those chunks, and might feel a bit
silly at first. But in later changes we will prefix CH_ARRAY with
a table header, and then this change shines.

Without this, we could still add headers to these chunks, but any
external reader wouldn't know if the CH_RIFF has them or not. This
way is much more practical, as they are now more like any other
chunk.
2021-06-15 19:36:15 +02:00
glx22 c27afdf3f6 Codechange: Remove FOR_ALL_CHUNK_HANDLERS
Co-Authored-By: Patric Stout <truebrain@openttd.org>
2021-06-06 19:35:06 +02:00
Patric Stout 9fff00ba20 Codechange: C++-ify lists for SaveLoad (#9323)
Basically, this changes "SaveLoad *" to either:
1) "SaveLoadTable" if a list of SaveLoads was meant
2) "SaveLoad &" if a single entry was meant

As added bonus, this removes SL_END / SLE_END / SLEG_END. This
also adds core/span.hpp, a "std::span"-lite.
2021-05-31 22:26:44 +02:00
Charles Pigott 9b800a96ed Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
TechGeekNZ a10013dd00 Codechange: Spell 'Viewport' consistently
Some places in the codebase misspell 'Viewport' as 'ViewPort' or 'view_port'.
This patch makes everything consistent.
2020-07-27 17:31:29 +01:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
Charles Pigott 96a4787710 Codechange: Set ZoomLevel's base type to byte instead of using ZoomLevelByte 2019-04-29 17:40:22 +01:00
peter1138 4f052fc2a4 Cleanup: Fix alignment after NULL -> nullptr change. 2019-04-13 20:35:10 +01:00
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00