#include <iostream>
#include <string>
#include <vector>
#include "Room.h"

using namespace std;

/**************************************************************************


ROOM


***************************************************************************/

Room::Room(string n, string desc, vector<string> inv) {
	rName = n;
	rDesc = desc;
	rInventory = inv;
}

void Room::pRoomName() { std::cout << rName << endl; }

void Room::pRoomDesc() { std::cout << rDesc; if (!rDescProvided) { rDescProvided = true; }; }

bool Room::DeliverPaper() { if (rName == "Benno's Office") { return true; } else { return false; } }

bool Room::fillWater() { if (rName == "Commoner's Well" || rName == "River") { return true; } else { return false; } }

bool Room::descriptionProvided() { return rDescProvided; }

bool Room::pRoomPickup(string* item) {
	auto it = find(rInventory.begin(), rInventory.end(), *item);
	if (it != rInventory.end()) { rInventory.erase(it); return true; }
	else { return false; }
}
void Room::pRoomDrop(string* item) { rInventory.push_back(*item); }

bool Room::pRoomItemPresent(string* item) {
	auto it = find(rInventory.begin(), rInventory.end(), *item);
	if (it != rInventory.end()) { return true; }
	else { return false; }
}

void Room::publishRoomItemList() {
	if (rInventory.size() == 0) { return; }
	else if (rInventory.size() == 1) { cout << "This room has one item: " << rInventory[0] << endl << endl; }
	else {
		cout << "This room has the following items:\n";
		for (int i = 0; i < rInventory.size(); i++) { cout << rInventory[i] << endl; }
		cout << "\n";
	}
}


