second try:
Index: bauer/brueckenbauer.cc
===================================================================
--- bauer/brueckenbauer.cc (revision 2449)
+++ bauer/brueckenbauer.cc (working copy)
@@ -169,7 +169,9 @@
-
+// tries to find a suitable end tile for bridge
+// .. starting at pos in direction zv
+// .. if ai_bridge is true then the shortest possible bridge is returned
koord3d brueckenbauer_t::finde_ende(karte_t *welt, koord3d pos, koord zv, const bruecke_besch_t *besch, const char *&error_msg, bool ai_bridge )
{
const grund_t *gr1; // on the level of the bridge
@@ -182,7 +184,13 @@
length ++;
pos = pos + zv;
- // test may length
+ // test max length configured in simuconf.tab
+ if(length > welt->get_einstellungen()->way_max_bridge_len) {
+ error_msg = "Bridge is too long for this type!\n";
+ return koord3d::invalid;
+ }
+
+ // test max length
if(besch->get_max_length()>0 && length > besch->get_max_length()) {
error_msg = "Bridge is too long for this type!\n";
return koord3d::invalid;
@@ -254,7 +262,7 @@
}
}
if(gr2->get_grund_hang()==hang_t::flach) {
- if( ai_bridge && !gr2->hat_wege() && !gr2->get_leitung() ) {
+ if( (ai_bridge || length == welt->get_einstellungen()->way_max_bridge_len) && !gr2->hat_wege() && !gr2->get_leitung() ) {
return pos;
}
if(gr2->get_typ()==grund_t::boden && !gr2->get_halt().is_bound()) {
So I implemented two options:
1) All bridges are limited by way_max_length
2) The longest bridge built by ai has length=way_max_length
Both things can be enforced separately. What would you prefer?