diff options
author | tron <tron@openttd.org> | 2006-06-27 21:25:53 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-06-27 21:25:53 +0000 |
commit | 2b27073156f40df263cf653263488b8d72a76236 (patch) | |
tree | 1bfdb9c99b43fdc3b07ac13cbed4259a06d34f6f /depot.h | |
parent | c126ce110ee33bffe07dac5283d8a1648dc662b7 (diff) | |
download | openttd-2b27073156f40df263cf653263488b8d72a76236.tar.xz |
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
Diffstat (limited to 'depot.h')
-rw-r--r-- | depot.h | 29 |
1 files changed, 14 insertions, 15 deletions
@@ -90,21 +90,20 @@ static inline bool IsTileDepotType(TileIndex tile, TransportType type) /** - Find out if the slope of the tile is suitable to build a depot of given direction - @param direction The direction in which the depot's exit points. Starts with 0 as NE and goes Clockwise - @param tileh The slope of the tile in question - @return true if the construction is possible - - - This is checked by the ugly 0x4C >> direction magic, which does the following: - 0x4C is 0100 1100 and tileh has only bits 0..3 set (steep tiles are ruled out) - So: for direction (only the significant bits are shown)<p> - 00 (exit towards NE) we need either bit 2 or 3 set in tileh: 0x4C >> 0 = 1100<p> - 01 (exit towards SE) we need either bit 1 or 2 set in tileh: 0x4C >> 1 = 0110<p> - 02 (exit towards SW) we need either bit 0 or 1 set in tileh: 0x4C >> 2 = 0011<p> - 03 (exit towards NW) we need either bit 0 or 4 set in tileh: 0x4C >> 3 = 1001<p> - So ((0x4C >> p2) & tileh) determines whether the depot can be built on the current tileh -*/ + * Find out if the slope of the tile is suitable to build a depot of given direction + * @param direction The direction in which the depot's exit points. Starts with 0 as NE and goes Clockwise + * @param tileh The slope of the tile in question + * @return true if the construction is possible + + * This is checked by the ugly 0x4C >> direction magic, which does the following: + * 0x4C is 0100 1100 and tileh has only bits 0..3 set (steep tiles are ruled out) + * So: for direction (only the significant bits are shown)<p> + * 00 (exit towards NE) we need either bit 2 or 3 set in tileh: 0x4C >> 0 = 1100<p> + * 01 (exit towards SE) we need either bit 1 or 2 set in tileh: 0x4C >> 1 = 0110<p> + * 02 (exit towards SW) we need either bit 0 or 1 set in tileh: 0x4C >> 2 = 0011<p> + * 03 (exit towards NW) we need either bit 0 or 4 set in tileh: 0x4C >> 3 = 1001<p> + * So ((0x4C >> direction) & tileh) determines whether the depot can be built on the current tileh + */ static inline bool CanBuildDepotByTileh(uint32 direction, Slope tileh) { return ((0x4C >> direction) & tileh) != 0; |