Résolu Problème de déplacement GameMapNoMovementMessage

Inscrit
7 Mars 2015
Messages
30
Reactions
0
#1
Bonjour,

Lorsque j'envois mon GameMapMovementRequestMessage, je reçois souvent des GameMapNoMovementMessage.
J'ai rajouté les positions des monstres dans les cellules non marchables ainsi que les personnages et pnj.

Le bot ne se déplace pas : https://puu.sh/qwsui/38f10e409c.jpg
Le bot se déplace : https://puu.sh/qwteb/9a60472d0f.jpg

Pensez vous que mon problème vienne du pathfinder (c'est un a*) ?
J'attends vos avis.
 
Inscrit
10 Mai 2015
Messages
357
Reactions
55
#2
Je sais pas si tu compresses les cellules comme le client l'envoie au serveur, si c'est le cas tu le fais peut-être mal et si tu le fais pas c'est peut-être pour ça.
 

BlueDream

Administrateur
Membre du personnel
Inscrit
8 Decembre 2012
Messages
2 010
Reactions
149
#3
Comme l'a dit Brizze, je pense aussi que ça vient de la compression du chemin.

Voici la classe AS3 qui gère cela, MapMovementAdapter.

Code:
package com.ankamagames.dofus.logic.game.common.managers
{
   import com.ankamagames.jerakine.logger.Logger;
   import com.ankamagames.jerakine.types.positions.MovementPath;
   import com.ankamagames.jerakine.types.positions.PathElement;
   import com.ankamagames.jerakine.types.positions.MapPoint;
   import com.ankamagames.jerakine.logger.Log;
   import flash.utils.getQualifiedClassName;
   
   public class MapMovementAdapter extends Object
   {
     
      private static const DEBUG_ADAPTER:Boolean = false;
     
      protected static const _log:Logger = Log.getLogger(getQualifiedClassName(MapMovementAdapter));
       
      public function MapMovementAdapter()
      {
         super();
      }
     
      public static function getServerMovement(param1:MovementPath) : Vector.<uint>
      {
         var _loc5_:PathElement = null;
         var _loc6_:* = 0;
         var _loc7_:* = 0;
         var _loc8_:String = null;
         var _loc9_:uint = 0;
         param1.compress();
         var _loc2_:Vector.<uint> = new Vector.<uint>();
         var _loc3_:uint = 0;
         var _loc4_:uint = 0;
         for each(_loc5_ in param1.path)
         {
            _loc3_ = _loc5_.orientation;
            _loc7_ = (_loc3_ & 7) << 12 | _loc5_.step.cellId & 4095;
            _loc2_.push(_loc7_);
            _loc4_++;
         }
         _loc6_ = (_loc3_ & 7) << 12 | param1.end.cellId & 4095;
         _loc2_.push(_loc6_);
         if(DEBUG_ADAPTER)
         {
            _loc8_ = "";
            for each(_loc9_ in _loc2_)
            {
               _loc8_ = _loc8_ + ((_loc9_ & 4095) + " > ");
            }
            _log.debug("Sending path : " + _loc8_);
         }
         return _loc2_;
      }
     
      public static function getClientMovement(param1:Vector.<uint>) : MovementPath
      {
         var _loc4_:PathElement = null;
         var _loc5_:* = 0;
         var _loc6_:MapPoint = null;
         var _loc7_:PathElement = null;
         var _loc8_:String = null;
         var _loc9_:PathElement = null;
         var _loc2_:MovementPath = new MovementPath();
         var _loc3_:uint = 0;
         for each(_loc5_ in param1)
         {
            _loc6_ = MapPoint.fromCellId(_loc5_ & 4095);
            _loc7_ = new PathElement();
            _loc7_.step = _loc6_;
            if(_loc3_ == 0)
            {
               _loc2_.start = _loc6_;
            }
            else
            {
               _loc4_.orientation = _loc4_.step.orientationTo(_loc7_.step);
            }
            if(_loc3_ == param1.length - 1)
            {
               _loc2_.end = _loc6_;
               break;
            }
            _loc2_.addPoint(_loc7_);
            _loc4_ = _loc7_;
            _loc3_++;
         }
         _loc2_.fill();
         if(DEBUG_ADAPTER)
         {
            _loc8_ = "Start : " + _loc2_.start.cellId + " | ";
            for each(_loc9_ in _loc2_.path)
            {
               _loc8_ = _loc8_ + (_loc9_.step.cellId + " > ");
            }
            _log.debug("Received path : " + _loc8_ + " | End : " + _loc2_.end.cellId);
         }
         return _loc2_;
      }
   }
}
 
Inscrit
7 Mars 2015
Messages
30
Reactions
0
#4
Effectivement le problème vient bien de là. Quand j'essaie de modifier ma fonction j'arrive à envoyer le bon chemin, mais quand je fais ça c'est d'autres trajets qui ne fonctionnent plus. Je vois vraiment pas ce qui cloche. Peut être que l'orientation pour la case d'arrivée n'est pas la bonne ?
Voici mon code :
C#:
public static short[] GetCompressedPath(PathElement[] path)
        {
            List<short> compressedPath = new List<short>();
            for (int i = 0; i < path.Length - 1; i++)
            {
                path[i].SetOrientation(path[i + 1]);
                compressedPath.Add((short)((path[i].Orientation & 7) << 12 | path[i].Id & 4095));
            }
            for (int i = compressedPath.Count - 1; i > 0; i--)
            {
                if (path[i].Orientation == path[i - 1].Orientation)
                    compressedPath.RemoveAt(i);
            }
            path[path.Length - 1].SetOrientation(path[path.Length - 2].Orientation);
            compressedPath.Add((short)((path[path.Length - 1].Orientation & 7) << 12 | path[path.Length - 1].Id & 4095));
            return compressedPath.ToArray();
        }

public void SetOrientation(PathElement nextCell)
        {
            int vecx = nextCell.X > X ? 1 : nextCell.X < X ? -1 : 0;
            int vecy = nextCell.Y > Y ? 1 : nextCell.Y < Y ? -1 : 0;
            if (X == nextCell.X && Y == nextCell.Y)
                Orientation = 1;
            else if (vecx == 1 && vecy == 1)
                Orientation = 0;
            else if (vecx == 1 && vecy == 0)
                Orientation = 1;
            else if (vecx == 1 && vecy == -1)
                Orientation = 2;
            else if (vecx == 0 && vecy == -1)
                Orientation = 3;
            else if (vecx == -1 && vecy == -1)
                Orientation = 4;
            else if (vecx == -1 && vecy == 0)
                Orientation = 5;
            else if (vecx == -1 && vecy == 1)
                Orientation = 6;
            else if (vecx == 0 && vecy == 1)
                Orientation = 7;
        }
 
Dernière édition par un modérateur:

BlueDream

Administrateur
Membre du personnel
Inscrit
8 Decembre 2012
Messages
2 010
Reactions
149
#5
Oulala, coloration syntaxique s'il te plait :teeth:

A mon avis c'est ton SetOrientation, même si je comprend pas tout.

C#:
public void SetOrientation(CellWithOrientation nextCell)
        {
            if (nextCell.X == X)
            {
                if (nextCell.Y == Y + 1)
                    Orientation = 7;
                else if (nextCell.Y == Y - 1)
                    Orientation = 3;
            }
            else if (nextCell.Y == Y)
            {
                if (nextCell.X == X + 1)
                    Orientation = 1;
                else if (nextCell.X == X - 1)
                    Orientation = 5;
            }
            else
            {
                if (nextCell.X == X + 1 && nextCell.Y == Y + 1)
                    Orientation = 0;
                else if (nextCell.X == X + 1 && nextCell.Y == Y - 1)
                    Orientation = 2;
                else if (nextCell.X == X - 1 && nextCell.Y == Y - 1)
                    Orientation = 4;
                else if (nextCell.X == X - 1 && nextCell.Y == Y + 1)
                    Orientation = 6;
            }
        }
Tu devrais revoir ta fonction GetCompressedPath.
Déjà ya surement une exception si le chemin est de seulement deux cellules.
 
Inscrit
7 Mars 2015
Messages
30
Reactions
0
#6
Bah concernant le SetOrientation je me suis inspiré de l'officiel :D

Code:
public function orientationTo(param1:MapPoint) : uint
      {
         var _loc3_:uint = 0;
         if(this.x == param1.x && this.y == param1.y)
         {
            return 1;
         }
         var _loc2_:Point = new Point();
         _loc2_.x = param1.x > this.x?1:param1.x < this.x?-1:0;
         _loc2_.y = param1.y > this.y?1:param1.y < this.y?-1:0;
         if(_loc2_.x == VECTOR_RIGHT.x && _loc2_.y == VECTOR_RIGHT.y)
         {
            _loc3_ = DirectionsEnum.RIGHT;
         }
         else if(_loc2_.x == VECTOR_DOWN_RIGHT.x && _loc2_.y == VECTOR_DOWN_RIGHT.y)
         {
            _loc3_ = DirectionsEnum.DOWN_RIGHT;
         }
         else if(_loc2_.x == VECTOR_DOWN.x && _loc2_.y == VECTOR_DOWN.y)
         {
            _loc3_ = DirectionsEnum.DOWN;
         }
         else if(_loc2_.x == VECTOR_DOWN_LEFT.x && _loc2_.y == VECTOR_DOWN_LEFT.y)
         {
            _loc3_ = DirectionsEnum.DOWN_LEFT;
         }
         else if(_loc2_.x == VECTOR_LEFT.x && _loc2_.y == VECTOR_LEFT.y)
         {
            _loc3_ = DirectionsEnum.LEFT;
         }
         else if(_loc2_.x == VECTOR_UP_LEFT.x && _loc2_.y == VECTOR_UP_LEFT.y)
         {
            _loc3_ = DirectionsEnum.UP_LEFT;
         }
         else if(_loc2_.x == VECTOR_UP.x && _loc2_.y == VECTOR_UP.y)
         {
            _loc3_ = DirectionsEnum.UP;
         }
         else if(_loc2_.x == VECTOR_UP_RIGHT.x && _loc2_.y == VECTOR_UP_RIGHT.y)
         {
            _loc3_ = DirectionsEnum.UP_RIGHT;
         }
         return _loc3_;
      }
Dans ton SetOrientation il me semble qu'il manque les diagonales (quand y vaut y + 2) ?
Et non ça fonctionne très bien que le trajet ne possède que deux cellules. Pouvez vous me dire comment vous vous occupez de mettre la dernière cell :) ?
 

BlueDream

Administrateur
Membre du personnel
Inscrit
8 Decembre 2012
Messages
2 010
Reactions
149
#7
C#:
public static short[] GetCompressedPath(List<CellWithOrientation> path)
        {
            List<short> compressedPath = new List<short>();
            if (path.Count < 2)
            {

                foreach (CellWithOrientation node in path)
                {
                    node.GetCompressedValue();
                    compressedPath.Add(node.CompressedValue);
                }
            }
            else
            {
                for (int i = 0; i < path.Count - 1; i++)
                {
                    path[i].SetOrientation(path[i + 1]);
                }

                path[path.Count - 1].SetOrientation(path[path.Count - 2].Orientation);
                foreach (CellWithOrientation cell in path)
                {
                    cell.GetCompressedValue();
                }
                compressedPath.Add(path[0].CompressedValue);
                for (int i = 1; i < path.Count - 1; i++)
                {
                    if (path[i].Orientation != path[i - 1].Orientation)
                        compressedPath.Add(path[i].CompressedValue);
                }
                compressedPath.Add(path[path.Count - 1].CompressedValue);
            }
            return compressedPath.ToArray();
        }
 
Inscrit
7 Mars 2015
Messages
30
Reactions
0
#8
Même en collant exactement ton code ça ne marche pas ^^. Ça me fait bien ch*er surtout que c'est juste pour un type de trajet que ça fonctionne pas. D'habitude je galère pas mais là ça veut pas :/.
 

BlueDream

Administrateur
Membre du personnel
Inscrit
8 Decembre 2012
Messages
2 010
Reactions
149
#9
Montre nous à quoi correspond ton chemin, sans compresser les cellid mais uniquement en retirant celles de la même orientation.
Doit yavoir quelque chose qui diffère à une ou deux plumes de piou :teeth:
 

BlueDream

Administrateur
Membre du personnel
Inscrit
8 Decembre 2012
Messages
2 010
Reactions
149
#11
Il y a un problème d'orientation, normalement ton trajet aurait du être composé de 4 cellules.

311 ; 412 ; 468 ; 483

EDIT: Les lignes droites son supprimées simplement, pour raccourcir la trajet.
Essaye ma fonction setOrientation.
 
Dernière édition:
Inscrit
7 Mars 2015
Messages
30
Reactions
0
#12
Sauf que là j'utilise la fonction que tu m'as donné pour trouver l'orientation (avec la mienne ça donne les mêmes orientations) :/
 

BlueDream

Administrateur
Membre du personnel
Inscrit
8 Decembre 2012
Messages
2 010
Reactions
149
#13
Dans ce cas, essaye mes deux fonctions en même temps si ce n'est pas encore fait.
 
Inscrit
7 Mars 2015
Messages
30
Reactions
0
#14
Déjà fait -_-. Le jeu ne veut tout simplement pas de mes déplacements j'ai l'impression.
 

BlueDream

Administrateur
Membre du personnel
Inscrit
8 Decembre 2012
Messages
2 010
Reactions
149
#15
Ton orientation ne peut pas être de 7 et 0 à chaque fois.
Il y a 8 orientations différentes.
 
Inscrit
7 Mars 2015
Messages
30
Reactions
0
#16
Je le sais très bien mais quand je calcule les orientations avec la fonction du jeu ou la tienne c'est ce que j'obtiens pour ce trajet. J'arrive pas à trouver mon erreur.
 
Inscrit
18 Février 2015
Messages
228
Reactions
7
#17
Essaye le pathfinder de Stump peut-être que tu y trouvera ton bonheur ^^"
 
Inscrit
7 Mars 2015
Messages
30
Reactions
0
#18
C'est pas le pathfinder qui me pose soucis mais bien la compression du trajet :D. Finalement je le compresse pas et ça marche. A voir si je me fais ban x).

EDIT : Le problème avec les fonctions qui donnent l'orientation c'est que même si le chemin est une ligne droite, on aura des orientations différentes vu que les cells ont des positions adjacentes différentes en fonction du Y
 
Inscrit
10 Mai 2015
Messages
357
Reactions
55
#19
Tu transformes peut-être mal les cellules en x ; y
 

BlueDream

Administrateur
Membre du personnel
Inscrit
8 Decembre 2012
Messages
2 010
Reactions
149
#20
Cette fois cela concerne la classe MapPoint. Je pense en effet, que cela vienne des coordonnées.

Code:
package com.ankamagames.jerakine.types.positions
{
   import com.ankamagames.jerakine.logger.Logger;
   import flash.geom.Point;
   import com.ankamagames.jerakine.logger.Log;
   import flash.utils.getQualifiedClassName;
   import com.ankamagames.jerakine.types.enums.DirectionsEnum;
   import com.ankamagames.jerakine.map.IDataMapProvider;
   import com.ankamagames.jerakine.utils.errors.JerakineError;
   
   public class MapPoint extends Object
   {
     
      protected static const _log:Logger = Log.getLogger(getQualifiedClassName(MapPoint));
     
      private static const VECTOR_RIGHT:Point = new Point(1,1);
     
      private static const VECTOR_DOWN_RIGHT:Point = new Point(1,0);
     
      private static const VECTOR_DOWN:Point = new Point(1,-1);
     
      private static const VECTOR_DOWN_LEFT:Point = new Point(0,-1);
     
      private static const VECTOR_LEFT:Point = new Point(-1,-1);
     
      private static const VECTOR_UP_LEFT:Point = new Point(-1,0);
     
      private static const VECTOR_UP:Point = new Point(-1,1);
     
      private static const VECTOR_UP_RIGHT:Point = new Point(0,1);
     
      public static const MAP_WIDTH:uint = 14;
     
      public static const MAP_HEIGHT:uint = 20;
     
      private static var _bInit:Boolean = false;
     
      public static var CELLPOS:Array = new Array();
       
      private var _nCellId:uint;
     
      private var _nX:int;
     
      private var _nY:int;
     
      public function MapPoint()
      {
         super();
      }
     
      public static function fromCellId(param1:uint) : MapPoint
      {
         var _loc2_:MapPoint = new MapPoint();
         _loc2_._nCellId = param1;
         _loc2_.setFromCellId();
         return _loc2_;
      }
     
      public static function fromCoords(param1:int, param2:int) : MapPoint
      {
         var _loc3_:MapPoint = new MapPoint();
         _loc3_._nX = param1;
         _loc3_._nY = param2;
         _loc3_.setFromCoords();
         return _loc3_;
      }
     
      public static function getOrientationsDistance(param1:int, param2:int) : int
      {
         return Math.min(Math.abs(param2 - param1),Math.abs(8 - param2 + param1));
      }
     
      public static function isInMap(param1:int, param2:int) : Boolean
      {
         return param1 + param2 >= 0 && param1 - param2 >= 0 && param1 - param2 < MAP_HEIGHT * 2 && param1 + param2 < MAP_WIDTH * 2;
      }
     
      private static function init() : void
      {
         var _loc4_:* = 0;
         _bInit = true;
         var _loc2_:* = 0;
         while(0 < MAP_HEIGHT)
         {
            _loc4_ = 0;
            while(_loc4_ < MAP_WIDTH)
            {
               CELLPOS[0] = new Point(0 + _loc4_,_loc2_ + _loc4_);
               _loc3_++;
               _loc4_++;
            }
            _loc1_++;
            _loc4_ = 0;
            while(_loc4_ < MAP_WIDTH)
            {
               CELLPOS[0] = new Point(0 + _loc4_,_loc2_ + _loc4_);
               _loc3_++;
               _loc4_++;
            }
            _loc2_--;
            _loc5_++;
         }
      }
     
      public function get cellId() : uint
      {
         return this._nCellId;
      }
     
      public function set cellId(param1:uint) : void
      {
         this._nCellId = param1;
         this.setFromCellId();
      }
     
      public function get x() : int
      {
         return this._nX;
      }
     
      public function set x(param1:int) : void
      {
         this._nX = param1;
         this.setFromCoords();
      }
     
      public function get y() : int
      {
         return this._nY;
      }
     
      public function set y(param1:int) : void
      {
         this._nY = param1;
         this.setFromCoords();
      }
     
      public function get coordinates() : Point
      {
         return new Point(this._nX,this._nY);
      }
     
      public function distanceTo(param1:MapPoint) : uint
      {
         return Math.sqrt(Math.pow(param1.x - this.x,2) + Math.pow(param1.y - this.y,2));
      }
     
      public function distanceToCell(param1:MapPoint) : int
      {
         return Math.abs(this.x - param1.x) + Math.abs(this.y - param1.y);
      }
     
      public function orientationTo(param1:MapPoint) : uint
      {
         var _loc3_:uint = 0;
         if(this.x == param1.x && this.y == param1.y)
         {
            return 1;
         }
         var _loc2_:Point = new Point();
         _loc2_.x = param1.x > this.x?1:param1.x < this.x?-1:0;
         _loc2_.y = param1.y > this.y?1:param1.y < this.y?-1:0;
         if(_loc2_.x == VECTOR_RIGHT.x && _loc2_.y == VECTOR_RIGHT.y)
         {
            _loc3_ = DirectionsEnum.RIGHT;
         }
         else if(_loc2_.x == VECTOR_DOWN_RIGHT.x && _loc2_.y == VECTOR_DOWN_RIGHT.y)
         {
            _loc3_ = DirectionsEnum.DOWN_RIGHT;
         }
         else if(_loc2_.x == VECTOR_DOWN.x && _loc2_.y == VECTOR_DOWN.y)
         {
            _loc3_ = DirectionsEnum.DOWN;
         }
         else if(_loc2_.x == VECTOR_DOWN_LEFT.x && _loc2_.y == VECTOR_DOWN_LEFT.y)
         {
            _loc3_ = DirectionsEnum.DOWN_LEFT;
         }
         else if(_loc2_.x == VECTOR_LEFT.x && _loc2_.y == VECTOR_LEFT.y)
         {
            _loc3_ = DirectionsEnum.LEFT;
         }
         else if(_loc2_.x == VECTOR_UP_LEFT.x && _loc2_.y == VECTOR_UP_LEFT.y)
         {
            _loc3_ = DirectionsEnum.UP_LEFT;
         }
         else if(_loc2_.x == VECTOR_UP.x && _loc2_.y == VECTOR_UP.y)
         {
            _loc3_ = DirectionsEnum.UP;
         }
         else if(_loc2_.x == VECTOR_UP_RIGHT.x && _loc2_.y == VECTOR_UP_RIGHT.y)
         {
            _loc3_ = DirectionsEnum.UP_RIGHT;
         }
         return _loc3_;
      }
     
      public function advancedOrientationTo(param1:MapPoint, param2:Boolean = true) : uint
      {
         if(!param1)
         {
            return 0;
         }
         var _loc3_:int = param1.x - this.x;
         var _loc4_:int = this.y - param1.y;
         var _loc5_:int = Math.acos(_loc3_ / Math.sqrt(Math.pow(_loc3_,2) + Math.pow(_loc4_,2))) * 180 / Math.PI * (param1.y > this.y?-1:1);
         if(param2)
         {
            _loc5_ = Math.round(_loc5_ / 90) * 2 + 1;
         }
         else
         {
            _loc5_ = Math.round(_loc5_ / 45) + 1;
         }
         if(_loc5_ < 0)
         {
            _loc5_ = _loc5_ + 8;
         }
         return _loc5_;
      }
     
      public function getNearestFreeCell(param1:IDataMapProvider, param2:Boolean = true) : MapPoint
      {
         var _loc3_:MapPoint = null;
         var _loc4_:uint = 0;
         while(_loc4_ < 8)
         {
            _loc3_ = this.getNearestFreeCellInDirection(_loc4_,param1,false,param2);
            if(_loc3_)
            {
               break;
            }
            _loc4_++;
         }
         return _loc3_;
      }
     
      public function getNearestCellInDirection(param1:uint) : MapPoint
      {
         var _loc2_:MapPoint = null;
         switch(param1)
         {
            case 0:
               _loc2_ = MapPoint.fromCoords(this._nX + 1,this._nY + 1);
               break;
            case 1:
               _loc2_ = MapPoint.fromCoords(this._nX + 1,this._nY);
               break;
            case 2:
               _loc2_ = MapPoint.fromCoords(this._nX + 1,this._nY - 1);
               break;
            case 3:
               _loc2_ = MapPoint.fromCoords(this._nX,this._nY - 1);
               break;
            case 4:
               _loc2_ = MapPoint.fromCoords(this._nX - 1,this._nY - 1);
               break;
            case 5:
               _loc2_ = MapPoint.fromCoords(this._nX - 1,this._nY);
               break;
            case 6:
               _loc2_ = MapPoint.fromCoords(this._nX - 1,this._nY + 1);
               break;
            case 7:
               _loc2_ = MapPoint.fromCoords(this._nX,this._nY + 1);
               break;
         }
         if(MapPoint.isInMap(_loc2_._nX,_loc2_._nY))
         {
            return _loc2_;
         }
         return null;
      }
     
      public function getNearestFreeCellInDirection(param1:uint, param2:IDataMapProvider, param3:Boolean = true, param4:Boolean = true, param5:Boolean = false, param6:Array = null) : MapPoint
      {
         var _loc10_:* = 0;
         var _loc11_:* = 0;
         var _loc13_:* = 0;
         var _loc7_:MapPoint = null;
         if(param6 == null)
         {
            var param6:Array = new Array();
         }
         var _loc8_:Vector.<MapPoint> = new Vector.<MapPoint>(8,true);
         var _loc9_:Vector.<int> = new Vector.<int>(8,true);
         _loc10_ = 0;
         while(_loc10_ < 8)
         {
            _loc7_ = this.getNearestCellInDirection(_loc10_);
            if(_loc7_ != null && param6.indexOf(_loc7_.cellId) == -1)
            {
               _loc11_ = param2.getCellSpeed(_loc7_.cellId);
               if(!param2.pointMov(_loc7_._nX,_loc7_._nY,param4,this.cellId))
               {
                  _loc11_ = -100;
               }
               _loc9_[_loc10_] = getOrientationsDistance(_loc10_,param1) + (!param5?_loc11_ >= 0?5 - _loc11_:11 + Math.abs(_loc11_):0);
            }
            else
            {
               _loc9_[_loc10_] = 1000;
            }
            _loc8_[_loc10_] = _loc7_;
            _loc10_++;
         }
         _loc7_ = null;
         var _loc12_:* = 0;
         var _loc14_:int = _loc9_[0];
         _loc10_ = 1;
         while(_loc10_ < 8)
         {
            _loc13_ = _loc9_[_loc10_];
            if(_loc13_ < _loc14_ && _loc8_[_loc10_] != null)
            {
               _loc14_ = _loc13_;
               _loc12_ = _loc10_;
            }
            _loc10_++;
         }
         _loc7_ = _loc8_[_loc12_];
         if(_loc7_ == null && param3 && param2.pointMov(this._nX,this._nY,param4,this.cellId))
         {
            return this;
         }
         return _loc7_;
      }
     
      public function pointSymetry(param1:MapPoint) : MapPoint
      {
         var _loc2_:int = 2 * param1.x - this.x;
         var _loc3_:int = 2 * param1.y - this.y;
         if(isInMap(_loc2_,_loc3_))
         {
            return MapPoint.fromCoords(_loc2_,_loc3_);
         }
         return null;
      }
     
      public function equals(param1:MapPoint) : Boolean
      {
         return param1.cellId == this.cellId;
      }
     
      public function toString() : String
      {
         return "[MapPoint(x:" + this._nX + ", y:" + this._nY + ", id:" + this._nCellId + ")]";
      }
     
      private function setFromCoords() : void
      {
         if(!_bInit)
         {
            init();
         }
         this._nCellId = (this._nX - this._nY) * MAP_WIDTH + this._nY + (this._nX - this._nY) / 2;
      }
     
      private function setFromCellId() : void
      {
         if(!_bInit)
         {
            init();
         }
         if(!CELLPOS[this._nCellId])
         {
            throw new JerakineError("Cell identifier out of bounds (" + this._nCellId + ").");
         }
         var _loc1_:Point = CELLPOS[this._nCellId];
         this._nX = _loc1_.x;
         this._nY = _loc1_.y;
      }
   }
}
 
Haut Bas