author | rubidium |
Fri, 25 Apr 2008 15:22:32 +0000 | |
changeset 9055 | 4dc6a0c0ef47 |
parent 8306 | 22e1344c5457 |
child 9222 | 78f27b94fe76 |
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 |
|
8300
dfd530665621
(svn r11864) -Codechange: pass owner whose signals we will update instead of complex detection later
smatz
parents:
8238
diff
changeset
|
44 |
bool UpdateSignalsOnSegment(TileIndex tile, DiagDirection side, Owner owner); |
dfd530665621
(svn r11864) -Codechange: pass owner whose signals we will update instead of complex detection later
smatz
parents:
8238
diff
changeset
|
45 |
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
|
46 |
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
|
47 |
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
|
48 |
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
|
49 |
|
8138
dbfdc08fa6b9
(svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents:
8123
diff
changeset
|
50 |
#endif /* SIGNAL_FUNC_H */ |