This wouldn't solve the problem, since it doesn't touch wegbauer.cc (I think).
This patch will solve the problems described in this thread:
Index: bauer/wegbauer.cc
===================================================================
--- bauer/wegbauer.cc (revision 2614)
+++ bauer/wegbauer.cc (working copy)
@@ -1338,21 +1338,13 @@
grund_t *bd_von = welt->lookup(pos);
if( bd_von ) {
// if we have a slope, we must adjust height correspondingly
- if( bd_von->get_weg_hang()!=hang_t::flach ) {
- if( ribi_typ(bd_von->get_weg_hang())==ribi_typ(diff) ) {
+ if( bd_von->get_weg_hang() != hang_t::flach ) {
+ if( ribi_typ(bd_von->get_weg_hang()) == ribi_typ(diff) ) {
// upwards
pos.z += Z_TILE_STEP;
}
}
}
- else {
- // check for slope down ...
- bd_von = welt->lookup(pos+koord3d(0,0,-Z_TILE_STEP));
- if( bd_von && bd_von->get_weg_hang()!=hang_t::flach) {
- route[route.get_count()-1].z -= 1;
- pos.z -= Z_TILE_STEP;
- }
- }
if( bd_von == NULL ) {
bd_von = new tunnelboden_t(welt, pos, hang_t::flach);
bd_von_new = true;
@@ -1363,6 +1355,18 @@
if( !bd_nach ) {
// check for slope down ...
bd_nach = welt->lookup(pos + diff + koord3d(0,0,-Z_TILE_STEP));
+ if( bd_nach && bd_nach->get_weg_hang() == hang_t::flach ) {
+ // Don't care about _flat_ tunnels below.
+ bd_nach = NULL;
+ }
+ if( bd_nach ) {
+ // Correct slope on ground below?
+ if( ribi_typ(bd_nach->get_weg_hang()) != ribi_typ(-diff) ) {
+ ok = false;
+ }
+ }
}
if( bd_nach == NULL ){
bd_nach = new tunnelboden_t(welt, pos + diff, hang_t::flach);
@@ -1410,7 +1414,7 @@
route.append(pos);
DBG_MESSAGE("wegbauer_t::calc_straight_route()","step %i,%i = %i",diff.x,diff.y,ok);
}
- ok = ok && (bautyp&tunnel_flag && grund_t::underground_mode!=grund_t::ugm_level ? pos.get_2d()==ziel.get_2d() : pos==ziel);
+ ok = ok && ( ((bautyp&tunnel_flag) && grund_t::underground_mode!=grund_t::ugm_level) ? pos.get_2d()==ziel.get_2d() : pos==ziel );
// we can built a straight route?
if(ok) {
We can delete these 8 lines, since the position with an slope below is already changed in line 1387: 'pos = bd_nach->get_pos();'.