コード例 #1
0
		public BitmapImage this[TileIndex id]
		{
			get
			{
				return cache[id];
			}
		}
コード例 #2
0
		public void BeginSaveImage(TileIndex id, BitmapImage image)
		{
			string imagePath = GetImagePath(id);

			bool errorWhileDeleting = false;

			bool containsOld = Contains(id);
			if (containsOld && saveOption == SaveOption.ForceUpdate)
				try
				{
					File.Delete(imagePath);
				}
				catch (IOException exc)
				{
					// todo возможно, тут добавить файл в очередь на удаление или перезапись новым содержимым
					// когда он перестанет быть блокированным
					Debug.WriteLine(String.Format("{0} - error while deleting tile {1}: {2}", Name, id, exc.Message));
					errorWhileDeleting = true;
				}

			bool shouldSave = saveOption == SaveOption.ForceUpdate && !errorWhileDeleting ||
				saveOption == SaveOption.PreserveOld && !containsOld;
			if (shouldSave)
			{
				Debug.WriteLine("Began to save id = " + id);

				Statistics.IntValues["ImagesSaved"]++;

				ImageSaver saver = ScreenshotHelper.SaveBitmapToFile;
				saver.BeginInvoke((BitmapImage)image.GetAsFrozen(), imagePath, null, null);
			}
		}
コード例 #3
0
		public override void BeginLoadImage(TileIndex id)
		{
			if (Contains(id))
				ReportSuccess(cache[id], id);
			else
				ReportFailure(id);
		}
コード例 #4
0
		public BitmapSource this[TileIndex id]
		{
			get
			{
				return (BitmapSource)cache[id].Target;
			}
		}
コード例 #5
0
		protected sealed override string CreateRequestUriCore(TileIndex index)
		{
			string indexString = CreateTileIndexString(index);

			string res = String.Format(UriFormat, CurrentServer, indexString);
			return res;
		}
コード例 #6
0
        protected override string CreateRequestUriCore(TileIndex index)
		{
			int z = (int)index.Level;
			int shift = MapTileProvider.GetSideTilesCount(z) / 2;
			int x = index.X + shift;
			int y = MapTileProvider.GetSideTilesCount(z) - 1 - index.Y - shift;

			char serverIdx = (char)('a' + CurrentServer);
			string uri = "";
			switch (renderer)
			{
				case OpenStreetMapRenderer.Mapnik:
					uri = "tile.openstreetmap.org";
					break;
				case OpenStreetMapRenderer.Osmarenderer:
					uri = "tah.openstreetmap.org/Tiles/tile";
					break;
				case OpenStreetMapRenderer.CycleMap:
					uri = "andy.sandbox.cloudmade.com/tiles/cycle";
					break;
				case OpenStreetMapRenderer.NoName:
					uri = "tile.cloudmade.com/fd093e52f0965d46bb1c6c6281022199/3/256";
					break;
				default:
					break;
			}

			return String.Format(UriFormat, z.ToString(), x.ToString(), y.ToString(), serverIdx.ToString(), uri);
		}
コード例 #7
0
		public override void BeginLoadImage(TileIndex id)
		{
			if (CanLoadFast(id))
				resourceServer.BeginLoadImage(id);
			else
				base.BeginLoadImage(id);
		}
コード例 #8
0
        protected void BeginLoadBitmapImpl(Stream stream, TileIndex id)
        {
            Dispatcher.BeginInvoke((Action)(() =>
            {
                BitmapImage bmp = new BitmapImage();
                SubscribeBitmapEvents(bmp);
                pendingBitmaps.Add(bmp, id);

                MemoryStream memStream = new MemoryStream();
                stream.CopyTo(memStream);
                memStream.Seek(0, SeekOrigin.Begin);
                stream.Dispose();

                bmp.BeginInit();
                bmp.StreamSource = memStream;
                bmp.CacheOption = BitmapCacheOption.OnLoad;
                bmp.EndInit();

                if (!bmp.IsDownloading)
                {
                    UnsubscribeBitmapEvents(bmp);
                    ReportSuccess(memStream, bmp, id);
                    pendingBitmaps.Remove(bmp);
                    bmp.Freeze();
                }
            }));
        }
コード例 #9
0
		protected override string CreateRequestUriCore(TileIndex index)
		{
			int level = (int)index.Level;
			int x = index.X;
			int y = index.Y;

			return String.Format(UriFormat, level.ToString(), x.ToString(), y.ToString());
		}
コード例 #10
0
		public override bool Contains(TileIndex id)
		{
			if (!metadataRequestSent)
			{
				SendMetadataRequest();
			}
			return loaded && base.Contains(id);
		}
コード例 #11
0
		public override bool Contains(TileIndex id)
		{
			string path = pathProvider.GetTilePath(id) + extension;
			Uri uri = GetPartUri(path);

			bool exists = package.PartExists(uri);
			return exists;
		}
コード例 #12
0
		protected override void ReportFailure(TileIndex id)
		{
			runningDownloadsNum--;

			BeginLoadImageFromQueue();

			base.ReportFailure(id);
		}
コード例 #13
0
		protected override string CreateRequestUriCore(TileIndex index)
		{
			int x = index.X;
			int y = MapTileProvider.GetSideTilesCount(index.Level) - 1 - index.Y;
			int z = (int)index.Level;
			string uri = String.Format(UriFormat, x, y, z);
			return uri;
		}
コード例 #14
0
		protected override string CreateRequestUriCore(TileIndex index)
		{
			int level = (int)index.Level;
            var y = MapTileProvider.GetSideTilesCount(level) / 2 + index.Y;
            var x = MapTileProvider.GetSideTilesCount(level) / 2 + index.X;
			string uri = String.Format(UriFormat, CurrentServer, level, x, y);
			return uri;
		}
コード例 #15
0
		public void BeginSaveImage(TileIndex id, BitmapSource image, Stream stream)
		{
            if (image == null)
                throw new ArgumentNullException("image");

			cache[id] = new WeakReference(image);
			Statistics.IntValues["ImagesSaved"]++;
		}
コード例 #16
0
		protected override string CreateRequestUri(TileIndex index)
		{
			int z = index.Level;
			int x = index.X;
			int y = MapTileProvider.GetSideTilesNum(z) - 1 - index.Y;

			return String.Format(UriFormat, z, x, y);
		}
コード例 #17
0
		private string CreateResourceName(TileIndex id)
		{
			StringBuilder builder = new StringBuilder(currentPrefix);
			builder = builder.Append(id.Level).Append(".").Append(id.X).Append("x")
				.Append(id.Y).Append(fileExtension);

			return builder.ToString();
		}
コード例 #18
0
		public override string GetTilePath(TileIndex id)
		{
			StringBuilder builder = new StringBuilder("z");

			builder = builder.Append(id.Level).Append(Path.DirectorySeparatorChar).Append(id.X).Append('x').Append(id.Y);

			return builder.ToString();
		}
コード例 #19
0
        public void BeginSaveImage(TileIndex id, BitmapSource image, Stream stream)
        {
            string imagePath = GetImagePath(id);

            bool errorWhileDeleting = false;

            bool containsOld = Contains(id);
            if (containsOld && saveOption == SaveOption.ForceUpdate)
            {
                try
                {
                    File.Delete(imagePath);
                }
                catch (IOException exc)
                {
                    // todo возможно, тут добавить файл в очередь на удаление или перезапись новым содержимым
                    // когда он перестанет быть блокированным
                    MapsTraceSource.Instance.ServerInformationTraceSource.TraceInformation("{0} - error while deleting tile {1}: {2}", ServerName, id, exc.Message);
                    errorWhileDeleting = true;
                }
            }

            bool shouldSave = saveOption == SaveOption.ForceUpdate && !errorWhileDeleting ||
                saveOption == SaveOption.PreserveOld && !containsOld;
            if (shouldSave)
            {
                MapsTraceSource.Instance.ServerInformationTraceSource.TraceInformation(String.Format("{0}: begin to save: id = {1}", ServerName, id));
                FileMap[id] = true;

                Statistics.IntValues["ImagesSaved"]++;

                BitmapSource bmp = image;
                if (!bmp.IsFrozen) { 
                }

                ThreadPool.QueueUserWorkItem(new WaitCallback((unused) =>
                {
                    // Try to write tile to cache. Conflicts are possible
                    // especially in case of multiple Map control instances.
                    // That's why exception is only dumped to debug output.
                    try 
                    {
                        if (stream == null)
                        {
                            ScreenshotHelper.SaveBitmapToFile(bmp, imagePath);
                        }
                        else
                        {
                            ScreenshotHelper.SaveStreamToFile(stream, imagePath);
                        }
                    }
                    catch (Exception exc)
                    {
                        Debug.WriteLine(String.Format("Error writing tile to cache: {0}", exc.Message));
                    }
                }));
            }
        }
コード例 #20
0
        protected override string GetNameByIndex(TileIndex index)
        {
            int level = (int)index.Level;
            int x = index.X; //MapTileProvider.GetSideTilesCount(level) + index.X - 1;
            int y = index.Y; //MapTileProvider.GetSideTilesCount(level) - index.Y - 2;

            var result = String.Format("{0}_{1}", x.ToString(), y.ToString());
            return result;
        }
コード例 #21
0
		private void Start() {
			// Use large system be default
			_currentSystem = largeSystem;
			_usingLarge = true;
			_brush = largeBrush;

			// Ignore last painted state
			_lastPainted = new TileIndex(-1, -1);
		}
コード例 #22
0
		protected string GetImagePath(TileIndex index)
		{
			string id = GetNameByIndex(index);

			string zoomDirPath = GetZoomDir(index.Level);
			string imagePath = Path.Combine(zoomDirPath, GetFileName(id));

			return imagePath;
		}
コード例 #23
0
		public void TestGetLowerTile()
		{
			var tile = new TileIndex(-1, -1, 1);
			var lowerTile = tile.GetLowerTile();

			Assert.AreEqual(new TileIndex(-1, -1, 0), lowerTile);

			Assert.AreEqual(new TileIndex(0, 0, 0), new TileIndex(1, 1, 1).GetLowerTile());
		}
コード例 #24
0
		protected override string CreateRequestUriCore(TileIndex index)
		{
			int x = index.X;
			int y = index.Y - MapTileProvider.GetSideTilesCount(index.Level) / 2;
			int z = (int)(index.Level + 1);

			string uri = String.Format(UriFormat, x, y, z, CurrentServer);
			return uri;
		}
コード例 #25
0
		public Rect GetBounds(TileIndex tile)
		{
			double width = GetTileWidth(tile.Level);
			double height = GetTileHeight(tile.Level);
			double x = minX + tile.X * width;
			double y = minY + tile.Y * height;

			Rect bounds = new Rect(x, y, width, height);
			return bounds;
		}
コード例 #26
0
		protected void ReportSuccess(BitmapImage bmp, TileIndex id)
		{
			Debug.WriteLine(String.Format("{0}: loaded id = {1}", Name, id));
			RaiseDataLoaded(new TileLoadResultEventArgs
			{
				Image = bmp,
				Result = TileLoadResult.Success,
				ID = id
			});
		}
コード例 #27
0
		protected void ReportFailure(TileIndex id)
		{
			Debug.WriteLine(String.Format("{0}: failed id = {1}", Name, id));
			RaiseDataLoaded(new TileLoadResultEventArgs
			{
				Image = null,
				ID = id,
				Result = TileLoadResult.Failure
			});
		}
コード例 #28
0
		public static DataRect GetTileBoundsGeneric(TileIndex tile)
		{
			double width = 360.0 / Math.Pow(2, tile.Level);
			double height = 174.0 / Math.Pow(2, tile.Level);
			double x = /*minX*/0 + tile.X * width;
			double y = /*minY*/0 + tile.Y * height;

			DataRect bounds = new DataRect(x, y, width, height);
			return bounds;
		}
コード例 #29
0
		protected override string CreateRequestUriCore(TileIndex index)
		{
			var uri = base.CreateRequestUriCore(index);

			DateTime now = TrafficTime;

			int oldSeconds = GetRoundedJamsTime(now);

			uri = uri.Replace("#3#", oldSeconds.ToString());
			return uri;
		}
コード例 #30
0
		public override void BeginLoadImage(TileIndex id)
		{
			if (Contains(id))
			{
				var img = (BitmapSource)cache[id].Target;
				ReportSuccess(img, id);
			}
			else
			{
				ReportFailure(id);
			}
		}
コード例 #31
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
/**
 * Is a one-way signal blocking the trackdir? A one-way signal on the
 * trackdir against will block, but signals on both trackdirs won't.
 * @param tile the tile to check
 * @param td the trackdir to check
 */
        public static bool HasOnewaySignalBlockingTrackdir(TileIndex tile, Trackdir td)
        {
            return(TileMap.IsTileType(tile, TileType.MP_RAILWAY) && HasSignalOnTrackdir(tile, ReverseTrackdir(td)) &&
                   !HasSignalOnTrackdir(tile, td) && IsOnewaySignal(tile, TrackdirToTrack(td)));
        }
コード例 #32
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
/**
 * Sets the rail type of the given tile
 * @param t the tile to set the rail type of
 * @param r the new rail type for the tile
 */
        public static void SetRailType(this TileIndex t, RailType r)
        {
            BitMath.SB(Map._m[t].m3, 0, 4, r);
        }
コード例 #33
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
/**
 * Gets the track bits of the given tile
 * @param tile the tile to get the track bits from
 * @return the track bits of the tile
 */
        public static TrackBits GetTrackBits(TileIndex tile)
        {
            Debug.Assert(IsPlainRailTile(tile));
            return((TrackBits)BitMath.GB(Map._m[tile].m5, 0, 6));
        }
コード例 #34
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
/**
 * Returns whether the given track is present on the given tile.
 * @param tile  the tile to check the track presence of
 * @param track the track to search for on the tile
 * @pre IsPlainRailTile(tile)
 * @return true if and only if the given track exists on the tile
 */
        public static bool HasTrack(TileIndex tile, Track track)
        {
            return(BitMath.HasBit(GetTrackBits(tile), track));
        }
コード例 #35
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
/**
 * Returns the direction the depot is facing to
 * @param t the tile to get the depot facing from
 * @pre IsRailDepotTile(t)
 * @return the direction the depot is facing
 */
        public static DiagDirection GetRailDepotDirection(this TileIndex t)
        {
            return((DiagDirection)BitMath.GB(Map._m[t].m5, 0, 2));
        }
コード例 #36
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
/**
 * Checks for the presence of signals (either way) on the given track on the
 * given rail tile.
 */
        public static bool HasSignalOnTrack(TileIndex tile, Track track)
        {
            Debug.Assert(IsValidTrack(track));
            return(GetRailTileType(tile) == RailTileType.RAIL_TILE_SIGNALS &&
                   (GetPresentSignals(tile) & SignalOnTrack(track)) != 0);
        }
コード例 #37
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
/**
 * Get the reservation state of the depot
 * @pre IsRailDepot(t)
 * @param t the depot tile
 * @return reservation state
 */
        public static bool HasDepotReservation(this TileIndex t)
        {
            Debug.Assert(IsRailDepot(t));
            return(BitMath.HasBit(Map._m[t].m5, 4));
        }
コード例 #38
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
/**
 * Set the states of the signals (Along/AgainstTrackDir)
 * @param tile  the tile to set the states for
 * @return the state of the signals
 */
        public static uint GetSignalStates(TileIndex tile)
        {
            return(BitMath.GB(Map._m[tile].m4, 4, 4));
        }
コード例 #39
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
/**
 * Add/remove the 'has signal' bit from the RailTileType
 * @param tile the tile to add/remove the signals to/from
 * @param signals whether the rail tile should have signals or not
 * @pre IsPlainRailTile(tile)
 */
        public static void SetHasSignals(this TileIndex tile, bool signals)
        {
            Debug.Assert(IsPlainRailTile(tile));
            Map._m[tile].m5 = BitMath.SB(Map._m[tile].m5, 6, 1, signals);
        }
コード例 #40
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
/**
 * Checks if a rail tile has signals.
 * @param t the tile to get the information from
 * @pre IsTileType(t, MP_RAILWAY)
 * @return true if and only if the tile has signals
 */
        public static bool HasSignals(this TileIndex t)
        {
            return(GetRailTileType(t) == RailTileType.RAIL_TILE_SIGNALS);
        }
コード例 #41
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
/**
 * Checks whether the tile is a rail tile or rail tile with signals.
 * @param t the tile to get the information from
 * @return true if and only if the tile is normal rail (with or without signals)
 */
        public static bool IsPlainRailTile(this TileIndex t)
        {
            return(TileMap.IsTileType(t, TileType.MP_RAILWAY) && IsPlainRail(t));
        }
コード例 #42
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
 public static bool IsSnowRailGround(this TileIndex t)
 {
     return(GetRailGroundType(t) == RailGroundType.RAIL_GROUND_ICE_DESERT);
 }
コード例 #43
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
 public static RailGroundType GetRailGroundType(this TileIndex t)
 {
     return((RailGroundType)BitMath.GB(Map._m[t].m4, 0, 4));
 }
コード例 #44
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
/**
 * Get the reserved track bits for a depot
 * @pre IsRailDepot(t)
 * @param t the tile
 * @return reserved track bits
 */
        public static TrackBits GetDepotReservationTrackBits(this TileIndex t)
        {
            return(HasDepotReservation(t) ? TrackToTrackBits(GetRailDepotTrack(t)) : TrackBits.TRACK_BIT_NONE);
        }
コード例 #45
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
/**
 * Set the reservation state of the depot
 * @pre IsRailDepot(t)
 * @param t the depot tile
 * @param b the reservation state
 */
        public static void SetDepotReservation(this TileIndex t, bool b)
        {
            Debug.Assert(IsRailDepot(t));
            Map._m[t].m5 = BitMath.SB(Map._m[t].m5, 4, 1, b ? 1 : 0);
        }
コード例 #46
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
/**
 * Returns the RailTileType (normal with or without signals,
 * waypoint or depot).
 * @param t the tile to get the information from
 * @pre IsTileType(t, MP_RAILWAY)
 * @return the RailTileType
 */
        public static RailTileType GetRailTileType(this TileIndex t)
        {
            Debug.Assert(TileMap.IsTileType(t, TileType.MP_RAILWAY));
            return((RailTileType)BitMath.GB(Map._m[t].m5, 6, 2));
        }
コード例 #47
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
/**
 * Returns the track of a depot, ignoring direction
 * @pre IsRailDepotTile(t)
 * @param t the tile to get the depot track from
 * @return the track of the depot
 */
        public static Track GetRailDepotTrack(this TileIndex t)
        {
            return(DiagDirToDiagTrack(GetRailDepotDirection(t)));
        }
コード例 #48
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
/**
 * Set the states of the signals (Along/AgainstTrackDir)
 * @param tile  the tile to set the states for
 * @param state the new state
 */
        public static void SetSignalStates(TileIndex tile, uint state)
        {
            BitMath.SB(Map._m[tile].m4, 4, 4, state);
        }
コード例 #49
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
/**
 * Checks whether the given signals is present
 * @param t         the tile to check on
 * @param signalbit the signal
 * @return true if and only if the signal is present
 */
        public static bool IsSignalPresent(this TileIndex t, byte signalbit)
        {
            return(BitMath.HasBit(GetPresentSignals(t), signalbit));
        }
コード例 #50
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
/**
 * Is a pbs signal present along the trackdir?
 * @param tile the tile to check
 * @param td the trackdir to check
 */
        public static bool HasPbsSignalOnTrackdir(TileIndex tile, Trackdir td)
        {
            return(TileMap.IsTileType(tile, TileType.MP_RAILWAY) && HasSignalOnTrackdir(tile, td) &&
                   IsPbsSignal(GetSignalType(tile, TrackdirToTrack(td))));
        }
コード例 #51
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
/**
 * Set whether the given signals are present (Along/AgainstTrackDir)
 * @param tile    the tile to set the present signals for
 * @param signals the signals that have to be present
 */
        public static void SetPresentSignals(TileIndex tile, uint signals)
        {
            BitMath.SB(Map._m[tile].m3, 4, 4, signals);
        }
コード例 #52
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
/** One-way signals can't be passed the 'wrong' way. */
        public static bool IsOnewaySignal(this TileIndex t, Track track)
        {
            return(GetSignalType(t, track) != SignalType.SIGTYPE_PBS);
        }
コード例 #53
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
/**
 * Sets the track bits of the given tile
 * @param t the tile to set the track bits of
 * @param b the new track bits for the tile
 */
        public static void SetTrackBits(this TileIndex t, TrackBits b)
        {
            Debug.Assert(IsPlainRailTile(t));
            BitMath.SB(Map._m[t].m5, 0, 6, b);
        }
コード例 #54
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
        public static bool IsPresignalExit(this TileIndex t, Track track)
        {
            var type = GetSignalType(t, track);

            return(type == SignalType.SIGTYPE_EXIT || type == SignalType.SIGTYPE_COMBO);
        }
コード例 #55
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
/**
 * Get whether the given signals are present (Along/AgainstTrackDir)
 * @param tile the tile to get the present signals for
 * @return the signals that are present
 */
        public static uint GetPresentSignals(TileIndex tile)
        {
            return(BitMath.GB(Map._m[tile].m3, 4, 4));
        }
コード例 #56
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
/**
 * Checks for the presence of signals along the given trackdir on the given
 * rail tile.
 *
 * Along meaning if you are currently driving on the given trackdir, this is
 * the signal that is facing us (for which we stop when it's red).
 */
        public static bool HasSignalOnTrackdir(TileIndex tile, Trackdir trackdir)
        {
            Debug.Assert(IsValidTrackdir(trackdir));
            return(GetRailTileType(tile) == RailTileType.RAIL_TILE_SIGNALS &&
                   GetPresentSignals(tile) & SignalAlongTrackdir(trackdir));
        }
コード例 #57
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
        public static SignalVariant GetSignalVariant(this TileIndex t, Track track)
        {
            byte pos = (byte)((track == Track.TRACK_LOWER || track == Track.TRACK_RIGHT) ? 7 : 3);

            return((SignalVariant)BitMath.GB(Map._m[t].m2, pos, 1));
        }
コード例 #58
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
/**
 * Returns whether this is plain rails, with or without signals. Iow, if this
 * tiles RailTileType is RAIL_TILE_NORMAL or RAIL_TILE_SIGNALS.
 * @param t the tile to get the information from
 * @pre IsTileType(t, MP_RAILWAY)
 * @return true if and only if the tile is normal rail (with or without signals)
 */
        public static bool IsPlainRail(this TileIndex t)
        {
            RailTileType rtt = GetRailTileType(t);

            return(rtt == RailTileType.RAIL_TILE_NORMAL || rtt == RailTileType.RAIL_TILE_SIGNALS);
        }
コード例 #59
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
 public static void SetRailGroundType(this TileIndex t, RailGroundType rgt)
 {
     Map._m[t].m4 = BitMath.SB(Map._m[t].m4, 0, 4, rgt);
 }
コード例 #60
0
ファイル: rail_map.cs プロジェクト: lmxdk/Nopenttd
/**
 * Get the state of a single signal
 * @param t         the tile to get the signal state for
 * @param signalbit the signal
 * @return the state of the signal
 */
        public static SignalState GetSingleSignalState(this TileIndex t, byte signalbit)
        {
            return((SignalState)BitMath.HasBit(GetSignalStates(t), signalbit));
        }