

Commit 6c1eb604 authored by Dav999's avatar Dav999

Map is now loaded at different priority depending on state

If you're looking at the map itself, more time per frame will be
allowed for it. If you're looking at, for example, the script editor,
the map will still be loaded, but allowing less time per frame for
doing so, so the map will be loaded at a slower rate.
parent 52ce2df1
......@@ -113,6 +113,15 @@ platform_labels = {
[8] = "<<<<<<<<",
-- States in which the map is loaded at low priority
lowprio_maploading_states = {
[3] = true,
[10] = true,
[11] = true,
[19] = true,
[28] = true,
knowncommands =
......@@ -1382,8 +1382,15 @@ function love.update(dt)
if state == 1 or state == 12 then
if state == 1 then
-- In the main editor, just work on the map without taking too much time.
elseif state == 12 then
-- If we're looking at the map, then it has a little higher priority.
elseif lowprio_maploading_states[state] then
-- There are states (like the script editor) where we'll load the map at low priority.
if coordsdialog.active or RCMactive or dialog.is_open() then
......@@ -20,7 +20,7 @@ function map_init()
function map_work()
function map_work(timelimit)
-- Work on the map if it's not done yet, stop if we've passed 0.011s
-- Note that it will go over 0.01s, and theoretically take forever.
if rooms_map_done then
......@@ -29,7 +29,7 @@ function map_work()
local st = love.timer.getTime()
while love.timer.getTime()-st < 0.011 do
while love.timer.getTime()-st < timelimit do
map_doroom(rooms_map_current_x, rooms_map_current_y)
rooms_map_current_x = rooms_map_current_x + 1
Markdown is supported
Finish editing this message first!
Please register or to comment