News:

Simutrans Forum Archive
A complete record of the old Simutrans Forum.

[r7148] Broken elevated-way-bridge behaviour

Started by Spacethingy, April 20, 2014, 03:57:36 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Spacethingy

Building a bridge between sections of elevated way tries to create a tile of raised land under the start of the bridge. This creates graphical bugs and breaks route-finding. If a ground-level way exists under the start of the bridge (i.e. the raised tile can't be created), the game crashes:





Life is like a Simutrans transformer:

You only get one of them, and you can't have it on a slope.

prissi

Such a ramp is not allowed. On elevated ways, a bridge cannot go up, only straight or down.

However, bridges and evelated ways had several issues. I hope I fixed them in r7158 (since I wanted to release tonight ... )

kierongreen

#2

Index: simwerkz.cc
===================================================================
--- simwerkz.cc   (revision 7157)
+++ simwerkz.cc   (working copy)
@@ -2487,10 +2487,18 @@

    error = NULL;
    grund_t *gr = welt->lookup(pos);
-   if(  gr==NULL  ||  !hang_t::ist_wegbar(gr->get_grund_hang())  ||  !brueckenbauer_t::ist_ende_ok( sp, gr, wt, (is_first_click() ? 0 : ribi_typ(pos-start)) )  ) {
+
+   if(  gr==NULL  ||  !hang_t::ist_wegbar(gr->get_grund_hang())  ) {
       return 0;
    }

+   if(  is_first_click()  &&  (gr->get_typ()==grund_t::monorailboden  ||  !brueckenbauer_t::ist_ende_ok( sp, gr, wt, 0 ))  ) {
+      return 0;
+   }
+   else if(  !is_first_click()  &&  !brueckenbauer_t::ist_ende_ok( sp, gr, wt, ribi_typ(pos-start) )  ) {
+      return 0;
+   }
+
    if(  welt->lookup( pos + koord3d(0, 0, 1))  ||  (welt->get_settings().get_way_height_clearance()==2  &&  welt->lookup( pos + koord3d(0, 0, 2) ))  ) {
       return 0;
    }

This fixes issue but is a little messy so if anyone has a cleaner solution feel free to commit that instead!
-----------------
Edit - looked at 7158. Your solution (making level bridges when joining two elevated ways) appears to result in either broken ribis or bridge sections which cannot be demolished afterwards.

prissi

I tested the demolition: It works fine when clicking on either end of the bridge not the middle. (There it was not allowed before either). I could also not reproduce a single ribi on creation.

Dwachs

You get single ribi when building downward bridge from elevated way to ground.
Parsley, sage, rosemary, and maggikraut.

prissi

THanks, and demolishion was also broken. Well, when this is fixed I intend to do a release candidate. THe pak64, installer and pak64.japan are ready ...

Dwachs

as to r7160: imho it is not necessary to check for first and last tile.

There are some checks for karten_boden, which are generically true: In the code added with 7160, gr->ist_karten_boden() is always true. All tiles in end_list are ground tiles (karten_boden) anyway.

Also the if-condition on line 847 looks strange.
Parsley, sage, rosemary, and maggikraut.

prissi

A single tile ramp or a single tile bridge between to elevated ways needed checks for the upper end. But the other checks should be indeed made in the part deletion routine.

Spacethingy

As of r7164 this is kind of fixed, but for one weird little thing: connecting two elevated ways with a bridge works, as shown below:



...but for some odd reason, the bridge pylons can be deleted, when clicking on the ground level, as demonstrated by the lower track (which is actually just the same as the upper track). This doesn't seem to do anything, other than change the graphics. :)
Life is like a Simutrans transformer:

You only get one of them, and you can't have it on a slope.

Ters

It is normal that pylons can be deleted. That's the case with all kinds of bridges I have seen.

Spacethingy

Well well! I never noticed that. That's actually rather useful, in terms of eye-candy:



Upper bridge with deleted pylons for better looking road.
Life is like a Simutrans transformer:

You only get one of them, and you can't have it on a slope.