This little modification (one bit to makeobj, the other to main program) permits fords to be constructed only when building bridleways over non-navigable streams and brooks. Any other construction routes around, as before. (Naturally, if there is a dirt-road ford, that would work as well, based on the crossing's maxspeed; this is left to the pakset designer.)
Edit: In testing, this does not prohibit building a canal through an existing ford; the ford, however, will block the canal from being used, and the player will have to remove or replace the ford with a bridge to permit watercraft passage.
diff --git a/bauer/wegbauer.cc b/bauer/wegbauer.cc
index 51b234d10..bc9c8fcb3 100644
--- a/bauer/wegbauer.cc
+++ b/bauer/wegbauer.cc
@@ -460,7 +460,17 @@ bool way_builder_t::check_crossing(const koord zv, const grund_t *bd, waytype_t
return false;
}
// crossing available and ribis ok
- if(crossing_logic_t::get_crossing(wtyp, w->get_waytype(), 0, 0, welt->get_timeline_year_month())!=NULL) {
+ const crossing_desc_t *crd = crossing_logic_t::get_crossing(wtyp, w->get_waytype(), 0, 0, welt->get_timeline_year_month());
+ if(crd!=NULL) {
+ // special case if crd->maxspeed(1) is zero: require maxspeed of
+ // new way to not exceed crd->maxspeed(0).
+ // This permits very low-speed fords of non-navigable streams.
+ if ((crd->get_maxspeed(1)) == 0 &&
+ ( (crd->get_maxspeed(0) < desc->get_topspeed()) ||
+ (w->get_desc()->get_topspeed() > 0) )) {
+ return false;
+ }
+
ribi_t::ribi w_ribi = w->get_ribi_unmasked();
// it is our way we want to cross: can we built a crossing here?
// both ways must be straight and no ends
diff --git a/descriptor/writer/crossing_writer.cc b/descriptor/writer/crossing_writer.cc
index 03e9951d0..11be4c2fd 100644
--- a/descriptor/writer/crossing_writer.cc
+++ b/descriptor/writer/crossing_writer.cc
@@ -103,7 +103,8 @@ void crossing_writer_t::write_obj(FILE* fp, obj_node_t& parent, tabfileobj_t& ob
}
node.write_uint16(fp, uv16, 4);
uv16 = obj.get_int("speed[1]", 0);
- if(uv16==0) {
+ // Zero speed permissible for water as secondary type
+ if(uv16==0 && wegtyp2 != water_wt) {
dbg->fatal( "Crossing", "A maxspeed MUST be given for both ways!");
exit(1);
}