News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

Signals on left, drive on left

Started by Vladki, March 10, 2015, 08:40:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

prissi

Thank you for you observations. Indeed, for the tunnel entrance there is a mistake.

r7541 has configurable offsets.

Vladki

I have to coorect myself:

Quote
Prissi is still using the rueckwaerts method, but with proper typesetting, which makes it work right, for both single and double slopes, while gegenueber works only for single slopes (see later)

method gegenueber works for both single and double slopes. The further check for direction works only for single slope:

if(hang==hang_t::ost ||  hang==hang_t::nord)

Vladki

Here is a partial patch for experimental for tunnels:


--- a/obj/roadsign.cc
+++ b/obj/roadsign.cc
@@ -318,6 +318,7 @@ void roadsign_t::calc_image()
                        (grund_t::underground_mode==grund_t::ugm_none  ||  (grund_t::underground_mode==grund_t::ugm_level  &&  gr->get_hoehe()<grund_t::underground_level))   ) {
                        // entering tunnel here: hide the image further in if not undergroud/sliced
                        hang = gr->get_grund_hang();
+                       hang = hang >> hang_t::ist_doppel(hang);
                        if(  hang==hang_t::ost  ||  hang==hang_t::nord  ) {
                                temp_dir &= ~ribi_t::suedwest;
                        }


I had it prepared to go, but wanted to test the tunnel entrances a bit more while Prissi had chosen diifferent approach:

@@ -275,8 +277,8 @@ void roadsign_t::calc_image()
                if(  gr->get_typ()==grund_t::tunnelboden  &&  gr->ist_karten_boden()  &&
                        (grund_t::underground_mode==grund_t::ugm_none  ||  (grund_t::underground_mode==grund_t::ugm_level  &&  gr->get_hoehe()<grund_t::underground_level))   ) {
                        // entering tunnel here: hide the image further in if not undergroud/sliced
-                       hang = gr->get_grund_hang();
-                       if(  hang==hang_t::ost  ||  hang==hang_t::nord  ) {
+                       const ribi_t::ribi tunnel_hang_dir = ribi_t::rueckwaerts( ribi_typ(gr->get_grund_hang()) );
+                       if(  tunnel_hang_dir==ribi_t::ost ||  tunnel_hang_dir==ribi_t::nord  ) {
                                temp_dir &= ~ribi_t::suedwest;
                        }
                        else {


Anyway there is further bug, prehaps related to the code a few lines after the place where this patch is applied. There is check for IMG_LEER and in some circumstances the front image is drawn as backimage and vice versa. It seems to be dealing with signals and stations on the same tile, but it works OK only for Nort-South direction. East-West is broken for both stations and tunnel entrances - the signal is drawn first, and then the station/tunnel graphics covers the signal. On the attached screenshots, there are two way signals on statins and tunnel entrances, but you can see some missing. For signals_on_left, the bug manifests in North-south direction, and east-west is OK.

prissi

That is how it is inteded to look. Otherwise the signal would be on top of the station. Rather a station with a close roof is not recommended for various reasopn.

Vladki

Quote from: prissi on April 06, 2015, 09:54:36 PM
That is how it is inteded to look. Otherwise the signal would be on top of the station. Rather a station with a close roof is not recommended for various reasopn.

The pictures you see are rotations of the same station. It has signals on both sides, and the tunnell too.  And yet you can see that the signal for driving east disappears. I really doubt it is intended.

I chose this station to show how it covers the signal as it was similar to how it is covered by tunnel entrance.

Vladki

Quote from: prissi on April 03, 2015, 09:47:46 PM
r7541 has configurable offsets.

I have tried it, but almost no roadsigns get moved to the left side. Here is a patch:


diff --git a/besch/reader/roadsign_reader.cc b/besch/reader/roadsign_reader.cc
index 1d18dcc..0fc071d 100644
--- a/besch/reader/roadsign_reader.cc
+++ b/besch/reader/roadsign_reader.cc
@@ -87,7 +87,7 @@ obj_besch_t * roadsign_reader_t::read_node(FILE *fp, obj_node_info_t &node)
                dbg->fatal("roadsign_reader_t::read_node()","version 0 not supported. File corrupt?");
        }

-       if(  version<=3  &&  (besch->is_choose_sign()  ||  (besch->flags & ~roadsign_besch_t::PRIVATE_ROAD) == 0)  &&  besch->get_waytype() == road_wt  ) {
+       if(  version<=3  &&  ((besch->is_choose_sign()  ||  besch->is_private_way())  &&  besch->get_waytype() == road_wt  )) {
                // do not shift these signs to the left for compatibility
                besch->offset_left = 0;
        }


prissi

Thank you; with && the second set of () are not needed.

prissi

The hiding of signals in the east facing tunnels is a fundamental limitation with no easy way out. Even making this a foreground image does not solve the issue, since the tunnel (or station) is draw later to prevent other issues.

Vladki

Hi, I'm reopening this topic because part of the original patch was overlooked (or not incorporated for any reason). It deals with private road/rail barriers/gates on slopes. Their position was not corresponding to the slope - most of the graphics for gates are in the middle of tile, but it was displayed on height corresponding to the south or east border of tile. Anyway here is the new patch:


Index: obj/roadsign.cc
===================================================================
--- obj/roadsign.cc     (revision 7727)
+++ obj/roadsign.cc     (working copy)
@@ -243,9 +243,7 @@
                set_bild( besch->get_bild_nr(image) );
                set_yoff( 0 );
                if(  hang_diff  ) {
-                       if(hang_dir==ribi_t::west ||  hang_dir==ribi_t::nord) {
-                               set_yoff( -TILE_HEIGHT_STEP );
-                       }
+                       set_yoff( -TILE_HEIGHT_STEP*hang_diff/2 );
                }
                else {
                        set_yoff( -gr->get_weg_yoff() );


The same problem is in experimental, though the patch may need some adjustment.

prissi

Well, a valid argument. Incorporated in -r7728. THanks