author | rubidium |
Tue, 22 Jan 2008 21:00:30 +0000 | |
branch | NewGRF_ports |
changeset 6872 | 1c4a4a609f85 |
child 10724 | 68a692eacf22 |
permissions | -rw-r--r-- |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
1 |
/* $Id$ */ |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
2 |
|
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
3 |
/** @file signal_func.h Functions related to signals. */ |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
4 |
|
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
5 |
#ifndef SIGNAL_FUNC_H |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
6 |
#define SIGNAL_FUNC_H |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
7 |
|
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
8 |
#include "track_type.h" |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
9 |
#include "tile_type.h" |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
10 |
#include "direction_type.h" |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
11 |
#include "track_type.h" |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
12 |
#include "player_type.h" |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
13 |
|
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
14 |
/** |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
15 |
* Maps a trackdir to the bit that stores its status in the map arrays, in the |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
16 |
* direction along with the trackdir. |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
17 |
*/ |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
18 |
static inline byte SignalAlongTrackdir(Trackdir trackdir) |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
19 |
{ |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
20 |
extern const byte _signal_along_trackdir[TRACKDIR_END]; |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
21 |
return _signal_along_trackdir[trackdir]; |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
22 |
} |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
23 |
|
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
24 |
/** |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
25 |
* Maps a trackdir to the bit that stores its status in the map arrays, in the |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
26 |
* direction against the trackdir. |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
27 |
*/ |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
28 |
static inline byte SignalAgainstTrackdir(Trackdir trackdir) |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
29 |
{ |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
30 |
extern const byte _signal_against_trackdir[TRACKDIR_END]; |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
31 |
return _signal_against_trackdir[trackdir]; |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
32 |
} |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
33 |
|
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
34 |
/** |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
35 |
* Maps a Track to the bits that store the status of the two signals that can |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
36 |
* be present on the given track. |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
37 |
*/ |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
38 |
static inline byte SignalOnTrack(Track track) |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
39 |
{ |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
40 |
extern const byte _signal_on_track[TRACK_END]; |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
41 |
return _signal_on_track[track]; |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
42 |
} |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
43 |
|
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
44 |
bool UpdateSignalsOnSegment(TileIndex tile, DiagDirection side, Owner owner); |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
45 |
void SetSignalsOnBothDir(TileIndex tile, Track track, Owner owner); |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
46 |
void AddTrackToSignalBuffer(TileIndex tile, Track track, Owner owner); |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
47 |
void AddSideToSignalBuffer(TileIndex tile, DiagDirection side, Owner owner); |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
48 |
void UpdateSignalsInBuffer(); |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
49 |
|
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
diff
changeset
|
50 |
#endif /* SIGNAL_FUNC_H */ |