Various fixes
This commit is contained in:
		| @@ -413,10 +413,10 @@ local function copy_map_item(stack) | |||||||
|         local new_id = maps.create(src.x, src.z, src.w, src.h, false, src.detail, src.scale); |         local new_id = maps.create(src.x, src.z, src.w, src.h, false, src.detail, src.scale); | ||||||
|         local dest = maps.get(new_id); |         local dest = maps.get(new_id); | ||||||
|         for k,v in pairs(src.fill) do |         for k,v in pairs(src.fill) do | ||||||
|             dest.fill[k] = v; |             dest.fill[k] = table.copy(v); | ||||||
|         end |         end | ||||||
|         for k,v in pairs(src.markers) do |         for k,v in pairs(src.markers) do | ||||||
|             dest.markers[k] = v; |             dest.markers[k] = table.copy(v); | ||||||
|         end |         end | ||||||
|  |  | ||||||
|         copy_meta:set_int("cartographer:map_id", new_id); |         copy_meta:set_int("cartographer:map_id", new_id); | ||||||
|   | |||||||
| @@ -19,7 +19,6 @@ function Map.resize(self, w, h) | |||||||
|     if w >= self.w and h >= self.h then |     if w >= self.w and h >= self.h then | ||||||
|         self.w = w; |         self.w = w; | ||||||
|         self.h = h; |         self.h = h; | ||||||
|         -- FIXME: Is this really correct? Seems questionable. |  | ||||||
|     end |     end | ||||||
| end | end | ||||||
|  |  | ||||||
| @@ -32,8 +31,12 @@ end | |||||||
| -- h: The height, in map coordinates | -- h: The height, in map coordinates | ||||||
| function Map.fill_area(self, x, z, w, h) | function Map.fill_area(self, x, z, w, h) | ||||||
|     for i = math.max(x, 0),math.min(x + w - 1, self.w),1 do |     for i = math.max(x, 0),math.min(x + w - 1, self.w),1 do | ||||||
|  |         if not self.fill[i] then | ||||||
|  |             self.fill[i] = {}; | ||||||
|  |         end | ||||||
|  |  | ||||||
|         for j = math.max(z, 0),math.min(z + h - 1, self.h),1 do |         for j = math.max(z, 0),math.min(z + h - 1, self.h),1 do | ||||||
|             self.fill[i + (j * self.w)] = self.detail; |             self.fill[i][j] = self.detail; | ||||||
|         end |         end | ||||||
|     end |     end | ||||||
| end | end | ||||||
| @@ -112,7 +115,7 @@ end | |||||||
| -- x: The x position, in map coordinates | -- x: The x position, in map coordinates | ||||||
| -- z: The z position, in map coordinates | -- z: The z position, in map coordinates | ||||||
| function Map.is_filled(self, x, z) | function Map.is_filled(self, x, z) | ||||||
|     return self.fill[(x - self.x) + ((z - self.z) * self.w)] ~= nil; |     return self.fill[x - self.x] and self.fill[x - self.x][z - self.z]; | ||||||
| end | end | ||||||
|  |  | ||||||
| -- The Map API | -- The Map API | ||||||
|   | |||||||
| @@ -238,9 +238,7 @@ end | |||||||
| -- | -- | ||||||
| -- flush: Flush the entire scan queue, scanning all queued regions | -- flush: Flush the entire scan queue, scanning all queued regions | ||||||
| function scanner.scan_regions(flush) | function scanner.scan_regions(flush) | ||||||
|     local len = #scan_queue; |     if #scan_queue == 0 then | ||||||
|  |  | ||||||
|     if len == 0 then |  | ||||||
|         return; |         return; | ||||||
|     end |     end | ||||||
|  |  | ||||||
| @@ -250,6 +248,10 @@ function scanner.scan_regions(flush) | |||||||
|         end |         end | ||||||
|     else |     else | ||||||
|         for _=1,settings.backup_scan_count do |         for _=1,settings.backup_scan_count do | ||||||
|  |             if #scan_queue == 0 then | ||||||
|  |                 break; | ||||||
|  |             end | ||||||
|  |  | ||||||
|             scan_internal(); |             scan_internal(); | ||||||
|         end |         end | ||||||
|     end |     end | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user