blob: acd4981e22b41858b0e60d301ebf659e50093f3a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#include "../GameController.h"
#include "../util.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();
auto it = find_if_range(player.inventory.range(), by_name_case_insensitive(target_name));
if (!it)
throw Exception("object \"%s\" niet gevonden", target_name.c_str());
Object & object = **it;
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);
}
|