src/road.h
author tron
Wed, 21 Feb 2007 20:05:05 +0000
changeset 6100 6b50beea81cd
parent 6009 bbe756070082
child 6116 0a63874accb6
permissions -rw-r--r--
(svn r8835) -Fix

Remove dead code
3518
c1e19f08fc25 (svn r4374) Never directly commit something you prepared the evening before, mysteriously it will break in the morning, fix r4373
tron
parents:
diff changeset
     1
/* $Id$ */
c1e19f08fc25 (svn r4374) Never directly commit something you prepared the evening before, mysteriously it will break in the morning, fix r4373
tron
parents:
diff changeset
     2
c1e19f08fc25 (svn r4374) Never directly commit something you prepared the evening before, mysteriously it will break in the morning, fix r4373
tron
parents:
diff changeset
     3
#ifndef ROAD_H
c1e19f08fc25 (svn r4374) Never directly commit something you prepared the evening before, mysteriously it will break in the morning, fix r4373
tron
parents:
diff changeset
     4
#define ROAD_H
c1e19f08fc25 (svn r4374) Never directly commit something you prepared the evening before, mysteriously it will break in the morning, fix r4373
tron
parents:
diff changeset
     5
5587
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
     6
#include "helpers.hpp"
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
     7
3518
c1e19f08fc25 (svn r4374) Never directly commit something you prepared the evening before, mysteriously it will break in the morning, fix r4373
tron
parents:
diff changeset
     8
typedef enum RoadBits {
5587
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
     9
	ROAD_NONE = 0U,
3795
45a8b78417d2 (svn r4791) - Codechange: Mark road bits as unsigned. Fixes warning with older gcc versions.
peter1138
parents: 3518
diff changeset
    10
	ROAD_NW  = 1U,
45a8b78417d2 (svn r4791) - Codechange: Mark road bits as unsigned. Fixes warning with older gcc versions.
peter1138
parents: 3518
diff changeset
    11
	ROAD_SW  = 2U,
45a8b78417d2 (svn r4791) - Codechange: Mark road bits as unsigned. Fixes warning with older gcc versions.
peter1138
parents: 3518
diff changeset
    12
	ROAD_SE  = 4U,
45a8b78417d2 (svn r4791) - Codechange: Mark road bits as unsigned. Fixes warning with older gcc versions.
peter1138
parents: 3518
diff changeset
    13
	ROAD_NE  = 8U,
3518
c1e19f08fc25 (svn r4374) Never directly commit something you prepared the evening before, mysteriously it will break in the morning, fix r4373
tron
parents:
diff changeset
    14
	ROAD_X   = ROAD_SW | ROAD_NE,
c1e19f08fc25 (svn r4374) Never directly commit something you prepared the evening before, mysteriously it will break in the morning, fix r4373
tron
parents:
diff changeset
    15
	ROAD_Y   = ROAD_NW | ROAD_SE,
c1e19f08fc25 (svn r4374) Never directly commit something you prepared the evening before, mysteriously it will break in the morning, fix r4373
tron
parents:
diff changeset
    16
	ROAD_ALL = ROAD_X  | ROAD_Y
c1e19f08fc25 (svn r4374) Never directly commit something you prepared the evening before, mysteriously it will break in the morning, fix r4373
tron
parents:
diff changeset
    17
} RoadBits;
c1e19f08fc25 (svn r4374) Never directly commit something you prepared the evening before, mysteriously it will break in the morning, fix r4373
tron
parents:
diff changeset
    18
5587
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
    19
DECLARE_ENUM_AS_BIT_SET(RoadBits);
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
    20
3518
c1e19f08fc25 (svn r4374) Never directly commit something you prepared the evening before, mysteriously it will break in the morning, fix r4373
tron
parents:
diff changeset
    21
static inline RoadBits ComplementRoadBits(RoadBits r)
c1e19f08fc25 (svn r4374) Never directly commit something you prepared the evening before, mysteriously it will break in the morning, fix r4373
tron
parents:
diff changeset
    22
{
3900
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3795
diff changeset
    23
	return (RoadBits)(ROAD_ALL ^ r);
3518
c1e19f08fc25 (svn r4374) Never directly commit something you prepared the evening before, mysteriously it will break in the morning, fix r4373
tron
parents:
diff changeset
    24
}
c1e19f08fc25 (svn r4374) Never directly commit something you prepared the evening before, mysteriously it will break in the morning, fix r4373
tron
parents:
diff changeset
    25
c1e19f08fc25 (svn r4374) Never directly commit something you prepared the evening before, mysteriously it will break in the morning, fix r4373
tron
parents:
diff changeset
    26
static inline RoadBits DiagDirToRoadBits(DiagDirection d)
c1e19f08fc25 (svn r4374) Never directly commit something you prepared the evening before, mysteriously it will break in the morning, fix r4373
tron
parents:
diff changeset
    27
{
3900
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3795
diff changeset
    28
	return (RoadBits)(1U << (3 ^ d));
3518
c1e19f08fc25 (svn r4374) Never directly commit something you prepared the evening before, mysteriously it will break in the morning, fix r4373
tron
parents:
diff changeset
    29
}
c1e19f08fc25 (svn r4374) Never directly commit something you prepared the evening before, mysteriously it will break in the morning, fix r4373
tron
parents:
diff changeset
    30
6009
bbe756070082 (svn r8730) -Codechange: more replacements of magic numbers by enums and removal of some (by now) redundant comments.
rubidium
parents: 5587
diff changeset
    31
/** Checks whether the trackdir means that we are reversing */
bbe756070082 (svn r8730) -Codechange: more replacements of magic numbers by enums and removal of some (by now) redundant comments.
rubidium
parents: 5587
diff changeset
    32
static inline bool IsReversingRoadTrackdir(Trackdir dir)
bbe756070082 (svn r8730) -Codechange: more replacements of magic numbers by enums and removal of some (by now) redundant comments.
rubidium
parents: 5587
diff changeset
    33
{
bbe756070082 (svn r8730) -Codechange: more replacements of magic numbers by enums and removal of some (by now) redundant comments.
rubidium
parents: 5587
diff changeset
    34
	return (dir & 0x07) >= 6;
bbe756070082 (svn r8730) -Codechange: more replacements of magic numbers by enums and removal of some (by now) redundant comments.
rubidium
parents: 5587
diff changeset
    35
}
bbe756070082 (svn r8730) -Codechange: more replacements of magic numbers by enums and removal of some (by now) redundant comments.
rubidium
parents: 5587
diff changeset
    36
bbe756070082 (svn r8730) -Codechange: more replacements of magic numbers by enums and removal of some (by now) redundant comments.
rubidium
parents: 5587
diff changeset
    37
/** Checks whether the given trackdir is a straight road */
bbe756070082 (svn r8730) -Codechange: more replacements of magic numbers by enums and removal of some (by now) redundant comments.
rubidium
parents: 5587
diff changeset
    38
static inline bool IsStraightRoadTrackdir(Trackdir dir)
bbe756070082 (svn r8730) -Codechange: more replacements of magic numbers by enums and removal of some (by now) redundant comments.
rubidium
parents: 5587
diff changeset
    39
{
bbe756070082 (svn r8730) -Codechange: more replacements of magic numbers by enums and removal of some (by now) redundant comments.
rubidium
parents: 5587
diff changeset
    40
	return (dir & 0x06) == 0;
bbe756070082 (svn r8730) -Codechange: more replacements of magic numbers by enums and removal of some (by now) redundant comments.
rubidium
parents: 5587
diff changeset
    41
}
bbe756070082 (svn r8730) -Codechange: more replacements of magic numbers by enums and removal of some (by now) redundant comments.
rubidium
parents: 5587
diff changeset
    42
4666
172a0cdf28a6 (svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents: 3900
diff changeset
    43
#endif /* ROAD_H */