diff --git a/src/c3nav/mapdata/cache.py b/src/c3nav/mapdata/cache.py index c8bdfc79..b05a6ff2 100644 --- a/src/c3nav/mapdata/cache.py +++ b/src/c3nav/mapdata/cache.py @@ -1,6 +1,7 @@ import math import os import struct +from itertools import chain import numpy as np from django.conf import settings @@ -20,8 +21,11 @@ class MapHistory: # 2 bytes (uint16): origin width # 2 bytes (uint16): origin height # 2 bytes (uint16): number of updates - # n*16 bytes: update keys as null-terminated strings - # width*height*2 bytes: data (line after line) with uint16 data + # n uptates times: + # 4 bytes (uint32): update id + # 4 bytes (uint32): timestamp + # width*height*2 bytes: + # data array (line after line) with uint16 cells def __init__(self, resolution=settings.CACHE_RESOLUTION, x=0, y=0, updates=None, data=np.empty((0, 0))): self.resolution = resolution @@ -36,7 +40,8 @@ class MapHistory: try: with open(filename, 'rb') as f: resolution, x, y, width, height, num_updates = struct.unpack('