summaryrefslogtreecommitdiff
path: root/pbs.h
diff options
context:
space:
mode:
authorhackykid <hackykid@openttd.org>2005-07-04 14:58:55 +0000
committerhackykid <hackykid@openttd.org>2005-07-04 14:58:55 +0000
commitab9c6f126d54f6edd1464c57bf338cf68965e657 (patch)
treec0f8f7ba8535ff0f5e9fd8581b36c737ac10e0b1 /pbs.h
parentd07e1a875e1d708505aa6958c7cc9a60fc2490d1 (diff)
downloadopenttd-ab9c6f126d54f6edd1464c57bf338cf68965e657.tar.xz
(svn r2516) - Feature: [pbs] Implement path-based-signalling. This allows multiple trains within the same signal block, provided their paths dont intersect. For this the block must have all exit and entry signals be pbs signals. Place these by ctrl-clicking 4 times on a normal signal.
- Feature: [pbs] Implement autoplacement of pbs blocks, when a block has an entry and an exit pbs signal, covert the entire block to pbs. Can be turned off in the patch settings. - Feature: [pbs] Allow showing of reserved status by making the tracks darker, when the pbs debug level is at least 1.
Diffstat (limited to 'pbs.h')
-rw-r--r--pbs.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/pbs.h b/pbs.h
new file mode 100644
index 000000000..398bd73d9
--- /dev/null
+++ b/pbs.h
@@ -0,0 +1,82 @@
+#ifndef PBS_H
+#define PBS_H
+
+/** @file pbs.h Path-Based-Signalling header file
+ * @see pbs.c */
+
+#include "vehicle.h"
+#include "tile.h"
+#include "map.h"
+#include "rail.h"
+
+/**
+ * constants used for pbs_mode argument of npf-functions
+ */
+enum pbs_modes {
+ PBS_MODE_NONE = 0, // no pbs
+ PBS_MODE_GREEN = 1, // look for green exit signal from pbs block
+ PBS_MODE_ANY = 2, // look for any exit signal from block
+};
+
+/**
+ * constants used for v->u.rail.pbs_status
+ */
+enum PBSStatus {
+ PBS_STAT_NONE = 0,
+ PBS_STAT_HAS_PATH = 1,
+ PBS_STAT_NEED_PATH = 2,
+};
+
+
+void PBSReserveTrack(TileIndex tile, Track track);
+/**<
+ * Marks a track as reserved.
+ * @param tile The tile of the track.
+ * @param track The track to reserve, valid values 0-5.
+ */
+
+byte PBSTileReserved(TileIndex tile);
+/**<
+ * Check which tracks are reserved on a tile.
+ * @param tile The tile which you want to check.
+ * @return The tracks reserved on that tile, each of the bits 0-5 is set when the corresponding track is reserved.
+ */
+
+uint16 PBSTileUnavail(TileIndex tile);
+/**<
+ * Check which trackdirs are unavailable due to reserved tracks on a tile.
+ * @param tile The tile which you want to check.
+ * @return The tracks reserved on that tile, each of the bits 0-5,8-13 is set when the corresponding trackdir is unavailable.
+ */
+
+void PBSClearTrack(TileIndex tile, Track track);
+/**<
+ * Unreserves a track.
+ * @param tile The tile of the track.
+ * @param track The track to unreserve, valid values 0-5.
+ */
+
+void PBSClearPath(TileIndex tile, Trackdir trackdir);
+/**<
+ * Follows a planned(reserved) path, and unreserves the tracks.
+ * @param tile The tile on which the path starts
+ * @param trackdir The trackdirection in which the path starts
+ */
+
+bool PBSIsPbsSignal(TileIndex tile, Trackdir trackdir);
+/**<
+ * Checks if there are pbs signals on a track.
+ * @param tile The tile you want to check
+ * @param trackdir The trackdir you want to check
+ * @return True when there are pbs signals on that tile
+ */
+
+bool PBSIsPbsDepot(uint tile);
+/**<
+ * Checks if a depot is inside a pbs block.
+ * Tis means that the block it is in needs to have at least 1 signal, and that all signals in it need to be pbs signals.
+ * @param tile The depot tile to check
+ * @return True when the depot is inside a pbs block.
+ */
+
+#endif