aboutsummaryrefslogtreecommitdiff
path: root/frontend/cmd/put.cpp
blob: dabac19abbf6cf02b1885f7ffeb919931490d48d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "../GameController.h"
#include "../strings.h"

#include "backend/print.h"
#include "backend/Location.h"

using namespace std;

FollowupAction GameController::cmd_put(string & target_name) {
	Location & location = this->player.get_location();
	for (Object * object : this->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());
		this->player.inventory.remove(object);
		location.add_visible_object(object);
		return FollowupAction::NONE;
	}
	lprtf("Object \"%s\" niet gevonden.\n", target_name.c_str());
	return FollowupAction::NONE;
}