public override void CheckTile(bool aHere)
        {
            NWField map = (NWField)CurrentMap;

            if (map == null)
            {
                return;
            }

            int num = fSegments.Count;

            for (int i = 0; i < num; i++)
            {
                ArticulateSegment seg  = GetSegment(i);
                NWTile            tile = (NWTile)map.GetTile(seg.X, seg.Y);

                if (tile != null)
                {
                    if (aHere)
                    {
                        tile.CreaturePtr = this;
                    }
                    else
                    {
                        tile.CreaturePtr = null;
                    }
                }
            }
        }
        public ArticulateSegment Add()
        {
            ArticulateSegment result = CreateSegment();

            fSegments.Add(result);
            return(result);
        }
        public override void SetPos(int aPosX, int aPosY)
        {
            base.SetPos(aPosX, aPosY);
            ArticulateSegment h = Head;

            h.X = aPosX;
            h.Y = aPosY;
        }
        public ArticulateSegment GetSegment(int index)
        {
            ArticulateSegment result = null;

            if (index >= 0 && index < fSegments.Count)
            {
                result = fSegments[index];
            }
            return(result);
        }
        public int FindByPos(int aX, int aY)
        {
            int num = fSegments.Count;

            for (int i = 0; i < num; i++)
            {
                ArticulateSegment seg = GetSegment(i);
                if (seg.X == aX && seg.Y == aY)
                {
                    return(i);
                }
            }

            return(-1);
        }
        public Snake(NWGameSpace space, object owner, int creatureID, bool total, bool setName)
            : base(space, owner, creatureID, total, setName)
        {
            fLength = 5;
            fSegments.Clear();

            ArticulateSegment seg = Add();

            seg.X          = -1;
            seg.Y          = -1;
            seg.ImageIndex = -1;

            if (fLength - 1 >= 1)
            {
                for (int i = 1; i < fLength; i++)
                {
                    seg            = Add();
                    seg.X          = -1;
                    seg.Y          = -1;
                    seg.ImageIndex = -1;
                }
            }
        }
        public override void SetPos(int aPosX, int aPosY)
        {
            base.SetPos(aPosX, aPosY);

            for (int i = Size - 1; i >= 1; i--)
            {
                ArticulateSegment tek1 = base.GetSegment(i);
                ArticulateSegment tek2 = base.GetSegment(i - 1);
                tek1.X = tek2.X;
                tek1.Y = tek2.Y;
            }

            ArticulateSegment tek = base.GetSegment(0);

            tek.X          = aPosX;
            tek.Y          = aPosY;
            tek.ImageIndex = GetSegment(LastDir, SegKind.skHead);
            int prev = Directions.DtNone;

            for (int i = Size - 1; i >= 1; i--)
            {
                tek = base.GetSegment(i);
                ArticulateSegment tek2 = base.GetSegment(i - 1);
                int dir = Directions.GetDirByCoords(tek.X, tek.Y, tek2.X, tek2.Y);

                if (i == Size - 1)
                {
                    tek.ImageIndex = GetSegment(dir, SegKind.skTail);
                }
                else
                {
                    if ((prev == Directions.DtWest && dir == Directions.DtNorth) || (prev == Directions.DtSouth && dir == Directions.DtEast))
                    {
                        tek.ImageIndex = 13;
                    }
                    else
                    {
                        if ((prev == Directions.DtWest && dir == Directions.DtSouth) || (prev == Directions.DtNorth && dir == Directions.DtEast))
                        {
                            tek.ImageIndex = 14;
                        }
                        else
                        {
                            if ((prev == Directions.DtEast && dir == Directions.DtSouth) || (prev == Directions.DtNorth && dir == Directions.DtWest))
                            {
                                tek.ImageIndex = 15;
                            }
                            else
                            {
                                if ((prev == Directions.DtEast && dir == Directions.DtNorth) || (prev == Directions.DtSouth && dir == Directions.DtWest))
                                {
                                    tek.ImageIndex = 16;
                                }
                                else
                                {
                                    tek.ImageIndex = GetSegment(dir, SegKind.skBody);
                                }
                            }
                        }
                    }
                }
                prev = dir;
            }
        }