Code review comment for lp:~widelands-dev/widelands/bug-1810062-territorial-calculations

Revision history for this message
Toni Förster (stonerl) wrote :

From my understanding we can't put this in a coroutine, because:

wl.Game().map.valuable_fields

blocks the lua script, as long as it is calculating, and these
calculations eat up all available cpu.

With this

run(function()
    fields = wl.Game().map.valuable_fields
end)

it runs in a coroutine, but the game stalls until the calculations are
done.

It isn't a real coroutine either, because we need to call

coroutine.yield()

from within the coroutine to pause it. But we can't since the c++ part
blocks the script.

« Back to merge proposal