#include #include "backend/print.h" #include "backend/Dungeon.h" #include "../GameController.h" #include "../GameData.h" using namespace std; constexpr const char * cmd_give_key = "Manifesteer"; void GameController::cmd_give(string & item_name) { Player & player = this->dungeon->get_player(); GameData & gamedata = GameData::get_instance(); auto object = unique_ptr(gamedata.create_object(item_name)); lprtf("Object aangemaakt: %s\n", object->get_displayname().c_str()); player.inventory.push_back(object.release()); } void GameController::cmd_cheat(string &) { Player & player = this->dungeon->get_player(); player.cheating = !player.cheating; lprtf("Cheats staan nu %s.\n", player.cheating ? "aan" : "uit"); this->cmdset_cheats(); } void GameController::cmdset_cheats() { Player & player = this->dungeon->get_player(); if (player.cheating) { this->cmds[cmd_give_key] = &GameController::cmd_give; } else { this->cmds.erase(cmd_give_key); } }