Commit Graph

323 Commits

Author SHA1 Message Date
SamuXarick ee860a5c8e Doc: Update some yapf inline comments 2024-12-24 20:43:46 +01:00
SamuXarick de908e08b2 Codefix: Remove duplicated include 2024-12-22 14:01:40 +01:00
Koen Bussemaker 701cb2e9d7 Codechange: Move two way signal EOL to a more logical place 2024-12-06 09:27:32 +01:00
Peter Nelson 61cbdef92d Codechange: Make AyStarStatus an enum class. (#13129)
This enforces type-safety.
2024-11-30 14:23:32 +00:00
SamuXarick cf7710fb61 Codechange 8e9603b: Replace int32_t with AyStarStatus (#13127) 2024-11-27 23:26:07 +00:00
SamuXarick 8e9603bd33 Codechange: Rename and return AyStarStatus instead of int (#13125)
- Rename enum AystarStatus to AyStarStatus.
- Return AyStarStatus instead of int for AyStar::Main and AyStar::Loop functions.
2024-11-27 00:10:06 +01:00
Peter Nelson 3be0166801 Codechange: Use std::ranges::find where possible.
Replace `std::find(range.begin(), range.end(), ...)` with `std::ranges::find(range, ...)`.
2024-11-24 10:36:03 +00:00
Peter Nelson c39810ff6a Codechange: Replace path cache queues with vectors.
Ship and RoadVehicle path caches use a std::deque, which is quite memory hungry, especially for RoadVehicle which has two.
std::deque was used to be able to push/pop from either end.

Change to use a single std::vector each, which is now push/popped from the back.
2024-11-18 08:59:41 +00:00
Peter Nelson 04b6dfae48 Cleanup: Remove now-unneeded includes from yapf. (#13088) 2024-11-16 23:23:06 +00:00
Jonathan G Rennison 71ea58c6de Codechange: Remove unused CYapfDestinationTileT (#13086) 2024-11-16 16:12:18 +00:00
Koen Bussemaker 6faf4fa70a Codechange: Simplified YAPF ship region node 2024-11-12 23:17:56 +01:00
Koen Bussemaker 3e195df3c7 Codechange: Cleaned up and renamed NodeList 2024-11-12 21:06:17 +01:00
Jonathan G Rennison 883be19865 Codefix a6f412c6: Missing this-> in YAPF 2024-10-29 19:07:14 +01:00
Koen Bussemaker 0200bc3720 Codechange: Renamed CHashTableT to HashTable and corrected code style 2024-10-29 08:35:47 +01:00
SamuXarick a96a83e330 Codechange: Code style issues in water regions (#13019) 2024-10-28 10:29:26 -04:00
Peter Nelson e50c1774fc Codechange: Remove some unnecessary local variables. 2024-10-25 19:01:39 +01:00
Peter Nelson c39554a210 Codechange: Simplify selection between pathfinder functions. 2024-10-25 19:01:39 +01:00
Peter Nelson 1403a55e5d Codechange: Use uppercase naming for YAPF cost constant. 2024-10-25 19:01:39 +01:00
Peter Nelson a171939ec3 Codechange: Remove m_ prefix from pathfinders. 2024-10-25 19:01:39 +01:00
Peter Nelson a496e9397c Codechange: Prefer member-initialization. 2024-10-25 19:01:39 +01:00
Peter Nelson a6f412c615 Codechange: Add this-> to YAPF. 2024-10-25 19:01:39 +01:00
Peter Nelson 5b73654f94 Codechange: Add includes to YAPF .hpp files. 2024-10-25 19:01:39 +01:00
Peter Nelson 009e57ee03 Codechange: Use member initializer list. 2024-10-25 19:01:39 +01:00
Rubidium c9819f8957 Codechange: split GetRoadDir as bays have DiagDir and drive throughs have Axis 2024-10-24 20:40:32 +02:00
Peter Nelson 7a71df2952 Codechange: Use fmt::format to convert value to binary string representation. (#13016)
Avoids manually iterating bits into an array.
2024-10-22 13:59:08 +01:00
Peter Nelson e3bfe2b668 Fix: Don't invalidate water regions on the other side of the map. (#13012)
When invalidating water regions with a tile at the very edge of the map, the region on the opposite side of the map would also be invalidated.
2024-10-22 00:33:29 +01:00
Peter Nelson ccced859f5 Codechange: Mark some water region functions static. (#12964)
These functions are not used elsewhere. This may affect how compilers generate code.
2024-10-01 14:28:16 +01:00
Peter Nelson 908ee7292b Codechange: Replace all FILE * with FileHandle RAII class. (#12718)
This removes the need to manually ensure all files are closed.
2024-09-16 08:45:26 +01:00
Michael Lutz ddf6f33a8a Change: Path signals now show green on junction-less tracks by default (#12857) 2024-07-26 23:51:49 +02:00
David Seifert db36e61807 Codefix: Compilation with GCC 15 due to missing CRTP usage (#12876) 2024-07-22 20:42:23 +02:00
Koen Bussemaker a0845bba2c Codechange: Reduced size of water region by not storing tile area 2024-07-01 11:10:20 +02:00
Jonathan G Rennison 9c84e5df3f Add: Road waypoint functionality 2024-06-24 22:12:08 +02:00
Rubidium 31085230a6 Codechange: use std::vector for the available neighbours 2024-05-30 23:15:38 +02:00
Rubidium 2864f3b3eb Cleanup: remove C-style hash, binary heap and priority queue 2024-05-30 23:15:38 +02:00
Rubidium 0e75dfd49f Codechange: migrate aystar to use YAPF's nodelist infrastructure 2024-05-30 23:15:38 +02:00
Koen Bussemaker 6efc1fa250 Codechange: Removed unused yapf PfNodeCachFlush function 2024-05-25 21:49:12 +02:00
Rubidium 6cea49c117 Codechange: replace uint with size_t in binary heap 2024-05-12 12:55:52 +02:00
Rubidium 8349203038 Cleanup: remove unused Aystar variables 2024-05-12 10:46:03 +02:00
merni-ns c3ee5e58a3 Cleanup: Move remaining NPF files into pathfinder directory 2024-05-10 10:38:44 +02:00
merni-ns 55a7c59d13 Remove: NPF and pathfinder change settings 2024-05-10 10:38:44 +02:00
Koen Bussemaker 59ac27f385 Fix #12643: _is_water_region_valid is not cleared/reset in AllocateWaterRegions 2024-05-09 20:18:04 +02:00
Koen Bussemaker d2f98440bb Codechange: Make assert in follow_track easier to understand and debug 2024-05-05 16:30:44 +02:00
Peter Nelson d074ab909c Codechange: Replace Array/FixedSizeArray with std::deque. (#12409)
Array/FixedSizeArray is actually a resizeable container that allocates space in chunks and allows resizing without invalidating pointers.

This is also a behaviour of std::deque, so use that instead.
2024-05-04 10:55:16 +01:00
Koen Bussemaker ef99aa81a3 Codechange: Store validity of water regions in separate vector 2024-05-02 15:03:48 +02:00
Patric Stout 1005c86c62 Codechange: record cache warnings with a "warning" prefix (#12518) 2024-04-17 19:49:55 +00:00
Koen Bussemaker 257d312a58 Fix #12228, Fix #12231: CheckShipReverse only restricts path when it has to 2024-04-16 20:21:18 +02:00
Rubidium 2587a21400 Codechange: use zero-initialization instead of C-style loop 2024-04-11 07:05:04 +02:00
SamuXarick f845b4bbc3 Fix: Changing NPF max search nodes while in-game had no effect (#12194) 2024-03-25 17:28:16 +01:00
Jonathan G Rennison 2189607c34 Codechange: Reduce size of class WaterRegion
The tile patch array is 256 bytes and is not needed for the majority
of water regions, change it to be optional via std::unique_ptr
2024-03-21 21:14:30 +01:00
Patric Stout a3cfd23cf9 Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00