Commit Graph

71 Commits

Author SHA1 Message Date
Peter Nelson 0aaeb6f7e7 Codechange: Rename TrackFollowers to follower. (#14664)
Replaces use of codestyle breaking `F` in places.
2025-09-27 18:10:22 +01:00
Kuhnovic 1ac5baab31 Change: Add lock penalty to ship pathfinder. (#14603) 2025-09-20 22:52:59 +02:00
Kuhnovic faacae2c3f Change: Removed disable_node_optimization YAPF setting (#14578) 2025-09-15 21:59:12 +02:00
Kuhnovic 80f672d5b4 Codechange: Remove redundant data members from YAPF ship node. (#14577) 2025-09-03 12:52:15 +02:00
Kuhnovic 10e81af663 Codechange: Deduplicate YAPF estimate calculation. (#14527) 2025-08-28 21:09:00 +02:00
Peter Nelson f898acae3e Codechange: Remove line break before opening brace of Yapf classes. (#14513) 2025-08-12 21:08:41 +01:00
Kuhnovic 40457fc0dd Change: Separate ships travelling in opposite direction (#14493) 2025-08-08 09:52:01 +02:00
frosch 2bee313642 Codechange: Replace FindVehicleOnPos with 'for' loop. 2025-04-22 22:12:59 +02:00
frosch dacd77b2bd Codechange: Use FindVehicleOnPos instead of HasVehicleOnPos, if there is no stop condition. 2025-04-22 22:12:59 +02:00
Rubidium 02f1bc0880 Codefix: remove some logically dead code 2025-03-12 22:00:33 +01: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
Rubidium fd4adc55e3 Codechange: replace INVALID_X with XID::Invalid() for PoolIDs 2025-02-16 20:23:00 +01:00
Rubidium e937c4dcfd Codechange: change DestinationID into class with conversion helpers
A DestinationID is either a DepotID or StationID, where the aircraft hangar
being conceptually a depot is actually a StationID. When making those types
stronger, a lot of casts would need to be added, but this shows the intent
much better.
2025-02-06 21:03:24 +01:00
Peter Nelson 4397aa3909 Codechange: Make StationType an enum class. (#13339) 2025-01-19 20:53:08 +00:00
SamuXarick ee860a5c8e Doc: Update some yapf inline comments 2024-12-24 20:43:46 +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
Koen Bussemaker 3e195df3c7 Codechange: Cleaned up and renamed NodeList 2024-11-12 21:06:17 +01:00
Peter Nelson a171939ec3 Codechange: Remove m_ prefix from pathfinders. 2024-10-25 19:01:39 +01:00
Peter Nelson a6f412c615 Codechange: Add this-> to YAPF. 2024-10-25 19:01:39 +01:00
Koen Bussemaker 257d312a58 Fix #12228, Fix #12231: CheckShipReverse only restricts path when it has to 2024-04-16 20:21:18 +02:00
Patric Stout a3cfd23cf9 Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
SamuXarick d7c5e9e8ab Codechange: Where the ship comes from is already known
This simplifies the handling of variables.

`ChooseShipTrack` is called upon entering `tile`, and looking further back to the caller, it can be deduced that `v->tile` matches `src_tile`. With that said, `enterdir` can also be removed, as it's not used anywhere else.

`CreateRandomPath` and `GetRandomFollowUpTrackdir` is being fed `src_tile` as it's 2nd parameter. This could be eliminated, as `v` is also being passed to it. Just use `v->tile` in those functions.
2024-03-16 17:02:19 +01:00
Patric Stout 5f4f9334ce Codefix f1e999ec: use RandomRange(l) instead of _random.Next(l) (#12274) 2024-03-16 14:39:57 +00:00
SamuXarick a7625b8ae0 Fix #12280: Allow ships 90 degree turns if only choice
If there is no path found, a random path is created which forbids 90 degrees.
Allow 90 degrees if they're the only choice.
2024-03-15 08:04:08 +01:00
SamuXarick 14d95ef1c9 Fix #12279: Update random path each step (#12286) 2024-03-13 11:22:52 -04:00
Kuhnovic 08ff1ab93e Fix #12236: Ship pathfinder causes crash when ship is already at destination (#12238) 2024-03-08 23:46:13 +01:00
Peter Nelson b2ca6e1ac8 Codefix: Remove no-longer used ship special-case. (#12192)
This special-case has not been triggered since multi-tile docks were introduced.
2024-03-03 09:31:04 +00:00
Kuhnovic c5afc9173c Fix #12176: Ships are circling in one place (#12181) 2024-03-02 21:45:54 +01:00
Kuhnovic 2fb1593550 Fix e38c3c5: Added missing return statement (#12185) 2024-02-27 12:55:42 +01:00
Kuhnovic e38c3c59f3 Fix #11840: Ship pathfinder always returns a valid trackdir if one is available (#12031) 2024-02-09 12:31:38 -05:00
Rubidium 6b21368bc2 Codechange: replace FIND_FIRST_BIT/FindFirstBit2x64 with FindFirstBit 2024-01-19 21:10:39 +01:00
Kuhnovic f1e999ec59 Feature: Region-based pathfinder for ships (#10543) 2024-01-08 20:29:05 +01:00
Rubidium e3f49ee7a0 Codechange: coding style fixes 2024-01-04 16:23:54 +01:00
Loïc Guilloux 6ff0858b38 Fix #9669, cbe00ec: Only try valid reverse directions (#9672) 2021-11-06 17:32:37 +01:00
glx22 cbe00ec651 Fix: Try all possible reverse directions when a ship reaches a dead end 2021-10-11 21:11:13 +02:00
Loïc Guilloux 11dece205c Revert 7ca1793: Using Trackdir keyed node is not required, Exitdir keyed node still have the correct trackdir (#9576) 2021-09-26 18:41:41 +02:00
Patric Stout f87fe395a7 Fix: pathfinders always tried to avoid docking tiles (even if nothing was on them) (#9522)
When coming across any docking tile (for example, all tiles around
an oilrig are docking tiles), it always at least added a penalty
of 3 times a normal tile, even when there are no ships on them.

In result, the pathfinder got suggested to always go around docking
tiles. This was most likely not the intention of the change made in
31db4f8d5e.
2021-08-31 09:57: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
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
peter1138 0db31ae27f Change: Avoid caching end of ship path, to allow penalties to apply. 2019-06-30 16:46:32 +02:00
peter1138 31db4f8d5e Add: Penalty for occupied docking points. 2019-06-30 16:46:32 +02:00
peter1138 f538179878 Feature: Multi-tile docks and docking points. 2019-06-30 16:46:32 +02:00
Charles Pigott 9f3928658b Codechange: Remove Track{dir,}{Bits,}Byte types 2019-04-29 17:40:22 +01:00
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
PeterN 6c6971fb43 Add: Road vehicle path cache. (#7261) 2019-03-08 23:52:45 +00:00
Peter Nelson 7ca1793ec4 Change: Automatically use Trackdir node key as needed if ship curve penalties differ. 2019-03-08 16:52:08 +01:00
Peter Nelson b8a0107ad1 Change: Add configurable curve penalty for ships. 2019-03-08 16:52:08 +01:00
Peter Nelson 3f327116db Change: Don't apply forbid 90 deg turn settings to ships. 2019-03-03 20:59:44 +01:00