http://i.imgur.com/wcs5gdT.png
The infantry is at level 1. It should only take 1 MP to descend the building to ground level then 1 more MP to exit it. However MM is charging 3 MPs for it if you just click the adjacent hex directly. If you do it manually using the go down button, MM will correctly charge 2 MPs for the movement.
This is a problem with the path planner. It doesn't know about the "go up" and "go down" steps to make elevation changes.
Given that, the path is actually correct (although there does exist a better path that the path planner doesn't know about).
That means that the bug is really that the path planner needs to know about elevation changes. I've adjusted the title accordingly.
Fixed in [r11691].
I updated the AStarComparator to consider elevation change as well. There's now a getElevationDiff methods that tries to estimate the elevation difference for the heuristic.
I used Entity.elevationOccupied to determine the elevation in the destination hex. If a unit is using VTOL movement or WiGE movement, it's occupied elevation will be the Hex.surface + current elevation. Otherwise it's generally the hex surface, but sometimes the hex floor in cases of water.
I also added some logic to deal with bridges and buildings. It assumes that, if there's a building in the destination that has a level at the current elevation, then no elevation change is made.
Related
Commit: [r11691]