Don't suspend loader after each finished task

By moving the common `goto done;` ouf of the if-block 5586802b86 changed
the code so that the loader suspend after each task.
This normally isn't a problem as it will continue in the next frame. But
when entering atlas it is treated as an error.
This commit is contained in:
phosit 2025-12-24 17:13:39 +01:00
parent b7247ae7fb
commit 426ec45751
No known key found for this signature in database
GPG key ID: C9430B600671C268

View file

@ -248,20 +248,25 @@ ProgressiveLoadResult ProgressiveLoad(double time_budget)
ret.status = ERR::TIMED_OUT;
goto done;
}
const int taskResult{std::exchange(currentTask, std::nullopt)->Get()};
// .. failed; abort. loading will continue when we're called in
// the next iteration of the main loop.
// rationale: bail immediately instead of remembering the first
// error that came up so we can report all errors that happen.
else if(currentTask->Get() < 0)
ret.status = static_cast<Status>(currentTask->Get());
if(taskResult < 0)
{
ret.status = static_cast<Status>(taskResult);
goto done;
}
// .. function called PS::Loader::Cancel; abort. return OK since this is an
// intentional cancellation, not an error.
else if(state != LOADING)
if(state != LOADING)
{
ret.status = INFO::OK;
goto done;
}
// .. succeeded; continue and process next queued task.
currentTask.reset();
goto done;
}
// queue is empty, we just finished.