summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2005-10-21 06:04:17 +0000
committerpeter1138 <peter1138@openttd.org>2005-10-21 06:04:17 +0000
commit5565abb871d580eecb502bdf3c5120227d6a81a8 (patch)
tree1841da79e58a5641f3b72cf09524ec6849283785
parent8bf11c2e41dd2af55b6ed28bbf7eb03650335335 (diff)
downloadopenttd-5565abb871d580eecb502bdf3c5120227d6a81a8.tar.xz
(svn r3075) -PBS: Keep track reservation state while building and removing a waypoint.
-rw-r--r--waypoint.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/waypoint.c b/waypoint.c
index a2e46fdf8..b115ad08d 100644
--- a/waypoint.c
+++ b/waypoint.c
@@ -14,6 +14,7 @@
#include "town.h"
#include "waypoint.h"
#include "variables.h"
+#include "pbs.h"
#include "table/sprites.h"
#include "table/strings.h"
@@ -197,12 +198,14 @@ int32 CmdBuildTrainWaypoint(int x, int y, uint32 flags, uint32 p1, uint32 p2)
}
if (flags & DC_EXEC) {
+ bool reserved = PBSTileReserved(tile) != 0;
ModifyTile(tile, MP_MAP5, RAIL_TYPE_WAYPOINT | dir);
if (--p1 & 0x100) { // waypoint type 0 uses default graphics
// custom graphics
_m[tile].m3 |= 16;
_m[tile].m4 = p1 & 0xff;
}
+ if (reserved) PBSReserveTrack(tile, dir);
wp->deleted = 0;
wp->xy = tile;
@@ -272,9 +275,11 @@ int32 RemoveTrainWaypoint(TileIndex tile, uint32 flags, bool justremove)
RedrawWaypointSign(wp);
if (justremove) {
+ bool reserved = PBSTileReserved(tile) != 0;
ModifyTile(tile, MP_MAP5, 1<<direction);
_m[tile].m3 &= ~16;
_m[tile].m4 = 0;
+ if (reserved) PBSReserveTrack(tile, direction);
} else {
DoClearSquare(tile);
SetSignalsOnBothDir(tile, direction);