summaryrefslogtreecommitdiff
path: root/road_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-03-01 08:56:38 +0000
committertron <tron@openttd.org>2006-03-01 08:56:38 +0000
commitb404072ccc43fad529e8cf13532e646d3d4767d5 (patch)
treec9a6270610c574618ee43157834cb8fe59329fe0 /road_cmd.c
parent6c1576143bb031c7c0ebb94f6b45dc6ce007382f (diff)
downloadopenttd-b404072ccc43fad529e8cf13532e646d3d4767d5.tar.xz
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
Diffstat (limited to 'road_cmd.c')
-rw-r--r--road_cmd.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/road_cmd.c b/road_cmd.c
index 589b274ef..3b2c8164e 100644
--- a/road_cmd.c
+++ b/road_cmd.c
@@ -2,6 +2,7 @@
#include "stdafx.h"
#include "openttd.h"
+#include "rail_map.h"
#include "road.h"
#include "table/sprites.h"
#include "table/strings.h"
@@ -234,26 +235,22 @@ int32 CmdRemoveRoad(int x, int y, uint32 flags, uint32 p1, uint32 p2)
}
case ROAD_CROSSING: {
- byte c;
+ TrackBits track;
if (!(ti.map5 & 8)) {
- c = 2;
if (pieces & ROAD_Y) goto return_error;
+ track = TRACK_BIT_DIAG2;
} else {
- c = 1;
if (pieces & ROAD_X) goto return_error;
+ track = TRACK_BIT_DIAG1;
}
cost = _price.remove_road * 2;
if (flags & DC_EXEC) {
ChangeTownRating(t, -road_remove_cost[(byte)edge_road], RATING_ROAD_MINIMUM);
- ModifyTile(tile,
- MP_SETTYPE(MP_RAILWAY) |
- MP_MAP2_CLEAR | MP_MAP3LO | MP_MAP3HI_CLEAR | MP_MAP5,
- _m[tile].m4 & 0xF, /* map3_lo */
- c /* map5 */
- );
+ MakeRailNormal(tile, GetTileOwner(tile), track, GB(_m[tile].m4, 0, 4));
+ MarkTileDirtyByTile(tile);
}
return cost;
}