Commit Graph

60 Commits

Author SHA1 Message Date
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 23b3efdae8 Codechange: use proper names for SLV_65 - SLV_89 (#15764)
* Codechange: rename SLV_65 to SLV_UNIFY_CURRENCY
* Codechange: rename SLV_66 to SLV_NEWGRF_TOWN_NAMES
* Codechange: rename SLV_67 to SLV_TIMETABLES
* Codechange: rename SLV_68 to SLV_CARGO_PACKETS
* Codechange: rename SLV_69 to SLV_MORE_CARGO_PACKETS
* Codechange: rename SLV_70 to SLV_CARGO_PAYMENT_OVERFLOW
* Codechange: rename SLV_71 to SLV_UNGROUPED_VEHICLES
* Codechange: rename SLV_72 to SLV_SPLIT_STATION_TYPE_FROM_GFXID
* Codechange: rename SLV_73 to SLV_NEWGRF_INDUSTRY_LAYOUT
* Codechange: rename SLV_74 to SLV_FIX_STATION_PICKUP_ACCOUNTING
* Codechange: rename SLV_75 to SLV_AUTOSLOPE
* Codechange: rename SLV_76 to SLV_NEWGRF_PERSISTENT_STORAGE
* Codechange: rename SLV_77 to SLV_CLEANUP_UNCONNECTED_ROADS
* Codechange: rename SLV_78 to SLV_STORE_INDUSTRY_CARGO
* Codechange: rename SLV_79 to SLV_FAIR_PLAY_SETTINGS
* Codechange: rename SLV_80 to SLV_NEWGRF_MORE_ANIMATION
* Codechange: rename SLV_81 to SLV_FIX_TREE_GROUND
* Codechange: rename SLV_82 to SLV_NEWGRF_INDUSTRY_RANDOM_TRIGGERS
* Codechange: rename SLV_83 to SLV_DEPOT_WATER_OWNERS
* Codechange: rename SLV_84 to SLV_REPLACE_CUSTOM_NAME_ARRAY
* Codechange: rename SLV_85 to SLV_MAGLEV_MONORAIL_PAX_WAGON_LIVERY
* Codechange: rename SLV_86 to SLV_WATER_CLASS
* Codechange: rename SLV_87 to SLV_SIMPLIFY_PATHFINDER_SETTINGS
* Codechange: rename SLV_88 to SLV_FRACTION_PROFIT_RUNNING_TICKS
* Codechange: rename SLV_89 to SLV_MORE_WAYPOINTS_PER_TOWN
2026-06-23 06:53:27 +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
Peter Nelson 77403627a8 Codechange: make VehicleType a scoped enum 2026-04-26 07:00:13 +01:00
Rubidium e9e7e4af51 Codechange: remove need for new (address) PoolItem(...) 2026-01-03 17:33:18 +01:00
Rubidium 2e6f8fe191 Codefix: use constructor to set index of PoolItems over 'magic'/UB 2026-01-03 16:04:32 +01: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
Jonathan G Rennison 63f1c2aa3a Codechange: Use TypedIndexContainer for typed index containers
Instead of ReferenceThroughBaseContainer
2025-06-12 18:50:49 +01:00
Loïc Guilloux 7723625823 Fix #13729, f8b1e30: Incorrect conversion of EngineFlags to EngineFlag (#13743) 2025-03-05 09:12:06 +00:00
Rubidium fd4adc55e3 Codechange: replace INVALID_X with XID::Invalid() for PoolIDs 2025-02-16 20:23:00 +01:00
Rubidium 7e04651220 Codechange: strongly type EngineID 2025-02-16 14:50:15 +01:00
Rubidium 9015c3651f Codechange: make EngineID an enum 2025-02-16 14:50:15 +01:00
Rubidium 4fe3f0ccdd Codechange: simplify management of temporary Engine in saveload 2025-02-14 18:35:12 +01:00
Rubidium 37c215f1fd Fix #13513, ec492cb267: std::numeric_limits<CompanyMask> not working causes no vehicles to exist
std::numeric_limits<T>::max() returns 0 instead of an error when the type is unknown.
Solve it by implementing and using Set() and All() in BaseBitSet in same way as std::bitset.
2025-02-09 22:50:55 +01:00
Rubidium 4ca1fe6c32 Codechange: replace MAX_UVALUE with std::numeric_limits::max 2025-02-01 01:29:02 +01:00
Peter Nelson f8b1e3033f Codechange: Use EnumBitSet for EngineFlags. 2025-01-31 18:55:31 +00:00
Peter Nelson f56b6756f1 Codechange: Sort EngineOverrideManager for fast lookups.
Allows quickly finding the EngineID given the type, grfid and local id of an engine, instead a linear scan.

This can reduce loading time when lots of engines are present and also affects performance in-game.
Lookup can be on the order of 10000 times faster.
2024-12-05 18:17:58 +00:00
Peter Nelson bc2513975f Codechange: Don't inherit EngineOverrideManager from std::vector.
Inheriting from std::vector means some operations are needlessly complex, and shouldn't really be done anyway.
2024-12-05 18:17:58 +00:00
Rubidium e3f49ee7a0 Codechange: coding style fixes 2024-01-04 16:23:54 +01: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 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
Peter Nelson 65e0b0dcb7 Codechange: Be consistent with how company masks are set to all. 2023-04-07 22:09:55 +01: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 8e91527251 Codechange: mark chunks that are not stored as CH_READONLY
This makes it easier to spot chunks that have a save_proc that
is a nullptr, but also prevents confusion, where it looks like
the CH_ type of a chunk has influence on how it is being read.
It is not, it is only used for saving.
2021-06-15 19:36:15 +02:00
Patric Stout 97b94bdc9a Change: prefix SL_ARR with the length of the array
This means that during loading we can validate that what is saved
is also that what is expected. Additionally, this makes all list
types similar to how they are stored on disk:
First a gamma to indicate length, followed by the data.
The size still depends on the type.
2021-06-15 16:45:04 +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
Michael Lutz 79240eab1e Codechange: Make use of the improved C++17 emplace_back function. 2020-12-15 00:29:30 +01:00
Michael Lutz 63ccb36ef3 Codechange: Use std::string for most of the user-settable custom names. 2020-05-21 20:02:34 +02:00
frosch a4be4514c9 Fix #7925: Reset temporary saveload data at the start of loading a savegame instead of at the end.
Otherwise temporary data may be passed from an aborted load action to the next load action.
2020-01-12 19:08:38 +01:00
glx 1f6b3a37f9 Codechange: Replace FOR_ALL_ENGINES with range-based for loops 2019-12-21 20:13:03 +01:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00: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
Henry Wilson ab711e6942 Codechange: Replaced SmallVector::[Begin|End]() with std alternatives 2019-03-26 20:15:57 +00:00
Henry Wilson a0f36a50e6 Codechange: Replaced SmallVector::Append() with std::vector::[push|emplace]_back() 2019-03-26 20:15:57 +00:00
Henry Wilson bfd79e59dc Codechange: Replace SmallVector::Clear() with std::vector::clear() 2019-03-26 20:15:57 +00:00
Peter Nelson 9de12521ec Codechange: Convert saveload numbers to enum values.
(This was mostly achieved with a few in-place regexes)
2019-02-02 21:39:06 +00:00
Peter Nelson ea4ea62816 Codechange: Make saveload version upper bound exclusive, i.e. version object was removed instead of version object last appeared. 2019-02-02 21:39:06 +00:00
frosch 8ffe068c11 (svn r27243) -Fix (r26816) [FS#6285]: Duplicate frees due to pool item classes not having copy constructors. 2015-04-23 20:07:07 +00:00
frosch e53d97b4f8 (svn r26816) -Fix [FS#6109]: Properly zero-initialise data in _temp_engine. 2014-09-13 14:46:03 +00:00
alberth f72ad87540 (svn r26802) -Add: Command to set visibility of an engine for a company (based on patch by Juanjo). 2014-09-07 16:12:58 +00:00
rubidium 9ed12b0f07 (svn r26509) -Codechange: replace strdup with stredup (the latter ensures the return is not NULL) 2014-04-25 15:40:32 +00:00
rubidium 0463dbdc9e (svn r26482) -Codechange: add an include that allows us to undefine/redefine "unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values 2014-04-23 20:13:33 +00:00