Note that the pathfinding code just computes a path - it doesn't control how the entity follows this path.
The pathfinding function should return a path that is actually walkable for the pathfinding entity. If the entity can't swim for example, all edges leading through water should be ruled out in the pathfinding process by the cost function.
This could be done by setting the edge's skill to a specific value indicating that the edge can only be traversed by swimming. This skill value can then be evaluated within the cost function:
// remark: edge_skill is set by path_getedge()
if ((edge_skill[2] == THROUGH_WATER) && (entity_can_swim == FALSE))
{
return -1; // edge cannot be traversed by this entity
}
But as said as before the movement code has to take care of how the entity ultimately follows the path. If the entity can't fly, the movement code should steer the entity in a way that it can arrive the nodes with gravity in effect.