@@ -3594,7 +3594,7 @@ void stadt_t::generate_private_cars(koord pos, koord target)
35943594
35953595
35963596/* *
3597- * built/extends a road and maybe changes the neighbouring tile to continue it as further as possible
3597+ * built/extends a road and maybe changes the neighbouring tile to continue it as far as possible
35983598 * @param k Bauposition
35993599 */
36003600bool stadt_t::build_road (const koord k, player_t * player_, bool forced)
@@ -3627,7 +3627,7 @@ bool stadt_t::build_road(const koord k, player_t* player_, bool forced)
36273627 return false ;
36283628 }
36293629
3630- // try articicial slope. For this, we need to know the height of the tile with the connecting road
3630+ // try artificial slope. For this, we need to know the height of the tile with the connecting road
36313631 for (sint8 r = 0 ; r < 4 ; r++) {
36323632 if (grund_t * gr = welt->lookup_kartenboden (k + koord::nesw[r])) {
36333633 if (gr->hat_weg (road_wt)) {
@@ -3652,6 +3652,17 @@ bool stadt_t::build_road(const koord k, player_t* player_, bool forced)
36523652 continue ;
36533653 }
36543654
3655+ if (terraform_allowed && !bd->get_weg_hang () && gr->get_hoehe () != bd->get_hoehe ()) {
3656+ sint8 dir = bd->get_hoehe () < gr->get_hoehe () ? +1 : -1 ;
3657+ // check height clearance (no bridges or tunnels would be blocked by this when becoming a slope)
3658+ // (This is only possible near articial sloes, but the check is not expensive)
3659+ if (welt->lookup (koord3d (k + koord::nesw[r], bd->get_hoehe () + dir))) {
3660+ continue ;
3661+ }
3662+ if (welt->get_settings ().get_way_height_clearance () == 2 && welt->lookup (koord3d (k + koord::nesw[r], bd->get_hoehe () + 2 *dir))) {
3663+ continue ;
3664+ }
3665+ }
36553666
36563667 // try to connect: check if other tile on slope
36573668 if (gr->get_weg_hang () && ribi_t::doubles (ribi_type (gr->get_weg_hang ())) != ribi_t::doubles (ribi_t ::nesw[r])) {
0 commit comments