Commit Graph

354 Commits

Author SHA1 Message Date
Rito12 70bf84175f Add: Show height difference in bridge is too low error message. (#14614) 2025-10-24 16:27:11 -04:00
Tyler Trahan 0b99a0b66a Feature: Draw infinite water when all borders are water (#13289) 2025-09-26 14:37:27 +00:00
Peter Nelson e10200efa4 Change: Allow bridges over locks. (#14595)
The bridge must be at least 2 levels higher than the lock.
2025-09-10 18:41:56 +01:00
Peter Nelson f30f808b50 Codechange: Implement tile proc handler to test for building bridge over tile. 2025-08-20 21:40:41 +01:00
Peter Nelson 0a1c0b8b48 Change: Hide bridge pillars if obstructed by tile below.
Tiles can now control if pillars are drawn on a bridge above it. There is no visible change with default bridges.
2025-08-15 23:20:18 +01:00
Peter Nelson 921d83c324 Codechange: Unify structures with sprite sub-tile bounds and simplify bounding boxes. (#14424)
Lots of different structs contain variations on sub-tile bounds with different naming. Unify into a single struct that can be inherited and passed directly to AddSortableSpriteToDraw.

At the same time, offsets now work more logically: sub-tile bounds now specify the bounding box, and an offset can be applied to the sprite.
2025-07-22 00:02:00 +01:00
Peter Nelson 1cbc4da054 Codechange: Use Directions for water flooding data. 2025-05-07 17:31:29 +01:00
frosch 2bee313642 Codechange: Replace FindVehicleOnPos with 'for' loop. 2025-04-22 22:12:59 +02:00
Peter Nelson fc45bb5a2b Codechange: Replace bitstuffed VehicleEnterTileStatus. (#14027)
VehicleEnterTileStatus was an bitset-style enum, but bitstuffed with a StationID. However the StationID part was only used by trains, and only in two locations.

Instead, return just the enum bitset. The two places which require the StationID just call GetStationIndex() directly.
2025-04-20 21:10:02 +01:00
frosch b956af631e Codechange: Replace CircularTileSearch with SpiralTileSequence. 2025-04-20 12:50:45 +02:00
frosch cde350dc01 Codechange: Replace macros GENERAL_SPRITE_COLOUR and COMPANY_SPRITE_COLOUR with functions GetColourPalette and GetCompanyPalette. 2025-04-18 23:41:37 +02:00
Björn Wärmedal d009bfc47b Codechange: Add vehicle owner to crash event (#13878)
Co-authored-by: Björn Wärmedal <bjorn.warmedal@lumera.com>
2025-03-25 22:53:44 +01:00
Peter Nelson 17f7d0950e Fix #13838: Formatted error message of sub-errors may be lost. (#13840) 2025-03-18 08:39:40 +00:00
Peter Nelson 91d22f7617 Codechange: Use EnumBitSet for VehStates. (#13755)
Renamed from VehStatus because pluralising that is weird.
2025-03-08 18:24:21 +00:00
Peter Nelson 96f260e718 Codechange: Pass TileDesc by reference. 2025-02-23 23:00:51 +00:00
Peter Nelson 6e10584b91 Codechange: Use EncodedStrings for News messages. (#13654) 2025-02-23 20:24:02 +00:00
Rubidium 0449dc48c8 Codechange: explicitly initialise Depot member variables 2025-02-18 07:21:04 +01:00
Rubidium 44506ebc86 Codechange: use span size over terminator object 2025-02-16 11:19:12 +01:00
Rubidium 069ff846e4 Codechange: use std::vector/std::span for DrawTileSprites over malloc-ed table 2025-02-14 16:01:45 +01:00
Rubidium c3d5e6d2a0 Codechange: Use EnumBitSet for DoCommandFlags 2025-02-14 00:28:57 +01:00
Peter Nelson ca75a8ce19 Codechange: Use enum class for NewsType. 2025-02-07 19:36:52 +00:00
SamuXarick 610026ef17 Fix: Missing water region invalidation after flooding a half tile with rail in the highest corner
Invalidate water region when any flood occurs.
Convert a few magic numbers to their names.
2025-01-17 18:13:51 +01:00
Peter Nelson 1e77fd0b61 Codechange: Remove unnecessary 'return_cmd_error` macro. (#13160)
This macro is a leftover from when errors used to be packed into a single int32_t.

`return CommandCost` is clearer, and doesn't need a macro.
2024-12-08 18:02:30 +00:00
SamuXarick 10e2d1ca36 Codechange: Use Map::Iterate() to iterate tiles 2024-12-06 10:33:11 +10:00
Peter Nelson 465df3bab1 Change: Don't try to flood buoys or dock tiles.
This reduces the active flooding water tiles a little more.
2024-11-06 19:44:14 +00:00
Peter 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 Nelson f0f62961e1 Codechange: Make two water functions static. (#13057) 2024-11-03 23:25:51 +00:00
SamuXarick d5a13fb9f4 Codechange: Use TileOffsByAxis(...) in more places (#13026) 2024-10-24 15:58:15 -04:00
Peter Nelson 3eb7901ad9 Codechange: Use template parameter of SetBitIterator instead of casting later. (#13015)
This removes some manual casting.
2024-10-21 17:54:54 +01:00
Rubidium 3b0fcf442f Codefix: use actual type instead of int for TileIndexDiff 2024-10-20 15:49:32 +02:00
Rubidium 4a359a4aed Fix 8ca417b: drying of (edge) tiles should consider MP_VOID tiles 2024-10-19 23:32:34 +02:00
Rubidium 8ca417baa9 Codefix: do not wrap-around the map when flooding tiles 2024-10-19 09:00:21 +02:00
Loïc Guilloux d67963e616 Add: [Script] Include number of victims in ScriptEventVehicleCrashed (#12861) 2024-07-16 21:28:29 +02:00
Patric Stout a3cfd23cf9 Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
Rubidium 27eadc13ec Codechange: rename TILE_ADD(XY) to TileAdd(XY) 2024-03-10 15:50:24 +01:00
Rubidium bab5a8a787 Codechange: use std::source_location over __FILE__ and __LINE__ for Backup 2024-03-10 10:14:20 +01:00
Michael Lutz 8dda387f82 Codechange: Use std::tuple for slope functions with two return values 2024-03-08 18:08:55 +01:00
Loïc Guilloux b68d263d5f Fix #12014: Remove water when area clearing ship depot (#12030) 2024-02-09 18:17:08 +01:00
frosch b1718478c8 Codechange: Replace old non-standard attributes with C++17/20 standard attributes. 2024-02-02 22:29:28 +01:00
Loïc Guilloux 09b66751cf Fix b38d3c2208: missing water regions invalidation when building locks (#11879) 2024-01-25 22:18:26 +00:00
Kuhnovic b38d3c2208 Change: simplified water region evaluation, removed savegame data (#11750) 2024-01-21 20:56:50 +00:00
Kuhnovic f1e999ec59 Feature: Region-based pathfinder for ships (#10543) 2024-01-08 20:29:05 +01:00
Peter Nelson d4008850e3 Codechange: Ensure function opening { is on new line. 2023-11-09 20:15:38 +00:00
frosch baf7cc858b Codechange: Rename ship docking tile related functions. 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
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 7aa2b9ab0a Codechange: move all date-related variables inside the timer (#10706) 2023-04-24 15:56:01 +00:00
Jonathan G Rennison bb988f940e Fix #10638: Incorrect water infra total when building canal over object
In the case where the object is on an unowned canal tile and
the new canal tile is owned
2023-04-13 21:34:36 +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
Rubidium 580d0a6343 Codechange: make use of Tile in for all direct map accesses 2023-02-28 07:11:48 +01:00