diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-01 16:03:53 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-01 16:03:53 +0100 |
commit | a7e84b60366c78b131d43157980fbe4c2df655e6 (patch) | |
tree | 391099bfd358e04c8ef38f33311f92b2cd607afe /frontend/GameData.cpp | |
parent | 798948dbe6f012e194f053c4e862cf697f30b793 (diff) |
small cleanup + checks
Diffstat (limited to 'frontend/GameData.cpp')
-rw-r--r-- | frontend/GameData.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/frontend/GameData.cpp b/frontend/GameData.cpp index 4556621..e62cff1 100644 --- a/frontend/GameData.cpp +++ b/frontend/GameData.cpp @@ -41,8 +41,13 @@ Enemy * GameData::create_enemy(const string & name) { try { auto row = query.row(); - return EnemyFactory::create_enemy(row.col<const char *>(0), row.col<const char *>(1)); - // TODO: set all other properties + auto enemy = unique_ptr<Enemy>{ EnemyFactory::create_enemy(row.col<const char *>(0), row.col<const char *>(1)) }; + // TODO: min/max objects(?) + enemy->set_health(row.col<int>(4)); + enemy->set_attack(static_cast<float>(row.col<int>(5)) / 100); + enemy->set_damage_min(row.col<int>(6)); + enemy->set_damage_max(row.col<int>(7)); + return enemy.release(); } catch (...) { return EnemyFactory::create_enemy(name.c_str()); } |