Commit Graph
460 Commits
Author SHA1 Message Date
Rubidiumandrubidium42 155d7de132 Codechange: change Source into a class with conversion helpers
A Source is either a CompanyID (Headquarters), IndustryID or TownID.
When making those types stronger a lot of casts would be needed, but
with these simple helpers the intent is shown more clearly.
2025-02-09 15:28:35 +01:00
Rubidiumandrubidium42 cb3db3cedd Codechange: strongly type ObjectID 2025-02-09 15:07:29 +01:00
Rubidiumandrubidium42 5f41bc0279 Codechange: put SourceType and SourceID into Source struct 2025-02-08 06:37:23 +01:00
Peter NelsonandPeter Nelson 2bb3f368e3 Codechange: Use EnumBitSet for IndustryBehaviours. 2025-02-07 12:30:06 +00:00
Jonathan G Rennisonandrubidium42 3ea4d1d4fc Fix #12912: CompanyProperties::inaugurated_year_calendar not saved 2025-02-03 08:09:45 +01:00
Peter NelsonandPeter Nelson 6f52a977a8 Codechange: Use EnumBitSet for GRFConfigFlags.
This is renamed from `GCF_Flag` didn't match convention.
2025-02-02 10:49:45 +00:00
Peter NelsonandGitHub 59354576d4 Codechange: Use EnumBitSet for LandscapeTypes and remove LandscapeID. (#13436) 2025-02-01 23:09:18 +00:00
Rubidiumandrubidium42 4ca1fe6c32 Codechange: replace MAX_UVALUE with std::numeric_limits::max 2025-02-01 01:29:02 +01:00
Peter NelsonandPeter Nelson 6c4ddb242a Codechange: Use EnumBitSet for EngineMiscFlags. 2025-01-31 18:55:31 +00:00
Peter NelsonandGitHub 5664b1e2f6 Codechange: Use std::vector for GRFConfig lists. (#10835)
This replaces the C-style custom managed linked-list and allows use of iterators etc.
2025-01-31 17:09:09 +00:00
Peter NelsonandPeter Nelson 5ef495da78 Codechange: Use EnumBitSet for GroupFlags. 2025-01-29 21:46:39 +00:00
Rubidiumandrubidium42 4099acb946 Codechange: replace BSWAP32/BSWAP16 with std::byteswap 2025-01-28 19:22:12 +01:00
Rubidiumandrubidium42 e894a5880c Codechange: rename CargoID to CargoType and amend related variables/comments 2025-01-26 18:07:10 +01:00
Peter NelsonandGitHub 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 NelsonandGitHub 4397aa3909 Codechange: Make StationType an enum class. (#13339) 2025-01-19 20:53:08 +00:00
Peter NelsonandGitHub 95f8fc983b Codechange: Make GroupFlags an enum class. (#13312)
GF_END is 'reserved' in some Windows APIs. Instead of working around it, make GroupFlags an enum class.
2025-01-14 11:33:26 +00:00
Peter NelsonandGitHub 810e442203 Codechange: Split GoodsEntry cargo and flows data to unique_ptr. (#13058)
This allows cargo packets and cargo flow data to be empty if not in use, which is the case for the majority of station goods entries, and data is allocated when needed.

This reduces the initial size of a Station from 9192 bytes to 2024 bytes (on 64 bit platforms), although an allocation of 120 bytes is made for each active cargo type at a station.

Based on similar changes in JGRPP.
2025-01-02 20:48:23 +00:00
Rubidiumandrubidium42 c0df898ac5 Codechange: do not implicitly convert during assignment to StrongType 2025-01-01 21:32:51 +01:00
Rubidiumandrubidium42 3956ed086a Codechange: use Date/Year constructor explicitly 2025-01-01 16:25:32 +01:00
Rubidiumandrubidium42 f55ba40b13 Codechange: use TileIndex constructor explicitly 2025-01-01 16:25:23 +01:00
Peter NelsonandGitHub dd87bf9333 Fix: Rail station tile flags were not set early enough. (#13203)
Rail station tile flags now use bits that were (long ago) used to store railtype.

During Afterload, there are some calls that need the state of station tile flags to be correct which were executed before the station tile flags were set.
2024-12-27 14:27:55 +00:00
Peter NelsonandGitHub c72542431a Change: Increase house type limit from 512 to 4096. (#12288)
This moves HouseType from m4+m3[6] to m8 making it 'easier' to access.
2024-12-22 18:14:06 +00:00
SamuXarickandrubidium42 10e2d1ca36 Codechange: Use Map::Iterate() to iterate tiles 2024-12-06 10:33:11 +10:00
Peter NelsonandPeter Nelson 6a07f28103 Codechange: Store animated tile state in map to improve performance.
This allows animated tiles to be added and removed without searching in the animated tile list, providing a performance improvement when there are lots of animated tiles.

Save game version is bumped so that animated tile state can be converted.
2024-12-01 21:19:28 +00:00
Peter NelsonandPeter Nelson be505ec459 Add: Accessor to test if a tile may be animated. 2024-12-01 21:19:28 +00:00
Peter NelsonandPeter Nelson 8f9836793f Change: Store water tile flooding state in the map.
This allows water tiles which cannot flood any further to not even try to flood.

On a large map with lots of water tiles this can noticeably reduce game loop processing time.

Mostly ported from JGRPP.
2024-11-06 19:44:14 +00:00
Peter NelsonandPeter Nelson 3b6d3080f2 Add: Apply rail/road type conversion when NewGRFs are updated mid-game.
This will update the rail/road type of tiles on the map, taking account of tram state, if types are moved around.
2024-11-06 19:04:44 +00:00
Peter NelsonandPeter Nelson db1a1c5dd9 Change: Invalidate build toolbars when NewGRFs are changed.
If NewGRFs are changed while a rail or road toolbar is open, the toolbar could refer to an invalid rail/road type. If so, close it.
2024-10-31 09:10:01 +00:00
Peter NelsonandGitHub 4f9c10d35f Codechange: Simplify storage of WaterTileType in map. (#13030) 2024-10-26 10:17:44 +01:00
Jonathan G Rennisonandrubidium42 8ed983b3cd Codechange: Re-order load update for SLV_139
It is no longer required to be performed before the first phase
of vehicle updates
2024-10-25 17:05:59 +02:00
Jonathan G Rennisonandrubidium42 f19829d029 Fix #12831: Delay vehicle cache init to after map upgrades in load
Split AfterLoadVehicles into two functions.
Vehicle cache init and other functionality requiring an upgraded and
valid map is now performed later in the load process.
2024-10-25 17:05:59 +02:00
Jonathan G RennisonandGitHub e477706bf5 Codechange: Add AssignBit function to assign the value of a single bit (#12934)
* Codechange: Add AssignBit function to assign the value of a single bit

* Codechange: Replace various uses of SB with AssignBit

* Codechange: Replace various uses of SB with a constant with SetBit
2024-09-10 08:36:58 -04:00
Kaiden Joyandrubidium42 7a698c7f1c Fix #12365: Company Window now displays proper inauguration year and period while in wallclock mode. 2024-08-13 20:13:51 +02:00
Jonathan G Rennisonandrubidium42 9c84e5df3f Add: Road waypoint functionality 2024-06-24 22:12:08 +02:00
Jonathan G Rennisonandrubidium42 05b65703d3 Codechange: Increase size of StationType field in map array
Move can station have wires bit to make room
2024-06-24 22:12:08 +02:00
merni-nsandKuhnovic 55a7c59d13 Remove: NPF and pathfinder change settings 2024-05-10 10:38:44 +02:00
Peter NelsonandGitHub 9008d793ab Change: Use per-company group numbers. (#12297)
This is used by the default group name, replacing the use of group index.
2024-05-07 19:01:28 +00:00
Jonathan G Rennisonandrubidium42 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
Peter NelsonandGitHub 699c7e4c9d Fix 3de8853e29: Industries accept/produce no cargo for pre-SLV_78 saves. (#12508)
Industry accepted/produced was trimmed too early for original and pre-SLV_78 saves, as cargo type was not stored per slot so all slots look invalid to the trim function.
2024-04-20 10:24:35 +01:00
Peter NelsonandGitHub 45886e50b2 Codechange: Unify where rail station tile flags are set. (#12531)
This avoids repeating the logic in three places.
2024-04-18 18:54:10 +01:00
Rubidiumandrubidium42 4f2412a272 Codechange: range based for loops instead of C-style for loops 2024-04-11 07:05:04 +02:00
Peter NelsonandPeter Nelson 9854553e10 Codechange: ZOOM_LVL_SHIFT/BASE are not actually ZOOM_LVLs.
Rename to ZOOM_BASE_SHIFT and ZOOM_BASE respectively, and derive from ZOOM_LVL instead of numeric value.
2024-04-04 22:27:03 +01:00
Peter NelsonandPeter Nelson 3de8853e29 Codechange: Store accepted and produced cargo in vector instead of array.
Most industries do not use the full 16 slots, so this can save a little memory and iteration time.
2024-04-01 21:35:20 +01:00
Peter NelsonandPeter Nelson 00e0021e3a Codechange: Don't assume accepted/produced slot exists. 2024-04-01 21:35:20 +01:00
Peter NelsonandPeter Nelson 295508fc53 Codechange: Avoid lengthof() on std::array. 2024-04-01 21:35:20 +01:00
Patric StoutandGitHub a3cfd23cf9 Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
Rubidiumandrubidium42 27eadc13ec Codechange: rename TILE_ADD(XY) to TileAdd(XY) 2024-03-10 15:50:24 +01:00
Rubidiumandrubidium42 bab5a8a787 Codechange: use std::source_location over __FILE__ and __LINE__ for Backup 2024-03-10 10:14:20 +01:00
Loïc GuillouxandGitHub 845b894fd8 Remove: [Script] random_deviation from setting description table (#12221) 2024-03-05 12:41:04 +01:00
Loïc GuillouxandGitHub fad77261ea Fix f6dd505: Missing savegame conversion for current_order (#12188) 2024-02-27 21:25:49 +01:00