/// <summary>
            ///
            /// </summary>
            /// <param name="d"></param>
            /// <returns></returns>
            public override bool Attach(Direction d)
            {
                byte dirs = pattern.dirs;

                dirs      |= (byte)(1 << (d.index / 2));
                Voxel.road = new RoadImpl(contribution, Voxel, RoadPattern.get(dirs));
                return(true);
            }
        /// <summary>
        ///
        /// </summary>
        /// <param name="from"></param>
        /// <param name="to"></param>
        public override void Build(Location from, Location to)
        {
            Debug.Assert(CanBeBuilt(from, to));

            Direction d = from.getDirectionTo(to);

            Location here = from;

            while (true)
            {
                BaseRoad r = BaseRoad.get(here);
                if (r == null)
                {
                    RoadPattern p = RoadPattern.getStraight(d);
                    if (here == from)
                    {
                        p = RoadPattern.get((byte)(1 << (d.index / 2)));
                    }
                    if (here == to)
                    {
                        p = RoadPattern.get((byte)(1 << (d.opposite.index / 2)));
                    }

                    Create(TrafficVoxel.getOrCreate(here), p);
                }
                else
                {
                    if (here != from)
                    {
                        r.Attach(d.opposite);
                    }
                    if (here != to)
                    {
                        r.Attach(d);
                    }
                }

                if (here == to)
                {
                    return;
                }
                here = here.toward(to);
            }
        }
            /// <summary>
            ///
            /// </summary>
            /// <param name="d1"></param>
            /// <param name="d2"></param>
            public override void Detach(Direction d1, Direction d2)
            {
                byte dirs = pattern.dirs;

                dirs &= (byte)~(1 << (d1.index / 2));
                dirs &= (byte)~(1 << (d2.index / 2));

                if (dirs == 0)
                {
                    // destroy this road
                    Voxel.road = null;
                }
                else
                {
                    Voxel.road = new RoadImpl(contribution, Voxel, RoadPattern.get(dirs));
                }

                WorldDefinition.World.OnVoxelUpdated(Location);
            }