road_gui.c
changeset 3151 78f09b2c72c5
parent 3150 025fe8cd7104
child 3491 4c8427796c64
equal deleted inserted replaced
3150:025fe8cd7104 3151:78f09b2c72c5
    66 static void PlaceRoad_Tunnel(TileIndex tile)
    66 static void PlaceRoad_Tunnel(TileIndex tile)
    67 {
    67 {
    68 	DoCommandP(tile, 0x200, 0, CcBuildRoadTunnel, CMD_BUILD_TUNNEL | CMD_AUTO | CMD_MSG(STR_5016_CAN_T_BUILD_TUNNEL_HERE));
    68 	DoCommandP(tile, 0x200, 0, CcBuildRoadTunnel, CMD_BUILD_TUNNEL | CMD_AUTO | CMD_MSG(STR_5016_CAN_T_BUILD_TUNNEL_HERE));
    69 }
    69 }
    70 
    70 
    71 static void BuildRoadOutsideStation(TileIndex tile, int direction)
    71 static void BuildRoadOutsideStation(TileIndex tile, DiagDirection direction)
    72 {
    72 {
    73 	static const byte _roadbits_by_dir[4] = {2,1,8,4};
       
    74 	tile += TileOffsByDir(direction);
    73 	tile += TileOffsByDir(direction);
    75 	// if there is a roadpiece just outside of the station entrance, build a connecting route
    74 	// if there is a roadpiece just outside of the station entrance, build a connecting route
    76 	if (IsTileType(tile, MP_STREET) && GetRoadType(tile) == ROAD_NORMAL) {
    75 	if (IsTileType(tile, MP_STREET) && GetRoadType(tile) == ROAD_NORMAL) {
    77 		DoCommandP(tile, _roadbits_by_dir[direction], 0, NULL, CMD_BUILD_ROAD);
    76 		DoCommandP(tile, DiagDirToRoadBits(ReverseDiagDir(direction)), 0, NULL, CMD_BUILD_ROAD);
    78 	}
    77 	}
    79 }
    78 }
    80 
    79 
    81 void CcRoadDepot(bool success, TileIndex tile, uint32 p1, uint32 p2)
    80 void CcRoadDepot(bool success, TileIndex tile, uint32 p1, uint32 p2)
    82 {
    81 {
    83 	if (success) {
    82 	if (success) {
    84 		SndPlayTileFx(SND_1F_SPLAT, tile);
    83 		SndPlayTileFx(SND_1F_SPLAT, tile);
    85 		ResetObjectToPlace();
    84 		ResetObjectToPlace();
    86 		BuildRoadOutsideStation(tile, (int)p1);
    85 		BuildRoadOutsideStation(tile, p1);
    87 	}
    86 	}
    88 }
    87 }
    89 
    88 
    90 static void PlaceRoad_Depot(TileIndex tile)
    89 static void PlaceRoad_Depot(TileIndex tile)
    91 {
    90 {