Lua random map generator: fix off-by-one error in flip transforms
Among other things, this gave HttT S17 (Sceptre of Fire) a 50% chance of crashing at scenario start.
This commit is contained in:
parent
1b1762cdf2
commit
7d0d9e19a5
1 changed files with 2 additions and 2 deletions
|
@ -55,7 +55,7 @@ function map_mt.__index.flip_x(map)
|
|||
for y = 0, map.h - 1 do
|
||||
for x = 0, map.w - 1 do
|
||||
local i = loc_to_index(map, x, y)
|
||||
local j = loc_to_index(map, map.w - x, y)
|
||||
local j = loc_to_index(map, map.w - x - 1, y)
|
||||
map[i], map[j] = map[j], map[i]
|
||||
end
|
||||
end
|
||||
|
@ -65,7 +65,7 @@ function map_mt.__index.flip_y(map)
|
|||
for x = 0, map.w - 1 do
|
||||
for y = 0, map.h - 1 do
|
||||
local i = loc_to_index(map, x, y)
|
||||
local j = loc_to_index(map, x, map.h - y)
|
||||
local j = loc_to_index(map, x, map.h - y - 1)
|
||||
map[i], map[j] = map[j], map[i]
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue