Exemple #1
0
        public static void putType(GeoWriter writer, bool l2j, byte type)
        {
            if (l2j)
            {
                writer.put(type);
            }
            else
            {
                switch (type)
                {
                case GeoEngine.GEO_BLOCK_TYPE_FLAT:
                    writer.putShort((short)0x0000);
                    break;

                case GeoEngine.GEO_BLOCK_TYPE_COMPLEX:
                    writer.putShort((short)0x0040);
                    break;

                case GeoEngine.GEO_BLOCK_TYPE_MULTILAYER:
                    writer.putShort((short)0x0080);      // TODO check this
                    break;

                default:
                    throw new ArgumentException("Unkown type: " + type);
                }
            }
        }
 public override void writeTo(GeoWriter writer, bool l2j)
 {
     GeoCell[] layers;
     GeoRegion.putType(writer, l2j, getType());
     for (int x = 0, y, z; x < GeoEngine.GEO_BLOCK_SHIFT; x++)
     {
         for (y = 0; y < GeoEngine.GEO_BLOCK_SHIFT; y++)
         {
             layers = _cells3D[x, y];
             if (l2j)
             {
                 writer.put((byte)layers.Length);
             }
             else
             {
                 writer.putShort((short)layers.Length);
             }
             //
             for (z = layers.Length; z-- > 0;)
             {
                 writer.putShort(layers[z].getHeightAndNSWE());
             }
         }
     }
 }