public int Dist( ref cMyCell cell ) { return Loc.Dist(cell.Loc); }
public void AddThing(int nX, int nY , int nValue ) { cMyCell cell = new cMyCell(nX, nY, nValue ); ThingPool.Add( cell.GetKey() , cell); }
public bool Load(BinaryReader bReader) { if (bReader == null) return false; //=================load ==== try { // read from file or write to file int ver = bReader.ReadInt32(); if (ver != nVersion) { // version different } // grid param MaxW = bReader.ReadInt32(); hW = MaxW / 2 ; MaxH = bReader.ReadInt32(); hH = MaxH / 2 ; LayerNum = bReader.ReadInt32(); // layer bool bLayer = bReader.ReadBoolean(); if (bLayer) { Layer.Read( ref bReader ); } // Build thing ThingPool.Clear(); int nCellVer = bReader.ReadInt32(); int nNum = bReader.ReadInt32(); for (int i = 0; i < nNum; i++) { bool bExist = bReader.ReadBoolean(); if (bExist == false) continue; cMyCell cell = new cMyCell(); cell.Read(ref bReader, nCellVer); // LstThing.Add(cell); ThingPool.Add( cell.GetKey(), cell ); } } finally { } // create path findere map // create path finder struct during loading //InitializePathFindMap (); GetPathFinder().ApplyMap( map ); // apply here for new nodes return true; }