Page 1 of 1

Land info for nearby tiles - how?

Posted: 14 Aug 2006 14:05
by Darkwalker
Please, can anyone explain it to me? I've read Documentation many times, but unsuccessfully :(
I need one sprite, which identifies nearby tile, whether it is a road or not, and according to this info decides which type of building to use, but I'm totally helpless. (VarAction 2, variable 62) Maybe because I cannot work with Dword information.

Can anyone help me please?

Thanks a lot.

Posted: 14 Aug 2006 14:25
by michael blunck
Well, firstly you should check out Land info of nearby tiles (60):
The parameter of this variable is an offset from the position of the current tile. The low nibble contains the signed X offset (that is 0h=0, 1h=+1 ... 7h=+7, 8h=-8, 9h=-7 ... Fh=-1), the high nibble contains the Y offset. Therefore the parameter 00h accesses the current tile itself. The returned doubleword is in the format rczzbbss, where the meaning of the letters is:

c contains the landscape class of the tile.
Now, the landscape class for a road object is "2", so the task would look like:

Code: Select all

// check land info of tile (e.g. x=0; y= +1 -> "10")
-1 * 15	02 07 02 81 62 10 18 0F 01
		00 00 02 02        // contains road object
		01 00              // does not
I.e., sprite "02" above would reference sprite "00" if the assigned tile contains a road object, and sprite "01" if not.

HTH
regards
Michael