The International Simutrans Forum

Community => Simutrans Help Center => Topic started by: Spacethingy on November 28, 2013, 10:05:07 PM

Title: What are way directions and masks?
Post by: Spacethingy on November 28, 2013, 10:05:07 PM
(http://i.imgur.com/uRAF3vJ.png)


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
Title: Re: What are way directions and masks?
Post by: isidoro 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.
Title: Re: What are way directions and masks?
Post by: Ters 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).
Title: Re: What are way directions and masks?
Post by: IgorEliezer 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. ;)
Title: Re: What are way directions and masks?
Post by: Spacethingy 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
Title: Re: What are way directions and masks?
Post by: Fabio 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.
Title: Re: What are way directions and masks?
Post by: An_dz on November 29, 2013, 03:41:36 PM
Quote from: IgorEliezer 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. ;)
I translated it 8)