# signal_func.h

Go to the documentation of this file.

    00001 /* $Id: signal_func.h 17248 2009-08-21 20:21:05Z rubidium $ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
    00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
    00008  */
    00009
    00012 #ifndef SIGNAL_FUNC_H
    00013 #define SIGNAL_FUNC_H
    00014
    00015 #include "track_type.h"
    00016 #include "tile_type.h"
    00017 #include "direction_type.h"
    00018 #include "company_type.h"
    00019
    00024 static inline byte SignalAlongTrackdir(Trackdir trackdir)
    00025 {
    00026   extern const byte _signal_along_trackdir[TRACKDIR_END];
    00027   return _signal_along_trackdir[trackdir];
    00028 }
    00029
    00034 static inline byte SignalAgainstTrackdir(Trackdir trackdir)
    00035 {
    00036   extern const byte _signal_against_trackdir[TRACKDIR_END];
    00037   return _signal_against_trackdir[trackdir];
    00038 }
    00039
    00044 static inline byte SignalOnTrack(Track track)
    00045 {
    00046   extern const byte _signal_on_track[TRACK_END];
    00047   return _signal_on_track[track];
    00048 }
    00049
    00051 enum SigSegState {
    00052   SIGSEG_FREE,
    00053   SIGSEG_FULL,
    00054   SIGSEG_PBS,
    00055 };
    00056
    00057 SigSegState UpdateSignalsOnSegment(TileIndex tile, DiagDirection side, Owner owner);
    00058 void SetSignalsOnBothDir(TileIndex tile, Track track, Owner owner);
    00059 void AddTrackToSignalBuffer(TileIndex tile, Track track, Owner owner);
    00060 void AddSideToSignalBuffer(TileIndex tile, DiagDirection side, Owner owner);
    00061 void UpdateSignalsInBuffer();
    00062
    00063 #endif /* SIGNAL_FUNC_H */