File size: 557 Bytes
4ee4376
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { bin2str } from './common';
import tiles from '../tiles';

export default (data, map) => {
  let view = new Uint8Array(data);

  view.forEach((bits, i) => {
    let xund = { desc: null };

    xund.id = bits;

    if (xund.id > 0) {
      xund.type     = tiles[xund.id].type    || null;
      xund.subtype  = tiles[xund.id].subtype || null;
      xund.desc = tiles[xund.id];
    }

    // raw binary values as strings for research/debug
    xund.binaryText = {
      bits: bin2str(bits, 8)
    };

    map.cells[i]._segmentData.XUND = xund;
  });
};