That is not a problem.
However, let us first be clear on the goal here: I suggested to add a fast (=constant-time) check to determine whether the existing pathfinding algorithm can find a solution at all. I did not suggest any improvement to the actual pathfinding algorithm, only a shortcut if there is no path at all, which is expensive to determine through the actual pathfinding algorithm itself.
Result: If there is a path, then the overall computation will be a tiny fraction of a second slower, if there is no path, then it will be a lot faster.
The general solution for the Swamp/Water problem that you mentioned would be to enumerate each kind of movement area separately: So each map tile would then be associated with one number per movement area kind, e.g. one number for boats, one number for aquatics, one for ashwalkers, one for landlubbers, etc.
The proper pathfinding algorithm is only started, if the area codes of the starting and target tile are identical for each movement area kind that the stack contains (i.e. 2 integer comparisons, if the stack contains both boats and aquatics).
This general solution should cover all problems of that kind. The check whether or not to start pathfinding is still fast (constant time), but it requires you to associate each map tile with a vector of numbers, the vector having a size equal to the number of different movement kinds available in the game.
However, if memory is a concern, you can do better here:
First of all, boat movement areas are always a subdivision (partition) of aquatic movement areas: an aquatic creature can always go where a boat can go. Whether two boat areas are within the same aquatic area is thus an equivalence relation. Therefore, you only need to store the representatives for each boat area code.
Put simply: you only need to enumerate the boat movement areas, and all contiguous aquatic areas that cannot be used by boats. Then, you create a finite mapping from boat area codes to aquatic area codes (i.e. in Javascript probably just an int-array, having the size equal to the number of different boat area codes).
If the stack contains a boat and aquatic unit, then you just compare the boat area code and abort if they are different. Otherwise, if the stack contains just an aquatic creature, then you map the boat area codes to aquatic area codes and compare them, again aborting if they are different.
Example: Say we have an ocean, next to a swamp, next to a city, next to a swamp, next to an ocean; a separate ocean; and a separate swamp. The first ocean gets its own number, say 0; both swamps and the city are connected to each other, so they all get area code 1, the second ocean receives number 2, the third ocean number 3 and the final swamp number 4. There are 5 boat areas, so our array has 5 entries. Since the first three are connected to each other, we also compute the array [1,1,1,3,4] (instead of 1, we could have picked 0 or 2, yielding [0,0,0,3,4] pr [2,2,2,3,4]).
Now if we have a stack consisting of both boats and aquatics in the first ocean, targeting the second ocean, we simply compare the numbers: 0 is different from 2, so no path possible, abort.
If the stack only contains aquatics, we look up the numbers in the array: 1 is equal to 1, so we know that a path is possible.
The same mechanism can also be used for land based movement, in case of land masses that are entirely separated by lava/mountains or absence of ports on islands. Like water/aquatic, one enumerates all contiguous land areas, and computes an array of representatives, mapping land area codes to a common representative area code if they are connected through ports. This may be then used for stacks that contain just boats, but no aquatics.
However, I don't think this is a must have: since the original pathfinding remains unchanged, each movement area kind is a nice-to-have, but not a must-have: if it is there, it might shortcut impossible path finding; if it is not there, then one needs to wait a little longer in that special situation that is not cover, but there is no error!
For example, one could have area codes for flyers, but I don't think this pays off, since maps rarely have an airspace divided by lava, that players would actually want to move into.
Second, mutual exclusive movement types might use the same vector index, e.g. lava and water areas are mutually exclusive, so their codes could use the same index in the area code vector per tile. However, such special cases always bring the danger of errors with them, and I don't think that is worth it, just to reduce the vector size by one - it's not that much memory. (Maybe land and water could use the same area index, with just two different arrays for the representative arrays for aquatic and land/boat areas, but cities might take some extra thinking...not worth the trouble unless you are really worried by memory usage for maps.)
Possible Problems remaining:- One-way movement:
The above method cannot deal with one-way movement. So you have a problem if you want to allow aquatic creatures to move across waterfalls only downriver, but not up. From what I read thus far, it seems very unlikely that Warbarons will offer such one-way movement in the future. - Stranded Heroes: Consider a water-walking hero, which was dropped off by a magic dragon in some mountains by the sea. Treating him like an aquatic creature only would wrongly abort pathfinding, since the mountain and the sea will always have different area codes. So lone water-walking heroes should always use proper pathfinding, without shortcuts by comparing area codes.
I hate these special cases, but it seems the easiest fix if you also intend to use area codes for land-based movement. There are other fixes for this situation, since the hero can move at most one square before the usual situation is reestablished, but they are probably not worth considering.
Disclaimer: These are just my naive ramblings on the topic, and I welcome any further insights and discussion. I am not at all an expert on pathfinding algorithms!