#include "../GameController.h" #include "../strings.h" #include "backend/Exception.h" #include "backend/print.h" #include "backend/Location.h" #include "backend/Dungeon.h" using namespace std; void GameController::cmd_put(string & target_name) { Player & player = this->dungeon->get_player(); Location & location = player.get_location(); for (Object * object : player.inventory) { if (str_lower(object->get_name().c_str()) != str_lower(target_name)) continue; lprtf("Je legt %s neer op de locatie %s.\n", object->get_displayname().c_str(), location.get_name().c_str()); player.inventory.remove(object); location.add_visible_object(object); return; } throw Exception("object \"%s\" niet gevonden", target_name.c_str()); }