fixed travel node loading (they were upside-down!)
This commit is contained in:
parent
18ed5c1ce1
commit
7c2c3867cf
|
@ -1 +1,2 @@
|
|||
build/
|
||||
test/
|
|
@ -4,7 +4,7 @@ local t = {}
|
|||
local math = math
|
||||
|
||||
local hash = function( x, y, debug )
|
||||
local s = "h"..("%2d%2d"):format(math.floor( 0.5 + (180 + x) / 10 ), math.floor( 0.5 + (100 + y) / 10 ) )
|
||||
local s = "h"..("%2d%2d"):format(math.floor( 0.5 + (180 + x) / 20 ), math.floor( 0.5 + (100 + y) / 20 ) )
|
||||
return s
|
||||
end
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ local function isConnected( startNode, endNode )
|
|||
|
||||
for i = 1, n do
|
||||
ix, iy = ix + dx, iy + dy
|
||||
if not( isSailable( ix, iy ) ) then return nil end
|
||||
if not( isSailable( ix, -iy ) ) then return nil end
|
||||
end
|
||||
|
||||
return true
|
||||
|
@ -54,7 +54,7 @@ function t.load( filename, sailable )
|
|||
if imgd:getPixel( x, 399 - y ) > 0 then
|
||||
local long = 360 * ( x - 800 ) / 800 - 360 / 2 + 360
|
||||
local lat = 360 * ( 600 / 800 ) * ( 600 - y ) / 600 - 180
|
||||
nodes.nodes[n] = setmetatable({x = long, y = lat, idx = n}, mtTravelNode )
|
||||
nodes.nodes[n] = setmetatable({x = long, y = -lat, idx = n}, mtTravelNode )
|
||||
print( nodes.nodes[n]:formatDisplayInfo() )
|
||||
nodes.points[ 2 * n - 1 ] = long
|
||||
nodes.points[ 2 * n ] = lat
|
||||
|
@ -96,7 +96,7 @@ function t.drawConnections( nodes )
|
|||
for i, connection in pairs( nodes.connections ) do
|
||||
for j in pairs( connection ) do
|
||||
local ix, iy, fx, fy = nodes.nodes[i].x, nodes.nodes[i].y, nodes.nodes[j].x, nodes.nodes[j].y
|
||||
lg.line( ix, iy, fx, fy )
|
||||
lg.line( ix, -iy, fx, -fy )
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue