tile.c
author tron
Sat, 29 Jan 2005 13:33:48 +0000
changeset 1211 6f2f723e5c36
child 1213 bb9906f67932
permissions -rw-r--r--
(svn r1715) Move [GS]etMapExtraBits to tile.[ch]
1211
6f2f723e5c36 (svn r1715) Move [GS]etMapExtraBits to tile.[ch]
tron
parents:
diff changeset
     1
#include "tile.h"
6f2f723e5c36 (svn r1715) Move [GS]etMapExtraBits to tile.[ch]
tron
parents:
diff changeset
     2
6f2f723e5c36 (svn r1715) Move [GS]etMapExtraBits to tile.[ch]
tron
parents:
diff changeset
     3
void SetMapExtraBits(TileIndex tile, byte bits)
6f2f723e5c36 (svn r1715) Move [GS]etMapExtraBits to tile.[ch]
tron
parents:
diff changeset
     4
{
6f2f723e5c36 (svn r1715) Move [GS]etMapExtraBits to tile.[ch]
tron
parents:
diff changeset
     5
	assert(tile < MapSize());
6f2f723e5c36 (svn r1715) Move [GS]etMapExtraBits to tile.[ch]
tron
parents:
diff changeset
     6
	_map_extra_bits[tile >> 2] &= ~(3 << ((tile & 3) * 2));
6f2f723e5c36 (svn r1715) Move [GS]etMapExtraBits to tile.[ch]
tron
parents:
diff changeset
     7
	_map_extra_bits[tile >> 2] |= (bits&3) << ((tile & 3) * 2);
6f2f723e5c36 (svn r1715) Move [GS]etMapExtraBits to tile.[ch]
tron
parents:
diff changeset
     8
}
6f2f723e5c36 (svn r1715) Move [GS]etMapExtraBits to tile.[ch]
tron
parents:
diff changeset
     9
6f2f723e5c36 (svn r1715) Move [GS]etMapExtraBits to tile.[ch]
tron
parents:
diff changeset
    10
uint GetMapExtraBits(TileIndex tile)
6f2f723e5c36 (svn r1715) Move [GS]etMapExtraBits to tile.[ch]
tron
parents:
diff changeset
    11
{
6f2f723e5c36 (svn r1715) Move [GS]etMapExtraBits to tile.[ch]
tron
parents:
diff changeset
    12
	assert(tile < MapSize());
6f2f723e5c36 (svn r1715) Move [GS]etMapExtraBits to tile.[ch]
tron
parents:
diff changeset
    13
	return (_map_extra_bits[tile >> 2] >> (tile & 3) * 2) & 3;
6f2f723e5c36 (svn r1715) Move [GS]etMapExtraBits to tile.[ch]
tron
parents:
diff changeset
    14
}