I'm not too keen on the idea of a maximum slope per se, since somebody might want to make a unit that can climb (think Colonel Burton from C&C:Generals) or step over cliffs (like the Protoss Colossus from SC2), so I was thinking those unit would just be defined for the unwalkable field. Maybe there would be a way to define whether or not a unit was affected by maximum slope? Then I think that would work just fine.
How about have maximum slope defined on a per unit basis? We'll set some reasonable default, so if a unit's xml doesn't specify it'll get the default value, otherwise it could do something like:
<max-slope value="0.75" />Which would only let that unit type 'climb' slopes up to a gradient of three quarters.
Edit: Today, I came up with another idea. Instead of having a bunch of water fields, could we define units as being able to traverse certain heights, dependent on the water level of the map? For example, if h is the water height of the map, a unit might be able to go anywhere between h-2 and h-4 (shallow water), while another might be able to go anywhere above h-1 (I think this is the way land units behave already).
I didn't like this at first thought, as I thought it would complicate the pathfinding horribly, but then I thought, we can just store the depth of a water cell in with the metrics and use it in the same way (it currently tells us how much 'space' is around a cell, do determine quickly if a unit of a given size can occupy the cell). We'll still need a water field, but we can now get by with one.
Then there would be a variable for travel type, where a unit would be either walking, floating, or flying. Walking units would always stay on the ground (if its underwater, it would walk along the bottom like a lobster), floating units would stay at h when on the water and stay at ground level when on land, and flying units would always stay in the air. This way, water might not have to be a field at all.
The rest sounds 'kinda-sorta' like what I've done already
What was "Field" has effectively been replaced by two types,
Zone: This is the 'zone' the unit occupies, current 'attack-fields' now specify zones, and I have
two zones defined: 'surface' and 'air' (and a commented out 'sub-surface'). To restore xml compatability the code still expects <attack-fields> with embedded <field> elements, and 'land' is interpreted as 'surface', if it can currently attack land, it will now also be able to attack water units (because water and land are in the same zone, surface).
Field: This is now strictly a field of movement, atm I have 'walkable', 'air', 'any_water', 'deep_water' and 'amphibious'. A Field indirectly specifies a zone, obviously the 'air' zone/field match and all the other (current) fields 'map' to the surface zone.
Then instead of your travel type for a unit, I had a terrain (or surface) type for each cell, with values 'land', 'fordable', & 'deep_water'. The walkable field is then essentially the surface zone + land and fordable terrain types. any_water is the surface zone + fordable & deep_water types, etc.
It might seem overly complicated, but it is flexible...
Of course, given the discussion above, maybe this level of flexibility can be obtained easier...