Update for manager changes.

This commit is contained in:
lzwdgc 2021-01-08 04:43:16 +03:00
parent ea250f11ea
commit dc8733dd49
2 changed files with 11 additions and 7 deletions

View file

@ -19,6 +19,7 @@
#include <common.h> #include <common.h>
#include <db.h> #include <db.h>
#include <Polygon4/DataManager/Database.h>
#include <Polygon4/DataManager/Localization.h> #include <Polygon4/DataManager/Localization.h>
#include <Polygon4/DataManager/Storage.h> #include <Polygon4/DataManager/Storage.h>
#include <Polygon4/DataManager/Types.h> #include <Polygon4/DataManager/Types.h>
@ -295,8 +296,9 @@ int main(int argc, char *argv[])
fs::current_path(dir_to_lang_dbs); fs::current_path(dir_to_lang_dbs);
auto storage = polygon4::initStorage(db_fn); auto storage = polygon4::initStorage();
storage->load(); auto database = std::make_unique<polygon4::Database>(db_fn);
storage->load(*database, {});
kv_resolved = get_kv_resolved(dir_to_lang_dbs, *storage.get()); kv_resolved = get_kv_resolved(dir_to_lang_dbs, *storage.get());
// to check correctness // to check correctness

View file

@ -30,6 +30,7 @@
#include <objects.h> #include <objects.h>
#include "other.h" #include "other.h"
#include <Polygon4/DataManager/Database.h>
#include <Polygon4/DataManager/Storage.h> #include <Polygon4/DataManager/Storage.h>
#include <Polygon4/DataManager/Types.h> #include <Polygon4/DataManager/Types.h>
#include <primitives/filesystem.h> #include <primitives/filesystem.h>
@ -328,16 +329,17 @@ int main(int argc, char *argv[])
else else
{ {
bool e = fs::exists(db_path); bool e = fs::exists(db_path);
auto storage = initStorage(db_path.u8string()); auto storage = initStorage();
auto database = std::make_unique<polygon4::Database>(db_path);
if (!e) if (!e)
{ {
storage->create(); storage->create(*database);
storage->save(); storage->save(*database, {});
} }
storage->load(); storage->load(*database, {});
action([&storage, &mapname](const path &, const auto &m) {write_mmo(storage.get(), m, mapname); }); action([&storage, &mapname](const path &, const auto &m) {write_mmo(storage.get(), m, mapname); });
if (inserted_all) if (inserted_all)
storage->save(); storage->save(*database, {});
} }
return 0; return 0;