News:

SimuTranslator
Make Simutrans speak your language.

What are way directions and masks?

Started by Spacethingy, November 28, 2013, 10:05:07 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Spacethingy




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
Life is like a Simutrans transformer:

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

isidoro

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.

Ters

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).

IgorEliezer

.... I think this kind of info should be translated to normal players or should be hidden from them. ;)

Spacethingy

Ah, that's very clever! Thanks for that, I get it now. Reminds me of chmod'ing something... :D
Life is like a Simutrans transformer:

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

Fabio

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.

An_dz

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)