Example #1
0
 private void SetFromCoords()
 {
     if (!MapPoint.m_initialized)
     {
         MapPoint.InitializeStaticGrid();
     }
     this.m_cellId = (short)((long)(this.m_x - this.m_y) * 14L + (long)this.m_y + (long)((this.m_x - this.m_y) / 2));
 }
Example #2
0
 public static uint CoordToCellId(int x, int y)
 {
     if (!MapPoint.m_initialized)
     {
         MapPoint.InitializeStaticGrid();
     }
     return((uint)((long)(x - y) * 14L + (long)y + (long)((x - y) / 2)));
 }
Example #3
0
        public static Point CellIdToCoord(uint cellId)
        {
            if (!MapPoint.m_initialized)
            {
                MapPoint.InitializeStaticGrid();
            }
            MapPoint point = MapPoint.GetPoint((short)cellId);

            return(new Point(point.X, point.Y));
        }
Example #4
0
        private void SetFromCellId()
        {
            if (!MapPoint.m_initialized)
            {
                MapPoint.InitializeStaticGrid();
            }
            if (this.m_cellId < 0 || (long)this.m_cellId > 560L)
            {
                throw new System.IndexOutOfRangeException("Cell identifier out of bounds (" + this.m_cellId + ").");
            }
            MapPoint mapPoint = MapPoint.OrthogonalGridReference[(int)this.m_cellId];

            this.m_x = mapPoint.X;
            this.m_y = mapPoint.Y;
        }