//============================= public GeoBlockMultiLayer(GeoReader reader, int geoX, int geoY, bool l2j) : base(geoX, geoY) { _cells3D = new GeoCell[GeoEngine.GEO_BLOCK_SHIFT, GeoEngine.GEO_BLOCK_SHIFT][]; // int layers, count = 0; for (int x = 0; x < GeoEngine.GEO_BLOCK_SHIFT; x++) { for (int y = 0; y < GeoEngine.GEO_BLOCK_SHIFT; y++) { layers = l2j ? reader.get() : reader.getShort(); if (!GeoEngine.layersValid(layers)) { throw new Exception("Invalid layer count " + layers); } // count += layers; _cells3D[x, y] = new GeoCell[layers]; for (int i = layers; i-- > 0;) { _cells3D[x, y][i] = new GeoCellCM(this, reader.getShort(), x, y); } //Util.quickSort(_cells3D[x,y], HeightComparator.Compare); } } // copyCells(count); calcMaxMinHeight(); }
public GeoBlockFlat(GeoReader reader, int geoX, int geoY, bool l2j) : base(geoX, geoY) { _cells = new GeoCell[] { new GeoCellFlat(this, reader.getShort()) }; // if (!l2j) { reader.getShort(); } }
public override bool dataEquals(GeoReader reader) { if (getType() != GeoRegion.getType(reader, true)) { return(false); } // GeoCell[] cells1D; for (int cellX = 0, cellY, layer; cellX < GeoEngine.GEO_BLOCK_SHIFT; cellX++) { for (cellY = 0; cellY < GeoEngine.GEO_BLOCK_SHIFT; cellY++) { cells1D = _cells3D[cellX, cellY]; // if (cells1D.Length != reader.get()) { return(false); } // for (layer = cells1D.Length; layer-- > 0;) { if (cells1D[layer].getHeightAndNSWE() != reader.getShort()) { return(false); } } } } return(true); }
public override bool dataEquals(GeoReader reader) { if (getType() != GeoRegion.getType(reader, true)) { return(false); } if (_cells[0].getHeight() != reader.getShort()) { return(false); } return(true); }
//============================= public GeoBlockComplex(GeoReader reader, int geoX, int geoY, bool l2j) : base(geoX, geoY) { _cells = new GeoCell[GeoEngine.GEO_BLOCK_SHIFT * GeoEngine.GEO_BLOCK_SHIFT]; for (int x = 0, y; x < GeoEngine.GEO_BLOCK_SHIFT; x++) { for (y = 0; y < GeoEngine.GEO_BLOCK_SHIFT; y++) { _cells[indexOf(x, y)] = new GeoCellCM(this, reader.getShort(), x, y); } } calcMaxMinHeight(); }
public static byte getType(GeoReader reader, bool l2j) { if (l2j) { return(reader.get()); } switch (reader.getShort()) { case 0x0000: return(GeoEngine.GEO_BLOCK_TYPE_FLAT); case 0x0040: return(GeoEngine.GEO_BLOCK_TYPE_COMPLEX); default: return(GeoEngine.GEO_BLOCK_TYPE_MULTILAYER); } }
public override bool dataEquals(GeoReader reader) { if (getType() != GeoRegion.getType(reader, true)) { return(false); } // for (int x = 0, y; x < GeoEngine.GEO_BLOCK_SHIFT; x++) { for (y = 0; y < GeoEngine.GEO_BLOCK_SHIFT; y++) { if (_cells[indexOf(x, y)].getHeightAndNSWE() != reader.getShort()) { return(false); } } } return(true); }