Cookie Consent

This website would like to place cookies on your computer to improve the quality of your experience of the site. To find out more about the cookies, see our privacy notice.

Loading...
 
Skip to main content

Site identity, navigation, etc.

Simutrans Tikiwiki
Simutrans Tikiwiki
The official wiki for Simutrans
I forgot my password
CapsLock is on.
  • Login with 2FA

Navigation and related functionality and content

Structures
Development Index
Page actions
Print
  1. Development Index
  2. Developing Simutrans
  3. Overview of Simutrans Code
  4. CHAPTER 2: WAYS (AND ROADS)

This page is part of a series giving an Overview of Simutrans Code.

                CHAPTER 2: WAYS (AND ROADS)


                One of the things that we can find on a grund_t are ways (abstract weg_t in /obj/way/weg.h ). In fact, ways are a subclass of a subclass of obj_t (via the abstract class obj_no_info_t in obj/simobj.h, which includes objects that don't have description windows). An example of a way is a tile of asphalt road.


                A weg_t may have one or more of these flags ( uint8 flags ) activated:

                •   1 weg_t::HAS_SIDEWALK ( void set_gehweg(bool) , bool hat_gehweg() )
                •   2 weg_t::IS_ELECTRIFIED ( bool is_electrified() )
                •   4 weg_t::HAS_SIGN ( bool has_sign() )
                •   8 weg_t::HAS_SIGNAL ( bool has_signal() )
                •  16 weg_t::HAS_WAYOBJ ( has_wayobj() )
                •  32 weg_t::HAS_CROSSING ( bool is_crossing() )
                •  64 weg_t::IS_DIAGONAL ( bool is_diagonal() , if there is a curve in one direction followed by another curve in the opposite direction, the diagonal image is used if available)
                • 128 weg_t::IS_SNOW ( bool is_snow() )


                Besides, a weg_t may belong to one of these system types:

                •    0 weg_t::systemtype_t::type_flat
                •    1 weg_t::systemtype_t::type_elevated
                •    1 weg_t::systemtype_t::type_runway
                •    7 weg_t::systemtype_t::type_tram
                •  64 weg_t::systemtype_t::type_underground unused
                • 255 weg_t::systemtype_t::type_river
                • 255 weg_t::systemtype_t::type_all (Also used for canals [with water_wt] and fences. With this system type a way will by only listed in the extension menu by convention. Ways, whose description do not return an icon, will not be listed at all.)


                To get the way type, use: virtual waytype_t get_waytype(). Although the type of the obj_t is always obj_t::way, of course:

                typ get_typ() const { return obj_t::way; }


                One can imagine that each way tile is like a city with four invisible walls: northern, southern, eastern and western. There may be a wall or a connection to the adjacent way tiles. This is marked by the ribis (Richtungsbits) of bits of allowed directions. weg_t::ribi is a 4-bit long bitfield;, each bit is 1 if that direction is allowed. The order is WSEN. To retrieve this information, use: ribi_t::ribi get_ribi_unmasked().

                Even if there is a connection to an adjacent tile, it is possible that a certain direction is forbidden for vehicles. This is marked with the ribi mask (-+ribi_maske+-). It is another 4-bit long bit field. This time, a 1 means that the corresponding direction is forbidden. To retrieve or set this information, use: void set_ribi_maske(ribi) or ribi_t::ribi get_ribi_maske(). To retrieve the combined final effect of ribi and ribi mask, use ribi_t::ribi get_ribi().

                Because a weg_t is an obj_t, it has an associated image. However, that image depends on the ribi, the slope, the climate, etc. There is a method to calculate the image used ( void calc_image() , previously calc_bild()). This method is to be called each time we modify the ribi values with: void ribi_add(ribi_t::ribi), void ribi_rem(ribi_t::ribi ribi), void set_ribi(ribi_t::ribi ribi).

                The weg_t has a description (Beschreibung), or simply desc (besch) when it is hanging out with friends ( way_desc_t, previously weg_besch_t, in /descriptor/way_desc.h ). Those descriptions come from the paksets. The information includes everything pak-dependent: introduction date, maximum speed, etc. You can retrieve/set the description with these two methods: void set_desc(way_desc_t *) and way_desc_t *get_desc(). The maximum speed is not taken directly from the description only, since it may be altered by other objects in the grund_t. For instance, a 80km/h tramway might have a maximum speed of 50km/h inside a city .

                This section may be outdated

                Inside way_desc_t, we only find these properties relevant to the problem in hand: uint8 wtyp (type of way), uint8 styp (system type).

                wtyp now seems to have been split out into groundobj_desc_t::wtyp and obj_desc_transport_related_t::wtyp


                Known subclasses of weg_t are: strasse_t "road" ( /obj/way/strasse.h ), kanal_t ( /obj/way/kanal.h ), and schiene_t "track" ( /obj/way/schiene.h).

                Another objects that may appear in a grund_t in connection with ways are way objects ( wayobj_t in /obj/wayobj.h ). These are objects whose images change depending on the configuration (ribis) of the way tile. The most typical of these are catenary and the like.

                At this point of our travel, we have to choose among the different subclasses of weg_t. strasse_t (in /obj/way/strasse.h ) is chosen, since we are dealing with roads.

                strasse_t is a boring class, though. It only returns its type if asked, allows for the inclusion of sidewalks, or does domestic chores... It has no known subclasses either (a bachelor, one might say).

                1. Development Index
                2. Developing Simutrans
                3. Overview of Simutrans Code
                4. CHAPTER 2: WAYS (AND ROADS)
                Rate this page:

                Contributors to this page: Frank and Matthew .
                Page last modified on Wednesday April 29, 2026 10:13:22 CEST by Frank.
                This content is licensed under the terms of the Copyright.
                History Source Comments
                Contributions by author Discuss

                More content and functionality (left side)

                ....

                Copyright
                Impressum

                Data protection

                Search

                System Menu

                • Home
                • Search
                • Contact Us
                • Stats
                • Categories
                • Tags
                • Wiki
                  • Wiki Home
                  • Last Changes
                  • Rankings
                  • List Pages
                  • Sandbox
                  • Structures
                • Articles
                  • Articles Home
                  • List Articles
                  • Submit Article
                  • View submissions
                • Forums
                  • List Forums
                • Directory
                  • Submit a new link
                  • Browse Directory
                • File Galleries
                  • List Galleries
                • Spreadsheets
                  • List Sheets
                • Trackers
                  • List Trackers
                  • Offline mode
                • Surveys
                  • List Surveys
                  • Stats

                Articles

                1. Simutrans 124.4.1
                2. unofficial pak64.german 0.124.4.0.1
                3. Simutrans 124.4
                4. PAK128.German 2.4
                5. unofficial pak64.german 0.124.0.0.7
                6. unofficial pak64.german 0.124.0.0.6
                7. Simutrans 124.3.1
                8. unofficial pak64.german 0.124.0.0.5
                9. 2024 Simutrans Screenshot Contest
                10. Simutrans 124.3

                Latest Changes

                1. Home
                2. en_Code_Overview_3_Ribis_and_Slopes
                3. en_Code_Overview_2_Ways
                4. en_Code_Overview_1_World
                5. Copyright
                6. en_Code_Overview_5_Vehicles_and_Convoys
                7. en_Code_Overview_7_Movement_of_Convoys
                8. en_Code_Overview_6_Schedules_and_Routes
                9. en_Code_Overview_4_Signs
                10. en_Overview_of_Simutrans_Code
                ...more

                Online Users

                18 online users

                Newest Forum Posts

                1. Aw: en_menuconf_tab: Wofür steht 'ribi'?
                2. en_menuconf_tab: Wofür steht 'ribi'?

                BugTracker

                1. Signals waytype tram_track not correct work
                2. fehlerhafte Darstellung bei Untergrundstrom
                3. ungleiche Frachtverteilung an Ölborinseln
                4. Liste verfügbare Fahrzeuge
                5. Grafikfehler Bodentextur
                6. Linksklick in Haltliste
                7. blank menu show

                Last wiki comments

                1. en_BuildAnAirport: "In Extended, they have to..."
                2. en_BuildAnAirport: "Is there any advice on how..."
                3. en_Simutrans_repo_deb: "When installing..."
                4. en_Simutrans_repo_deb: "Also with Linux Mint 21.1 -..."
                5. en_Simutrans_repo_deb: "After a while, I found..."
                6. en_Simutrans_repo_deb: "Hi, I tested the following..."
                7. de_VehicleDef: "Loading time ist ein..."
                8. de_tikiwiki_hilfe_index: "cialis normaldosis <a..."
                9. de_tikiwiki_hilfe_index: "cialis moment urban..."
                10. de_FactoryDef: "z.B. bei Ölbohrinseln mit..."

                Site information, links, etc.