summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2005-11-05 18:13:40 +0000
committerpeter1138 <peter1138@openttd.org>2005-11-05 18:13:40 +0000
commit1ad139c9e0373613ce4c9968b9205c089725de1a (patch)
tree7d0ae6e096d4f72e24d9c3bd0645ae626c26017b
parent0d9379f904fcfba284a11ec223fc71a115416b3e (diff)
downloadopenttd-1ad139c9e0373613ce4c9968b9205c089725de1a.tar.xz
(svn r3140) Building/removing a waypoint could leave old PBS reservations behind. This ensures they are cleared.
-rw-r--r--waypoint.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/waypoint.c b/waypoint.c
index b115ad08d..23e1ceaad 100644
--- a/waypoint.c
+++ b/waypoint.c
@@ -205,7 +205,11 @@ int32 CmdBuildTrainWaypoint(int x, int y, uint32 flags, uint32 p1, uint32 p2)
_m[tile].m3 |= 16;
_m[tile].m4 = p1 & 0xff;
}
- if (reserved) PBSReserveTrack(tile, dir);
+ if (reserved) {
+ PBSReserveTrack(tile, dir);
+ } else {
+ PBSClearTrack(tile, dir);
+ }
wp->deleted = 0;
wp->xy = tile;
@@ -279,7 +283,11 @@ int32 RemoveTrainWaypoint(TileIndex tile, uint32 flags, bool justremove)
ModifyTile(tile, MP_MAP5, 1<<direction);
_m[tile].m3 &= ~16;
_m[tile].m4 = 0;
- if (reserved) PBSReserveTrack(tile, direction);
+ if (reserved) {
+ PBSReserveTrack(tile, direction);
+ } else {
+ PBSClearTrack(tile, direction);
+ }
} else {
DoClearSquare(tile);
SetSignalsOnBothDir(tile, direction);