author | celestar |
Tue, 12 Jun 2007 11:56:35 +0000 | |
branch | gamebalance |
changeset 9908 | 0fa543611bbe |
parent 9895 | 7bd07f43b0e3 |
child 6743 | cabfaa4a0295 |
child 7805 | d6b7546a25b1 |
permissions | -rw-r--r-- |
3636
d87b21df2944
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents:
diff
changeset
|
1 |
/* $Id$ */ |
d87b21df2944
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents:
diff
changeset
|
2 |
|
9908
0fa543611bbe
(svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents:
9895
diff
changeset
|
3 |
/** @file slope.h */ |
0fa543611bbe
(svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents:
9895
diff
changeset
|
4 |
|
3636
d87b21df2944
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents:
diff
changeset
|
5 |
#ifndef SLOPE_H |
d87b21df2944
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents:
diff
changeset
|
6 |
#define SLOPE_H |
d87b21df2944
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents:
diff
changeset
|
7 |
|
9895
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
5726
diff
changeset
|
8 |
enum Slope { |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
3636
diff
changeset
|
9 |
SLOPE_FLAT = 0x00, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
3636
diff
changeset
|
10 |
SLOPE_W = 0x01, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
3636
diff
changeset
|
11 |
SLOPE_S = 0x02, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
3636
diff
changeset
|
12 |
SLOPE_E = 0x04, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
3636
diff
changeset
|
13 |
SLOPE_N = 0x08, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
3636
diff
changeset
|
14 |
SLOPE_STEEP = 0x10, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
3636
diff
changeset
|
15 |
SLOPE_NW = SLOPE_N | SLOPE_W, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
3636
diff
changeset
|
16 |
SLOPE_SW = SLOPE_S | SLOPE_W, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
3636
diff
changeset
|
17 |
SLOPE_SE = SLOPE_S | SLOPE_E, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
3636
diff
changeset
|
18 |
SLOPE_NE = SLOPE_N | SLOPE_E, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
3636
diff
changeset
|
19 |
SLOPE_EW = SLOPE_E | SLOPE_W, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
3636
diff
changeset
|
20 |
SLOPE_NS = SLOPE_N | SLOPE_S, |
3636
d87b21df2944
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents:
diff
changeset
|
21 |
SLOPE_ELEVATED = SLOPE_N | SLOPE_E | SLOPE_S | SLOPE_W, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
3636
diff
changeset
|
22 |
SLOPE_NWS = SLOPE_N | SLOPE_W | SLOPE_S, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
3636
diff
changeset
|
23 |
SLOPE_WSE = SLOPE_W | SLOPE_S | SLOPE_E, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
3636
diff
changeset
|
24 |
SLOPE_SEN = SLOPE_S | SLOPE_E | SLOPE_N, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
3636
diff
changeset
|
25 |
SLOPE_ENW = SLOPE_E | SLOPE_N | SLOPE_W, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
3636
diff
changeset
|
26 |
SLOPE_STEEP_W = SLOPE_STEEP | SLOPE_NWS, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
3636
diff
changeset
|
27 |
SLOPE_STEEP_S = SLOPE_STEEP | SLOPE_WSE, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
3636
diff
changeset
|
28 |
SLOPE_STEEP_E = SLOPE_STEEP | SLOPE_SEN, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
3636
diff
changeset
|
29 |
SLOPE_STEEP_N = SLOPE_STEEP | SLOPE_ENW |
9895
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
5726
diff
changeset
|
30 |
}; |
3636
d87b21df2944
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents:
diff
changeset
|
31 |
|
d87b21df2944
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents:
diff
changeset
|
32 |
static inline bool IsSteepSlope(Slope s) |
d87b21df2944
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents:
diff
changeset
|
33 |
{ |
d87b21df2944
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents:
diff
changeset
|
34 |
return (s & SLOPE_STEEP) != 0; |
d87b21df2944
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents:
diff
changeset
|
35 |
} |
d87b21df2944
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents:
diff
changeset
|
36 |
|
d87b21df2944
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents:
diff
changeset
|
37 |
static inline Slope ComplementSlope(Slope s) |
d87b21df2944
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents:
diff
changeset
|
38 |
{ |
d87b21df2944
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents:
diff
changeset
|
39 |
assert(!IsSteepSlope(s)); |
d87b21df2944
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents:
diff
changeset
|
40 |
return (Slope)(0xF ^ s); |
d87b21df2944
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents:
diff
changeset
|
41 |
} |
d87b21df2944
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents:
diff
changeset
|
42 |
|
4666
850b5b6e4bac
(svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents:
4344
diff
changeset
|
43 |
#endif /* SLOPE_H */ |