diff --git a/src/sim_init.cc b/src/sim_init.cc index de97f79e7e..d80fdf5dee 100644 --- a/src/sim_init.cc +++ b/src/sim_init.cc @@ -190,6 +190,23 @@ void SimInit::LoadRecipes() { } } +void SimInit::LoadPackages() { + QueryResult qr; + try { + qr = b_->Query("Packages", NULL); + } catch (std::exception err) { + return; + } // table doesn't exist (okay) + + for (int i = 0; i < qr.rows.size(); ++i) { + std::string package = qr.GetVal("Package", i); + double fill_min = qr.GetVal("FillMin", i); + double fill_max = qr.GetVal("FillMax", i); + std::string strategy = qr.GetVal("Strategy", i); + ctx_->AddPackage(package, fill_min, fill_max, strategy); + } +} + void* SimInit::LoadPreconditioner(std::string name) { using std::map; using std::string; diff --git a/src/sim_init.h b/src/sim_init.h index eca68bffe8..1d5f8da4af 100644 --- a/src/sim_init.h +++ b/src/sim_init.h @@ -80,6 +80,7 @@ class SimInit { void LoadInfo(); void LoadRecipes(); + void LoadPackages(); void LoadSolverInfo(); void LoadPrototypes(); void LoadInitialAgents();