It's currently sometimes difficult to garrison units in a ship, particularly if the coastline has few available landing spots (e.g. Corsica v Sardinia). You manually direct the ship to the patch of beach where units must be loaded - then you click to load the units into the ship - and immediately the ship moves away from the landing spot!
This is because the ship did not know that it was already on the shore, and it would "helpfully" move closer to the units to try to pick them up. The only way the ship could detect it was on the shore was if it had just previously been given a pickup order, and was still at the same location resulting from the pickup order. Manually moving the ship would change the location, causing the ship to think it is no longer on the shore.
In this patch I add a more reliable test for when the ship is on the shore. I use the hierarchical pathfinder to check if there are any navcells nearby the ship that are reachable by the unit to be picked up.
I also increase the pickup range to 15 from 10, because sometimes it's tricky to get the ship far enough into shore if the coastline is partially obstructed. In doing this, I refactor the GarrisonHolder tag to the base mechanical ship template, to avoid pointless duplication. As a side effect, this means fireships are now also GarrisonHolders (garrison size of 1) which should have zero effect on gameplay.
In the course of testing I noticed an additional bug: Have two ships offshore. Tell the unit to garrison in one ship, but before it finishes doing so, tell the unit to garrison in the other ship instead. The second ship will refuse to pick up the unit, because in UnitAI, the pickup order only occurs when a unit enters the GARRISON state, but the unit was already in the GARRISON state so it could not enter it. I have fixed this bug as well. This bugfix was removed from D665 and split into D2174 on the theory that it would be easier to review in 2 parts.