~ubuntu-branches/debian/squeeze/openttd/squeeze

« back to all changes in this revision

Viewing changes to src/pbs.h

  • Committer: Bazaar Package Importer
  • Author(s): Jordi Mallach, Matthijs Kooijman, Jordi Mallach
  • Date: 2009-04-15 18:22:10 UTC
  • mfrom: (1.1.6 upstream) (2.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090415182210-22ktb8kdbp2tf3bm
[ Matthijs Kooijman ]
* New upstream release.
* Remove Debian specific desktop file, upstream provides one now. 
* Add debian/watch file.

[ Jordi Mallach ]
* Bump Standards-Version to 3.8.1, with no changes required.
* Move to debhelper compat 7. Bump Build-Depends accordingly.
* Use dh_prep.
* Add "set -e" to config script.
* Remove a few extra doc files that get installed by upstream Makefile.
* Add more complete copyright information.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: pbs.h 14258 2008-09-07 11:23:10Z rubidium $ */
 
2
 
 
3
/** @file pbs.h PBS support routines */
 
4
 
 
5
#ifndef PBS_H
 
6
#define PBS_H
 
7
 
 
8
#include "tile_type.h"
 
9
#include "direction_type.h"
 
10
#include "track_type.h"
 
11
#include "vehicle_type.h"
 
12
 
 
13
TrackBits GetReservedTrackbits(TileIndex t);
 
14
 
 
15
void SetRailwayStationPlatformReservation(TileIndex start, DiagDirection dir, bool b);
 
16
 
 
17
bool TryReserveRailTrack(TileIndex tile, Track t);
 
18
void UnreserveRailTrack(TileIndex tile, Track t);
 
19
 
 
20
/** This struct contains information about the end of a reserved path. */
 
21
struct PBSTileInfo {
 
22
        TileIndex tile;      ///< Tile the path ends, INVALID_TILE if no valid path was found.
 
23
        Trackdir  trackdir;  ///< The reserved trackdir on the tile.
 
24
        bool      okay;      ///< True if tile is a safe waiting position, false otherwise.
 
25
 
 
26
        PBSTileInfo() : tile(INVALID_TILE), trackdir(INVALID_TRACKDIR), okay(false) {}
 
27
        PBSTileInfo(TileIndex _t, Trackdir _td, bool _okay) : tile(_t), trackdir(_td), okay(_okay) {}
 
28
};
 
29
 
 
30
PBSTileInfo FollowTrainReservation(const Vehicle *v, bool *train_on_res = NULL);
 
31
bool IsSafeWaitingPosition(const Vehicle *v, TileIndex tile, Trackdir trackdir, bool include_line_end, bool forbid_90deg = false);
 
32
bool IsWaitingPositionFree(const Vehicle *v, TileIndex tile, Trackdir trackdir, bool forbid_90deg = false);
 
33
 
 
34
Vehicle *GetTrainForReservation(TileIndex tile, Track track);
 
35
 
 
36
/**
 
37
 * Check whether some of tracks is reserved on a tile.
 
38
 *
 
39
 * @param tile the tile
 
40
 * @param tracks the tracks to test
 
41
 * @return true if at least on of tracks is reserved
 
42
 */
 
43
static inline bool HasReservedTracks(TileIndex tile, TrackBits tracks)
 
44
{
 
45
        return (GetReservedTrackbits(tile) & tracks) != TRACK_BIT_NONE;
 
46
}
 
47
 
 
48
#endif /* PBS_H */