author | peter1138 |
Sun, 03 Aug 2008 17:35:08 +0000 | |
changeset 9834 | 7474149531c1 |
parent 9818 | bec6961fb6b6 |
child 10208 | 72c00af5c95d |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
8138
dbfdc08fa6b9
(svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents:
8123
diff
changeset
|
3 |
/** @file signal_func.h Functions related to signals. */ |
2274
2c99425c1086
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2254
diff
changeset
|
4 |
|
8138
dbfdc08fa6b9
(svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents:
8123
diff
changeset
|
5 |
#ifndef SIGNAL_FUNC_H |
dbfdc08fa6b9
(svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents:
8123
diff
changeset
|
6 |
#define SIGNAL_FUNC_H |
2254
99de94953104
(svn r2774) -Codechange: Removed TRACKTYPE_SPRITE_PITCH globally and replaced it by a member of RailtypeInfo
celestar
parents:
2236
diff
changeset
|
7 |
|
8138
dbfdc08fa6b9
(svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents:
8123
diff
changeset
|
8 |
#include "track_type.h" |
8238
d47a86c79603
(svn r11802) -Fix [FS#716]: do not crash trains when leaving depot to a very long track
smatz
parents:
8138
diff
changeset
|
9 |
#include "tile_type.h" |
d47a86c79603
(svn r11802) -Fix [FS#716]: do not crash trains when leaving depot to a very long track
smatz
parents:
8138
diff
changeset
|
10 |
#include "direction_type.h" |
d47a86c79603
(svn r11802) -Fix [FS#716]: do not crash trains when leaving depot to a very long track
smatz
parents:
8138
diff
changeset
|
11 |
#include "track_type.h" |
8300
dfd530665621
(svn r11864) -Codechange: pass owner whose signals we will update instead of complex detection later
smatz
parents:
8238
diff
changeset
|
12 |
#include "player_type.h" |
1942
c5d5cf5b0263
(svn r2448) General cleanup of rail related code, more to follow.
matthijs
parents:
diff
changeset
|
13 |
|
c5d5cf5b0263
(svn r2448) General cleanup of rail related code, more to follow.
matthijs
parents:
diff
changeset
|
14 |
/** |
c5d5cf5b0263
(svn r2448) General cleanup of rail related code, more to follow.
matthijs
parents:
diff
changeset
|
15 |
* Maps a trackdir to the bit that stores its status in the map arrays, in the |
c5d5cf5b0263
(svn r2448) General cleanup of rail related code, more to follow.
matthijs
parents:
diff
changeset
|
16 |
* direction along with the trackdir. |
c5d5cf5b0263
(svn r2448) General cleanup of rail related code, more to follow.
matthijs
parents:
diff
changeset
|
17 |
*/ |
6162
798086a4c251
(svn r8912) -Codechange: coding style cleanup and moving of two global externs into the functions that use them.
rubidium
parents:
6156
diff
changeset
|
18 |
static inline byte SignalAlongTrackdir(Trackdir trackdir) |
798086a4c251
(svn r8912) -Codechange: coding style cleanup and moving of two global externs into the functions that use them.
rubidium
parents:
6156
diff
changeset
|
19 |
{ |
798086a4c251
(svn r8912) -Codechange: coding style cleanup and moving of two global externs into the functions that use them.
rubidium
parents:
6156
diff
changeset
|
20 |
extern const byte _signal_along_trackdir[TRACKDIR_END]; |
798086a4c251
(svn r8912) -Codechange: coding style cleanup and moving of two global externs into the functions that use them.
rubidium
parents:
6156
diff
changeset
|
21 |
return _signal_along_trackdir[trackdir]; |
798086a4c251
(svn r8912) -Codechange: coding style cleanup and moving of two global externs into the functions that use them.
rubidium
parents:
6156
diff
changeset
|
22 |
} |
1942
c5d5cf5b0263
(svn r2448) General cleanup of rail related code, more to follow.
matthijs
parents:
diff
changeset
|
23 |
|
c5d5cf5b0263
(svn r2448) General cleanup of rail related code, more to follow.
matthijs
parents:
diff
changeset
|
24 |
/** |
c5d5cf5b0263
(svn r2448) General cleanup of rail related code, more to follow.
matthijs
parents:
diff
changeset
|
25 |
* Maps a trackdir to the bit that stores its status in the map arrays, in the |
c5d5cf5b0263
(svn r2448) General cleanup of rail related code, more to follow.
matthijs
parents:
diff
changeset
|
26 |
* direction against the trackdir. |
c5d5cf5b0263
(svn r2448) General cleanup of rail related code, more to follow.
matthijs
parents:
diff
changeset
|
27 |
*/ |
6162
798086a4c251
(svn r8912) -Codechange: coding style cleanup and moving of two global externs into the functions that use them.
rubidium
parents:
6156
diff
changeset
|
28 |
static inline byte SignalAgainstTrackdir(Trackdir trackdir) |
798086a4c251
(svn r8912) -Codechange: coding style cleanup and moving of two global externs into the functions that use them.
rubidium
parents:
6156
diff
changeset
|
29 |
{ |
1948
d95a69e8c560
(svn r2454) * Codechange: Move #include "stdafx.h" and "openttd.h" from rail.h to rail.c
matthijs
parents:
1947
diff
changeset
|
30 |
extern const byte _signal_against_trackdir[TRACKDIR_END]; |
d95a69e8c560
(svn r2454) * Codechange: Move #include "stdafx.h" and "openttd.h" from rail.h to rail.c
matthijs
parents:
1947
diff
changeset
|
31 |
return _signal_against_trackdir[trackdir]; |
d95a69e8c560
(svn r2454) * Codechange: Move #include "stdafx.h" and "openttd.h" from rail.h to rail.c
matthijs
parents:
1947
diff
changeset
|
32 |
} |
1942
c5d5cf5b0263
(svn r2448) General cleanup of rail related code, more to follow.
matthijs
parents:
diff
changeset
|
33 |
|
c5d5cf5b0263
(svn r2448) General cleanup of rail related code, more to follow.
matthijs
parents:
diff
changeset
|
34 |
/** |
c5d5cf5b0263
(svn r2448) General cleanup of rail related code, more to follow.
matthijs
parents:
diff
changeset
|
35 |
* Maps a Track to the bits that store the status of the two signals that can |
c5d5cf5b0263
(svn r2448) General cleanup of rail related code, more to follow.
matthijs
parents:
diff
changeset
|
36 |
* be present on the given track. |
c5d5cf5b0263
(svn r2448) General cleanup of rail related code, more to follow.
matthijs
parents:
diff
changeset
|
37 |
*/ |
6162
798086a4c251
(svn r8912) -Codechange: coding style cleanup and moving of two global externs into the functions that use them.
rubidium
parents:
6156
diff
changeset
|
38 |
static inline byte SignalOnTrack(Track track) |
798086a4c251
(svn r8912) -Codechange: coding style cleanup and moving of two global externs into the functions that use them.
rubidium
parents:
6156
diff
changeset
|
39 |
{ |
1948
d95a69e8c560
(svn r2454) * Codechange: Move #include "stdafx.h" and "openttd.h" from rail.h to rail.c
matthijs
parents:
1947
diff
changeset
|
40 |
extern const byte _signal_on_track[TRACK_END]; |
d95a69e8c560
(svn r2454) * Codechange: Move #include "stdafx.h" and "openttd.h" from rail.h to rail.c
matthijs
parents:
1947
diff
changeset
|
41 |
return _signal_on_track[track]; |
d95a69e8c560
(svn r2454) * Codechange: Move #include "stdafx.h" and "openttd.h" from rail.h to rail.c
matthijs
parents:
1947
diff
changeset
|
42 |
} |
1942
c5d5cf5b0263
(svn r2448) General cleanup of rail related code, more to follow.
matthijs
parents:
diff
changeset
|
43 |
|
9222
78f27b94fe76
(svn r13088) -Codechange: use SigSegState enum instead of bool variable (michi_cc)
smatz
parents:
8306
diff
changeset
|
44 |
/** State of the signal segment */ |
78f27b94fe76
(svn r13088) -Codechange: use SigSegState enum instead of bool variable (michi_cc)
smatz
parents:
8306
diff
changeset
|
45 |
enum SigSegState { |
78f27b94fe76
(svn r13088) -Codechange: use SigSegState enum instead of bool variable (michi_cc)
smatz
parents:
8306
diff
changeset
|
46 |
SIGSEG_FREE, ///< Free and has no pre-signal exits or at least one green exit |
78f27b94fe76
(svn r13088) -Codechange: use SigSegState enum instead of bool variable (michi_cc)
smatz
parents:
8306
diff
changeset
|
47 |
SIGSEG_FULL, ///< Occupied by a train |
9818
bec6961fb6b6
(svn r13960) -Codechange [YAPP]: Reserve a path when exiting a depot into a PBS block. (michi_cc)
rubidium
parents:
9222
diff
changeset
|
48 |
SIGSEG_PBS, ///< Segment is a PBS segment |
9222
78f27b94fe76
(svn r13088) -Codechange: use SigSegState enum instead of bool variable (michi_cc)
smatz
parents:
8306
diff
changeset
|
49 |
}; |
78f27b94fe76
(svn r13088) -Codechange: use SigSegState enum instead of bool variable (michi_cc)
smatz
parents:
8306
diff
changeset
|
50 |
|
78f27b94fe76
(svn r13088) -Codechange: use SigSegState enum instead of bool variable (michi_cc)
smatz
parents:
8306
diff
changeset
|
51 |
SigSegState UpdateSignalsOnSegment(TileIndex tile, DiagDirection side, Owner owner); |
8300
dfd530665621
(svn r11864) -Codechange: pass owner whose signals we will update instead of complex detection later
smatz
parents:
8238
diff
changeset
|
52 |
void SetSignalsOnBothDir(TileIndex tile, Track track, Owner owner); |
8306
22e1344c5457
(svn r11871) -Fix [FS#1074]: do not update signals after each tile when building/removing a large block of track/signals/station
smatz
parents:
8300
diff
changeset
|
53 |
void AddTrackToSignalBuffer(TileIndex tile, Track track, Owner owner); |
22e1344c5457
(svn r11871) -Fix [FS#1074]: do not update signals after each tile when building/removing a large block of track/signals/station
smatz
parents:
8300
diff
changeset
|
54 |
void AddSideToSignalBuffer(TileIndex tile, DiagDirection side, Owner owner); |
22e1344c5457
(svn r11871) -Fix [FS#1074]: do not update signals after each tile when building/removing a large block of track/signals/station
smatz
parents:
8300
diff
changeset
|
55 |
void UpdateSignalsInBuffer(); |
8238
d47a86c79603
(svn r11802) -Fix [FS#716]: do not crash trains when leaving depot to a very long track
smatz
parents:
8138
diff
changeset
|
56 |
|
8138
dbfdc08fa6b9
(svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents:
8123
diff
changeset
|
57 |
#endif /* SIGNAL_FUNC_H */ |