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
commit0412040bcc6709713f3d8acfc466c03f5ddbb02f (patch)
tree7d0ae6e096d4f72e24d9c3bd0645ae626c26017b
parent267314b4d0a28ac8a9d5b0d44a7c6dcd7ef88ac1 (diff)
downloadopenttd-0412040bcc6709713f3d8acfc466c03f5ddbb02f.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);