42 lines
973 B
Lua
42 lines
973 B
Lua
|
local t = {}
|
||
|
local bmp = require 'bmp'
|
||
|
|
||
|
function t.load( filename, name )
|
||
|
local territory = { img = bmp.load( filename ) }
|
||
|
return setmetatable( territory, {__index = t } )
|
||
|
end
|
||
|
|
||
|
--World space coordinate.
|
||
|
function t.isValid( x, y )
|
||
|
|
||
|
end
|
||
|
|
||
|
function t.getPixel( territory, x, y )
|
||
|
--ZERO INDEXED
|
||
|
return territory.img[math.floor( 512 * ( x + 180 ) / 360 ) ][ math.floor( 285 * ( y + 100 ) / 200 ) ]
|
||
|
end
|
||
|
|
||
|
--[[
|
||
|
0
|
||
|
20 -- once sailable.bmp is brighter than this, the area is traversable by ships
|
||
|
60 -- once sailable.bmp and territory.bmp are brighter than this, ships can be placed here
|
||
|
130 -- if territory.bmp is brighter than this and sailable is darker than 60, structures are placeable.
|
||
|
|
||
|
SO:
|
||
|
SAILABLE: 0 (not), 21 (traverse not place), 61 ( traverse and place )
|
||
|
TERRITORY: 131 ( place land if sailable <= 60 ), 61 ( place sea ), 0
|
||
|
]]
|
||
|
|
||
|
function t.draw( nodes )
|
||
|
|
||
|
end
|
||
|
|
||
|
function t.drawConnections( nodes )
|
||
|
|
||
|
end
|
||
|
|
||
|
function t.save( nodes, filename )
|
||
|
|
||
|
end
|
||
|
|
||
|
return t
|