The International Simutrans Forum

 

Author Topic: What are way directions and masks?  (Read 2341 times)

0 Members and 1 Guest are viewing this topic.

Offline Spacethingy

  • *
  • Posts: 183
What are way directions and masks?
« on: November 28, 2013, 10:05:07 PM »



I don't understand the number of directions. On a straight road, it's 10. And what is/does the mask do? That sounds like something from PSP, but that doesn't really help me work it out much...


Thanks for your help!  ;D

Offline isidoro

  • Devotee
  • *
  • Posts: 1146
Re: What are way directions and masks?
« Reply #1 on: November 29, 2013, 12:06:23 AM »
The number makes sense when you write it in binary: 10 is 1010b.  Each binary digit tells whether a certain direction of the tile in question is connected or not with another piece of road.  In the case of the image, the road tile is connected to two adjacent road tiles, hence the two ones in the binary number.

The masked version relates to the real connections for a vehicle that is in that tile.  Where can it go from that tile.  In that same tile of the picture, if there were a road sign forbidding one of the two directions, the masked value would indicate that (there would be only one one in that binary number).

You can experiment and check what bit corresponds to what direction by trial and error.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5695
  • Languages: EN, NO
Re: What are way directions and masks?
« Reply #2 on: November 29, 2013, 05:52:54 AM »
If you don't like working with binary numbers, 1 is north (towards upper right), 2 is east, 4 is south and 8 is west. Just add together to get the mask. 10 is east-west because 10=2+8. Note that these directions are always the same relative to the screen. If you rotate the map, you rotate the map relative to these compass directions (and the coordinate grid, which is why a building changes coordinates when the map is rotated).

Offline IgorEliezer

  • Devotee
  • Administrator
  • *
  • Posts: 4113
  • I have nothing to do with it!
    • Igor Eliezer Architect and Urban Planner/Arquiteto e Urbanista
  • Languages: PT, EN
Re: What are way directions and masks?
« Reply #3 on: November 29, 2013, 06:35:02 AM »
.... I think this kind of info should be translated to normal players or should be hidden from them. ;)

Offline Spacethingy

  • *
  • Posts: 183
Re: What are way directions and masks?
« Reply #4 on: November 29, 2013, 09:29:39 AM »
Ah, that's very clever! Thanks for that, I get it now. Reminds me of chmod'ing something... :D

Offline Fabio

  • Devotee
  • Administrator
  • *
  • Posts: 2898
  • The Pak128 Guy
    • Visit me on Facebook
  • Languages: EN, IT, RO, FR
Re: What are way directions and masks?
« Reply #5 on: November 29, 2013, 01:14:11 PM »
IMO they should be displayed as NSEW as in makeobj dat files.
And there should be a single field, with forbidden directions in white and normal in black.

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2921
  • D'oh
    • by An_dz
  • Languages: pt, en, it, (de)
Re: What are way directions and masks?
« Reply #6 on: November 29, 2013, 03:41:36 PM »
.... I think this kind of info should be translated to normal players or should be hidden from them. ;)
I translated it 8)