-- -----------------------------------------------------------------------------
-- SimNetwork: The network simulator
-- simnetwork.lua
-- Main file: initializes and starts game
-- -----------------------------------------------------------------------------

if not SimNetwork_GLOBAL	then dofile("global.lua")	end
if not SimNetwork_INPUT	then dofile("input.lua")	end
if not SimNetwork_TOOLBAR	then dofile("toolbar.lua")	end
if not SimNetwork_SCENE	then dofile("scene.lua")	end
if not SimNetwork_BALANCE	then dofile("balance.lua")	end
if not SimNetwork_SIMULATION	then dofile("simulation.lua")	end

--turn debuggin on/off
debug = false
  
-- -----------------------------------------------------------------------------
-- Function: dprint(string,entity)
-- Inputs: string, entity
-- Returns: none
-- Writes debugging info to the console
-- -----------------------------------------------------------------------------
function dprint(string,entity)
	if debug == true then
		E.print_console(string,entity,"\n")
	end
end


-- collect information about the display
init_viewport()

--initialize mouse cursors
initializeCursors()

-- create game scene
gameScene = Scene:init()

-- create instance of simulation engine
gameSim = Sim:init()
gameSim:setLogicData(	gameScene.map.customers,
			gameScene.map.routers,
			gameScene.map.cables)


-- initialize GUI and load demo scene
gameScene:initGUI()
gameScene:loadDemoScene()
gameSim:begin()

E.enable_timer(true)
