X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fstandalone%2FUnloadState.cpp;fp=src%2Fstandalone%2FUnloadState.cpp;h=0000000000000000000000000000000000000000;hb=fa3c4a14546d73ddc2671cd5cc58208839bf7173;hp=0b48904935e5e8a660547c8acc1d3f506e998c2c;hpb=bc171dfe0897bccbbf9d9114d128be0801a1aff9;p=blank.git diff --git a/src/standalone/UnloadState.cpp b/src/standalone/UnloadState.cpp deleted file mode 100644 index 0b48904..0000000 --- a/src/standalone/UnloadState.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include "UnloadState.hpp" - -#include "../app/Environment.hpp" -#include "../io/WorldSave.hpp" -#include "../world/ChunkLoader.hpp" - - -namespace blank { -namespace standalone { - -UnloadState::UnloadState( - Environment &env, - ChunkStore &chunks, - const WorldSave &save) -: ProgressState(env, "Unloading chunks: %d/%d (%d%%)") -, env(env) -, chunks(chunks) -, save(save) -, cur(chunks.begin()) -, end(chunks.end()) -, done(0) -, total(chunks.NumLoaded()) -, per_update(64) { - -} - - -void UnloadState::OnResume() { - cur = chunks.begin(); - end = chunks.end(); - done = 0; - total = chunks.NumLoaded(); -} - - -void UnloadState::Handle(const SDL_Event &) { - // ignore everything -} - -void UnloadState::Update(int dt) { - for (std::size_t i = 0; i < per_update && cur != end; ++i, ++cur, ++done) { - if (cur->ShouldUpdateSave()) { - save.Write(*cur); - } - } - if (cur == end) { - env.state.Pop(); - } else { - SetProgress(done, total); - } -} - -} -}