diff options
Diffstat (limited to 'frontend/GameData.cpp')
-rw-r--r-- | frontend/GameData.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/frontend/GameData.cpp b/frontend/GameData.cpp index ad22aa0..0cf6a1d 100644 --- a/frontend/GameData.cpp +++ b/frontend/GameData.cpp @@ -1,5 +1,10 @@ #include <memory> +#include "backend/Enemy.h" +#include "backend/EnemyFactory.h" +#include "backend/Object.h" +#include "backend/ObjectFactory.h" + #include "GameData.h" using namespace std; @@ -13,3 +18,24 @@ GameData::GameData() { this->db = make_unique<DB>("kerkersendraken.db"); } +Enemy * GameData::create_enemy(const string & name) { + Enemy * enemy = EnemyFactory::create_enemy(); + return enemy; +} + +Object * GameData::create_object(const string & name) { + DBStatement query = this->db->prepare("select type from Objecten where naam = ?"); + query.bind(name); + // TODO: uhhhhhhhhh data ophalen + + Object * object = ObjectFactory::create_object(); + return object; +} + +void GameData::leaderbord_add(const string & name, unsigned int gold) { + this->db->prepare("insert into Leaderboard (naam, goudstukken) values (?, ?)") + .bind(name) + .bind(gold) + .execute(); +} + |